-
Notifications
You must be signed in to change notification settings - Fork 70
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
feat: Introduce new mops for version 2 #321
Conversation
This won't reduce many cycles, the benefit is really that AUIPC is historically treated as a basic block end instruction. By eliminating AUIPC, we can expect longer sequential trace that aids execution.
The fixed version is included in version 2, version 1 is left unchanged
The fixed code will be included in version 2.
The fixed code is included in version 2.
4485c70
to
e1b7276
Compare
e1b7276
to
3726605
Compare
ldr TEMP4, REGISTER_ADDRESS(RS2) | ||
subs TEMP3, TEMP3, TEMP4 | ||
adc TEMP1, TEMP1, TEMP1 | ||
eor TEMP1, TEMP1, 1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why xored TEMP1?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
arm64 uses different borrow logic in subtraction here: when a borrow happened, the carry bit is 0, otherwise the carry bit is 1. This is the opposite of what we want, hence the xor.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Understand, it is said to simplify chip design
https://stackoverflow.com/questions/53065579/confusion-about-arm-documentation-on-carry-flag
li a0, 1 | ||
li a7, 93 | ||
ecall | ||
1: | ||
li a0, 0 | ||
li a7, 93 | ||
ecall |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These lines are useless, please delete them.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
This change introduces 5 new mops for ckb-vm version 2. Those new mops all come from a direct observation of generated code from modern LLVM/GCC compilers. While they have less impact on secp256k1 contract(1183580 -> 1148321), they have more significant impact on complicated contracts. Using halo2 as an example: