Artyom Artyom - 7 months ago 27
C Question

undefined reference to `_addcarry_u64'

I have code like this:

uint8_t carry;

carry = 0;
for (i = 0; i < 8; i++)
carry = _addcarry_u64 (carry, *(buf1 + i),
*(buf2 + i), buf1 + i);

And the following error:

undefined reference to `_addcarry_u64'

I compile with flags:

CCFLAGS = -Wall -g -msse -msse2 -msse3 -msse4 -mavx -mavx2 -fopenmp

I also include:

#include <immintrin.h>
#include <emmintrin.h>
#include <pmmintrin.h>
#include <smmintrin.h>
#include <omp.h>

The same kind of problem I have while trying to use
function from intrinsics.

I use x86_64 ubuntu 14.04 and gcc compiler.


_addcarry_u64 was added in GCC 5.1. You also need the intrinsics include:

 #include <x86intrin.h>

You also need -march=native if the cpu supports ADX (see /proc/cpuinfo); or -madx to enable ADX (if its not native).