c++ - GCC 6.4 and "error: _addcarryx_u64 was not declared in this scope" -
i'm attempting test adx instructions under gcc 6.4 on 6th gen core i5. machine has adx extensions (see cpu flags below). here's program (it may not correct @ point):
$ cat -n test.cxx 1 #include <iostream> 2 #include <string> 3 #include <cstdint> 4 #include <cstring> 5 6 #include <immintrin.h> 7 #if !defined(__adx__) 8 # error adx not available 9 #endif 10 11 int main(int argc, char* argv[]) 12 { 13 enum {count=5}; 14 uint64_t c[count], a[count], b[count]; 15 16 std::memset(a, 0xff, count*sizeof(a[0])); 17 std::memset(b, 0xff, count*sizeof(b[0])); 18 19 const ssize_t nn = static_cast<ssize_t>(count); 20 21 uint8_t carry = 0; 22 (ssize_t i=nn-1; i>=1; i-=2) 23 { 24 uint8_t c = _addcarryx_u64(carry, a[i], b[i], &c[i]); 25 carry = _addcarryx_u64(c, a[i-1], b[i-1], &c[i-1]); 26 } 27 28 if(nn & 1) 29 carry = _addcarryx_u64(carry, a[0], b[0], &c[0]); 30 31 // if (carry) 32 // handle carry out 33 34 return 0; 35 }
i'm catching compile error:
$ g++ -march=native test.cxx -o test.exe test.cxx: in function ‘int main(int, char**)’: test.cxx:24:53: error: ‘_addcarryx_u64’ not declared in scope uint8_t c = _addcarryx_u64(carry, a[i], b[i], &c[i]); ^ test.cxx:29:49: error: ‘_addcarryx_u64’ not declared in scope carry = _addcarryx_u64(carry, a[0], b[0], &c[0]); ^
i've double checked intel docs , <immintrin.h>
header include adx intrinsics.
why experiencing compile error, , how fix it?
$ cat /proc/cpuinfo ... flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx pdpe1gb rdt scp lm constant_tsc art arch_perfmon pebs bts rep_good nopl xtopology nonstop_ts c cpuid aperfmperf tsc_known_freq pni pclmulqdq dtes64 monitor ds_cpl vmx est tm 2 ssse3 sdbg fma cx16 xtpr pdcm pcid sse4_1 sse4_2 x2apic movbe popcnt tsc_deadl ine_timer aes xsave avx f16c rdrand lahf_lm abm 3dnowprefetch intel_pt tpr_shado w vnmi flexpriority ept vpid fsgsbase tsc_adjust bmi1 avx2 smep bmi2 erms invpci d mpx rdseed adx smap clflushopt xsaveopt xsavec xgetbv1 xsaves dtherm ida arat pln pts hwp hwp_notify hwp_act_window hwp_epp
Comments
Post a Comment