-
Notifications
You must be signed in to change notification settings - Fork 93
Try to add support code for riscv64 #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
base: master
Are you sure you want to change the base?
Conversation
|
Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). View this failed invocation of the CLA check for more information. For the most up to date status, view the checks section at the bottom of the pull request. |
|
Hi, @seranian, Could you please approve running the CI workflow? Thank you! |
seranian
left a comment
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.
Hi,
See my comments in the code.
multichase.c
Outdated
| args->x.genchase_args->arena, | ||
| args->x.genchase_args->arena + args->x.genchase_args->total_memory); | ||
| #endif | ||
| #if defined(__riscv) && __riscv_xlen == 64 |
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.
The code within this #define is exactly the same as for the ARM64 above. Why not merge the two?
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.
Yes,you are right. These codes merge together better. At that time, the main concern was that these codes might need additional adjustments for RISC-V in the future. The two codes have been merged according to your suggestion.
| #if defined(__aarch64__) | ||
| asm volatile ("stnp %0, %1, [%2]" :: "r"(b[i]+c[i]), "r"(b[i+1]+c[i+1]), "r" (a+i)); | ||
| #elif defined(__riscv) && __riscv_xlen == 64 | ||
| asm volatile ("sd %0, (%2)\n\t" |
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.
A comment would go a long way to describe what this inline asm is supposed to do.
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.
sd (Store Doubleword) is a risc-v memory store instruction that stores a 64-bit (8-byte) value from a register to memory. "sd %0, (%2)\n\t" stores 64-bit value from register %0 to memory address contained in register %2, "sd %1, 8(%2)" stores 64-bit value from register %1 to memory address [%2] + 8. @seranian comments have been added.
merge risc-v and arm code.
add comment about riscv asm code.
Add support code for riscv64, functionality tested and working on the Spacemit® X60 development board. Test logs are as follows.