-
Notifications
You must be signed in to change notification settings - Fork 49
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
replace double with bit shift #50
base: main
Are you sure you want to change the base?
Conversation
Codecov ReportBase: 66.15% // Head: 60.44% // Decreases project coverage by
Additional details and impacted files@@ Coverage Diff @@
## main #50 +/- ##
==========================================
- Coverage 66.15% 60.44% -5.72%
==========================================
Files 12 10 -2
Lines 1427 1221 -206
==========================================
- Hits 944 738 -206
Misses 483 483
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. ☔ View full report at Codecov. |
Hmm, this implementation does not appear to be more efficient. I ran:
once on current Current main.section ".text.<pasta_curves::fields::fp::Fp as ff::Field>::double","ax",@progbits
.globl <pasta_curves::fields::fp::Fp as ff::Field>::double
.p2align 4, 0x90
.type <pasta_curves::fields::fp::Fp as ff::Field>::double,@function
<pasta_curves::fields::fp::Fp as ff::Field>::double:
.cfi_startproc
mov rax, rdi
mov rdx, qword ptr [rsi]
mov r11, qword ptr [rsi + 8]
lea r10, [rdx + rdx]
mov r9, qword ptr [rsi + 16]
xor edi, edi
movabs r8, 7409212017489215487
add r8, r10
adc rdi, -1
shrd rdx, r11, 63
sar rdi, 63
add rdx, rdi
adc rdi, 0
movabs r10, -2469829653914515739
add r10, rdx
adc rdi, -1
shrd r11, r9, 63
sar rdi, 63
add r11, rdi
adc rdi, 0
mov rdx, qword ptr [rsi + 24]
sar rdi, 63
shld rdx, r9, 1
add rdx, rdi
adc rdi, 0
movabs r9, -4611686018427387904
add r9, rdx
adc rdi, -1
movabs rdx, -7409212017489215487
and rdx, rdi
movabs rsi, 2469829653914515739
and rsi, rdi
movabs rcx, 4611686018427387904
and rcx, rdi
add rdx, r8
adc rsi, r10
adc r11, 0
adc rcx, r9
mov qword ptr [rax], rdx
mov qword ptr [rax + 8], rsi
mov qword ptr [rax + 16], r11
mov qword ptr [rax + 24], rcx
ret
.size <pasta_curves::fields::fp::Fp as ff::Field>::double, .Lfunc_end50-<pasta_curves::fields::fp::Fp as ff::Field>::double Current main.section ".text.<pasta_curves::fields::fp::Fp as ff::Field>::double","ax",@progbits
.globl <pasta_curves::fields::fp::Fp as ff::Field>::double
.p2align 4, 0x90
.type <pasta_curves::fields::fp::Fp as ff::Field>::double,@function
<pasta_curves::fields::fp::Fp as ff::Field>::double:
.cfi_startproc
push rbx
.cfi_def_cfa_offset 16
.cfi_offset rbx, -16
mov rax, rdi
mov rdx, qword ptr [rsi]
mov rbx, qword ptr [rsi + 8]
mov rcx, rbx
shld rcx, rdx, 1
add rdx, rdx
mov r8, qword ptr [rsi + 16]
shrd rbx, r8, 63
mov r9, qword ptr [rsi + 24]
shld r9, r8, 1
xor esi, esi
movabs r8, 7409212017489215487
add r8, rdx
adc rsi, -1
sar rsi, 63
add rcx, rsi
adc rsi, 0
movabs r10, -2469829653914515739
add r10, rcx
adc rsi, -1
sar rsi, 63
add rbx, rsi
adc rsi, 0
sar rsi, 63
add r9, rsi
adc rsi, 0
movabs r11, -4611686018427387904
add r11, r9
adc rsi, -1
movabs rdx, -7409212017489215487
and rdx, rsi
movabs rcx, 2469829653914515739
and rcx, rsi
movabs rdi, 4611686018427387904
and rdi, rsi
add rdx, r8
adc rcx, r10
adc rbx, 0
adc rdi, r11
mov qword ptr [rax], rdx
mov qword ptr [rax + 8], rcx
mov qword ptr [rax + 16], rbx
mov qword ptr [rax + 24], rdi
pop rbx
.cfi_def_cfa_offset 8
ret
.size <pasta_curves::fields::fp::Fp as ff::Field>::double, .Lfunc_end50-<pasta_curves::fields::fp::Fp as ff::Field>::double It looks to me like |
Extracted from #44.