Skip to content
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

Optimize submul part of udivrem #263

Merged
merged 1 commit into from
Mar 14, 2022
Merged

Optimize submul part of udivrem #263

merged 1 commit into from
Mar 14, 2022

Conversation

chfast
Copy link
Owner

@chfast chfast commented Mar 14, 2022

Inline subc() in submul() and use borrow flag idiom
which is recognizable by GCC.

Inline subc() in submul() and use borrow flag idiom
which is recognizable by GCC.
@chfast
Copy link
Owner Author

chfast commented Mar 14, 2022

div<uint256, udivrem>/64                                      -0.0036         -0.0036            23            23            23            23                                                                                     
div<uint256, udivrem>/128                                     +0.0026         +0.0026            29            29            29            29                                                                                     
div<uint256, udivrem>/192                                     -0.0414         -0.0414            34            33            34            33                                                                                     
div<uint256, udivrem>/256                                     -0.0468         -0.0468            30            28            30            28                                                                                     
div<uint512, udivrem>/64                                      -0.0025         -0.0025            37            37            37            37                                                                                     
div<uint512, udivrem>/128                                     -0.0144         -0.0145            49            48            49            48                                                                                     
div<uint512, udivrem>/192                                     -0.0440         -0.0440            72            68            72            68                                                                                     
div<uint512, udivrem>/256                                     -0.0480         -0.0480            69            66            69            66                                                                                     
mod<addmod>/64                                                -0.0115         -0.0115            30            29            30            29                                                                                     
mod<addmod>/128                                               -0.0041         -0.0041            33            33            33            33                                                                                     
mod<addmod>/192                                               -0.0133         -0.0133            41            40            41            40                                                                                     
mod<addmod>/256                                               -0.0111         -0.0111            35            35            35            35                                                                                     
mod<addmod_public>/64                                         -0.0054         -0.0054            33            33            33            33                                                                                     
mod<addmod_public>/128                                        -0.0044         -0.0044            37            36            37            36                                                                                     
mod<addmod_public>/192                                        -0.0403         -0.0403            44            42            44            42                                                                                     
mod<addmod_public>/256                                        -0.0279         -0.0279            37            36            37            36                                                                                     
mod<addmod_simple>/64                                         +0.0046         +0.0046            32            32            32            32                                                                                     
mod<addmod_simple>/128                                        +0.0131         +0.0131            34            35            34            35                                                                                     
mod<addmod_simple>/192                                        -0.0250         -0.0250            41            40            41            40                                                                                     
mod<addmod_simple>/256                                        -0.0008         -0.0008            35            35            35            35                                                                                     
mod<addmod_prenormalize>/64                                   -0.0137         -0.0137            66            65            66            65                                                                                     
mod<addmod_prenormalize>/128                                  +0.0170         +0.0170            69            70            69            70                                                                                     
mod<addmod_prenormalize>/192                                  -0.0308         -0.0308            81            79            81            79                                                                                     
mod<addmod_prenormalize>/256                                  -0.0205         -0.0205            62            61            62            61                                                                                     
mod<addmod_daosvik>/64                                        -0.0034         -0.0034            33            32            33            32                                                                                     
mod<addmod_daosvik>/128                                       -0.0102         -0.0102            36            36            36            36                                                                                     
mod<addmod_daosvik>/192                                       -0.0448         -0.0448            43            41            43            41                                                                                     
mod<addmod_daosvik>/256                                       -0.0248         -0.0248            36            35            36            35                                                                                     
mod<mulmod>/64                                                +0.0123         +0.0123            49            49            49            49                                                                                     
mod<mulmod>/128                                               +0.0191         +0.0191            59            60            59            60                                                                                     
mod<mulmod>/192                                               -0.0710         -0.0710            85            79            85            79                                                                                     
mod<mulmod>/256                                               -0.0648         -0.0648            82            77            82            77                                                                                     
ecmod<addmod_public>                                          +0.0164         +0.0163            19            19            19            19                                                                                     
ecmod<addmod_simple>                                          -0.0050         -0.0050            26            26            26            26                                                                                     
ecmod<addmod_prenormalize>                                    -0.0016         -0.0016            10            10            10            10                                                                                     
ecmod<addmod_daosvik>                                         +0.0006         +0.0006            18            18            18            18                                                                                     
ecmod<mulmod>                                                 -0.0508         -0.0508            79            75            79            75                                                                                     

@codecov-commenter
Copy link

codecov-commenter commented Mar 14, 2022

Codecov Report

Merging #263 (791d1c5) into master (b05e8a1) will not change coverage.
The diff coverage is 100.00%.

@@            Coverage Diff            @@
##            master      #263   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           10        10           
  Lines         1911      1911           
=========================================
  Hits          1911      1911           
Flag Coverage Δ
32bit 100.00% <100.00%> (ø)
gcc 100.00% <100.00%> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
include/intx/intx.hpp 100.00% <100.00%> (ø)

@chfast chfast merged commit ce3f7a1 into master Mar 14, 2022
@chfast chfast deleted the submul branch March 14, 2022 21:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants