Get GCC To Use Carry Logic For Arbitrary Precision Arithmetic Without Inline Assembly?
When working with arbitrary precision arithmetic (e.g. 512-bit integers), is there any way to get GCC to use ADC and similar instructions without using inline assembly? A first glance at GMP's sourcecode shows that they simply have assembly implementations for every supported platform. Here is the test code I wrote, which adds two 128-bit numbers from the command line and prints the result. (Inspired by mini-gmp's add_n): #include <stdio.h> #include <stdint.h> #include <stdlib.h> int main (int argc, char **argv) { uint32_t a[4]; uint32_t b[4]; uint32_t c[4]; uint32_t carry = 0; for (int i = 0;