Skip to content

Conversation

@pengjunjie2100
Copy link

Add support code for riscv64, functionality tested and working on the Spacemit® X60 development board. Test logs are as follows.

image image image image image image

@google-cla
Copy link

google-cla bot commented Jul 15, 2025

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.

@pengjunjie2100
Copy link
Author

Hi, @seranian, Could you please approve running the CI workflow? Thank you!

Copy link
Collaborator

@seranian seranian left a 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
Copy link
Collaborator

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?

Copy link
Author

@pengjunjie2100 pengjunjie2100 Aug 26, 2025

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"
Copy link
Collaborator

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.

Copy link
Author

@pengjunjie2100 pengjunjie2100 Aug 26, 2025

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.
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