-
Notifications
You must be signed in to change notification settings - Fork 0
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
strcmp optimization for riscv #20
Conversation
newlib/libc/machine/riscv/strcmp.S
Outdated
@@ -46,12 +46,14 @@ strcmp: | |||
.macro check_one_word i n | |||
REG_L a2, \i*SZREG(a0) | |||
REG_L a3, \i*SZREG(a1) | |||
|
|||
#ifdef __riscv_zbb | |||
orc.b t2, t0 |
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.
Reading the adjacent code, it seems like this should be
orc.b t0, a2
that is, t0 should contain 0xff in each non-zero byte of a2.
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.
Edited on the same commit
I also hacked up one of the CI configurations to enable Zbb for testing:
|
It also looks like the mask value stored in 'a5' is not needed any more, so we can remove initializing that register and the related 'mask' value at the bottom of the file. |
ef3347f
to
09c010f
Compare
Check the current change, I moved the value assigned to |
528915c
to
6a7ca3d
Compare
These functions make it easier to call the semihosting functions without having to declare a local struct in each caller. Since there is only one call with 4 indirect parameters, I did not add a sys_semihost4 wrapper.
18d3e29
to
c415d89
Compare
c415d89
to
23892e4
Compare
I updated your last commit to add |
Optimize strcmp by calling orc.b (OR-Combine) instruction when Zbb extension is supported instead of 4 instructions to detect if zero byte is exist in word Signed-off-by: Mohamed Moawad <moawad@synopsys.com>
Enable zbb extension in CI for RISC-V to test optimizations using bit manipulation instructions like `orc.b`. This ensures that the strcmp optimization and other features using zbb are tested and validated Signed-off-by: Mohamed Moawad <moawad@synopsys.com>
23892e4
to
61560a1
Compare
Optimize strcmp by calling orc.b (OR-Combine) instruction when Zbb extension is supported instead of 4 instructions to detect if zero byte is exist in word