Post
Topic
Board Development & Technical Discussion
Re: Pollard's kangaroo ECDLP solver
by
hskun
on 09/05/2021, 15:07:08 UTC
I tried to
make gpu=1 ccap=53 all
compile on nVidia jetson nano, but since it is ARM architecture, there is no x86 -m64 -mssse3, and i removed  -m64 -mssse3 the compile has error.
Has anyone tried to compile on ARM?

GPU: 128-core NVIDIA Maxwell™ architecture-based GPU
CPU: Quad-core ARM® A57
Memory: 4 GB 64-bit LPDDR4; 25.6 gigabytes/second


Kangaroo uses some Intel assembly instructions baked inside the integer classes so you'd have to find their ARM equivalents and put a macro in them like this:

Code:
void Int::add(Int& a, In& b, Int& c) {
#ifdef ARM_CPU
/* Arm instructions */
#else
/* Intel instructions */
}

And then compile with ARM version of GCC or cross-compile using Clang.

yes, I see kangaroo use Intel __builtin_ia32_addcarryx_u64  _addcarry_u64 .
I try to search the way to replace those functions.
Thanks.

The follow error code:
Code:
In file included from SECPK1/IntGroup.h:21:0,
                 from SECPK1/IntGroup.cpp:18:
SECPK1/Int.h: In function ‘void imm_mul(uint64_t*, uint64_t, uint64_t*, uint64_t*)’:
SECPK1/Int.h:253:32: error: ‘__builtin_ia32_addcarryx_u64’ was not declared in this scope
 #define _addcarry_u64(a,b,c,d) __builtin_ia32_addcarryx_u64(a,b,c,(long long unsigned int*)d);
                                ^
SECPK1/Int.h:279:7: note: in expansion of macro ‘_addcarry_u64’
   c = _addcarry_u64(c, _umul128(x[1], y, &h), carry, dst + 1); carry = h;
       ^~~~~~~~~~~~~
SECPK1/Int.h:253:32: note: suggested alternative: ‘__builtin_isnand64’
 #define _addcarry_u64(a,b,c,d) __builtin_ia32_addcarryx_u64(a,b,c,(long long unsigned int*)d);
                                ^
SECPK1/Int.h:279:7: note: in expansion of macro ‘_addcarry_u64’
   c = _addcarry_u64(c, _umul128(x[1], y, &h), carry, dst + 1); carry = h;
       ^~~~~~~~~~~~~
SECPK1/Int.h: In function ‘void imm_imul(uint64_t*, uint64_t, uint64_t*, uint64_t*)’:
SECPK1/Int.h:253:32: error: ‘__builtin_ia32_addcarryx_u64’ was not declared in this scope
 #define _addcarry_u64(a,b,c,d) __builtin_ia32_addcarryx_u64(a,b,c,(long long unsigned int*)d);
                                ^
SECPK1/Int.h:298:7: note: in expansion of macro ‘_addcarry_u64’
   c = _addcarry_u64(c,_umul128(x[1],y,&h),carry,dst + 1); carry = h;
       ^~~~~~~~~~~~~
SECPK1/Int.h:253:32: note: suggested alternative: ‘__builtin_isnand64’
 #define _addcarry_u64(a,b,c,d) __builtin_ia32_addcarryx_u64(a,b,c,(long long unsigned int*)d);
                                ^
SECPK1/Int.h:298:7: note: in expansion of macro ‘_addcarry_u64’
   c = _addcarry_u64(c,_umul128(x[1],y,&h),carry,dst + 1); carry = h;
       ^~~~~~~~~~~~~
SECPK1/Int.h: In function ‘void imm_umul(uint64_t*, uint64_t, uint64_t*)’:
SECPK1/Int.h:253:32: error: ‘__builtin_ia32_addcarryx_u64’ was not declared in this scope
 #define _addcarry_u64(a,b,c,d) __builtin_ia32_addcarryx_u64(a,b,c,(long long unsigned int*)d);
                                ^
SECPK1/Int.h:318:7: note: in expansion of macro ‘_addcarry_u64’
   c = _addcarry_u64(c, _umul128(x[1], y, &h), carry, dst + 1); carry = h;
       ^~~~~~~~~~~~~
SECPK1/Int.h:253:32: note: suggested alternative: ‘__builtin_isnand64’
 #define _addcarry_u64(a,b,c,d) __builtin_ia32_addcarryx_u64(a,b,c,(long long unsigned int*)d);
                                ^
SECPK1/Int.h:318:7: note: in expansion of macro ‘_addcarry_u64’
   c = _addcarry_u64(c, _umul128(x[1], y, &h), carry, dst + 1); carry = h;
       ^~~~~~~~~~~~~
Makefile:80: recipe for target 'obj/SECPK1/IntGroup.o' failed