-
Notifications
You must be signed in to change notification settings - Fork 332
igzip/riscv64: Add adler32_rvv optimization for VLEN=128 #374
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
|
@sunyuechi can you review this? Thanks! |
| addi sp, sp, -32 | ||
| sd ra, 24(sp) | ||
| sd s1, 16(sp) | ||
| sd s2, 8(sp) |
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.
You can use the unused registers to reduce stack operations (at least a7, t5)
| slli s1, a0, 48 | ||
| srli s1, s1, 48 // s1: A = adler32 & 0xffff | ||
| srliw s2, a0, 16 // s2: B = adler32 >> 16 | ||
| add s3, a1, a2 // s3 = end |
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.
s3 unused?
| la a7, factors | ||
| vle8.v v0, (a7) | ||
| vmv.v.i v4, 0 | ||
| vmv.v.i v8, 0 |
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.
v4 hasn’t been modified, so you can just use v4.
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, thanks for the review!
| mv t2, t1 | ||
| 1: | ||
| mv a3, t5 | ||
| mv a4, t6 |
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.
t5, t6 -> a3, a4
update a3, a4
a3, a4 -> t5, t6
It doesn’t seem to be needed here — is it fine to just update t5 and t6 directly?
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, thanks for the review!
787635b to
7ed6de8
Compare
| mul a3, t6, t3 | ||
| srli a3, a3, 47 | ||
| mul a4, a3, t4 | ||
| sub t6, t6, a4 |
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.
You can directly copy the same 8 lines with the logic above. Not changing the temporary registers makes it a bit clearer. Then combine these commits into one, and it should be ready to be merged.
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, thanks for the review!
Signed-off-by: WenLei <lei.wen2@zte.com.cn>
7ed6de8 to
efb9e33
Compare
|
@sunyuechi is this OK to merge now? |
|
@pablodelara ok |
|
Could this PR be merged, or is there anything else I need to change? Thanks! |
This PR introduces an optimized adler32_rvv implementation for vlen=128.
The optimization has been verified on the SG2044 platform: