replace double with bit shift - #50
Open
str4d wants to merge 1 commit into
Open
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #50 +/- ##
==========================================
- Coverage 66.10% 60.44% -5.67%
==========================================
Files 12 10 -2
Lines 1428 1221 -207
==========================================
- Hits 944 738 -206
+ Misses 484 483 -1 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Contributor
Author
|
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>::doubleCurrent 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>::doubleIt looks to me like |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Extracted from #44.