-
Notifications
You must be signed in to change notification settings - Fork 15
float 32 to s32 conversion optimisation #243
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: develop
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I see you removed s4, but s5 is still used, and both of them are saved to stack. Could you use s4 instead of s5 and only save s4 to stack? This is not gonna give us any cycles but will be a bit cleaner |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -26,52 +26,39 @@ | |
| #define len a2 | ||
| #define b_exp a3 | ||
|
|
||
| #define _0 s2 | ||
| #define tmp1 s3 | ||
| #define tmp0 s4 | ||
| #define tmp1 s2 | ||
| #define tmp0 s3 | ||
|
|
||
| #define _0 x28 | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Could you change it to t3 as it's more idiomatic, please? |
||
|
|
||
| .p2align 4 | ||
| FUNC_NAME: | ||
| xm.entsp (NSTACKWORDS)*4 | ||
| { xm.entsp (NSTACKWORDS)*4 ; li _0, 0 } | ||
| xm.stdsp s3,s2,0 | ||
| { li _0, 0 ; li s3, 23 } | ||
| { add b_exp, b_exp, s3 ; nop } | ||
| sw s4, 8(sp) | ||
| xm.subi b_exp, b_exp, 9 | ||
|
|
||
| // handle tail first | ||
| { srli t3, len, 1 ; xm.zexti len, 1 } | ||
| { mv len, t3 ; xm.brff len, .L_pre_loop } | ||
| { srli tmp0, len, 1 ; xm.zexti len, 1 } | ||
| { mv len, tmp0 ; xm.brff len, .L_pre_loop } | ||
|
|
||
| xm.ldd tmp0,tmp1, len(b) | ||
| { xm.slt t3, tmp0, _0 ; slli tmp1, len, 1 } | ||
| beqz t3, .L_posT | ||
| xm.neg tmp0, tmp0 | ||
| .L_posT: | ||
| xm.fmake tmp0, t3, b_exp, _0, tmp0 | ||
| slli tmp1, len, 1 | ||
| xm.fmakes tmp0, b_exp, tmp0, _0 | ||
| xm.stw tmp0,tmp1( a) | ||
|
|
||
| .L_pre_loop: | ||
|
|
||
| { addi len, len, -1 ; xm.brff len, .L_loop_end } | ||
|
|
||
| .L_loop: | ||
| xm.ldd tmp0,tmp1, len(b) | ||
| { xm.slt t3, tmp1, _0 ; nop } | ||
| beqz t3, .L_pos1 | ||
| xm.neg tmp1, tmp1 | ||
| .L_pos1: | ||
| xm.fmake tmp1, t3, b_exp, _0, tmp1 | ||
| slt t3, tmp0, _0 | ||
| beqz t3, .L_pos0 | ||
| xm.neg tmp0, tmp0 | ||
| .L_pos0: | ||
| xm.fmake tmp0, t3, b_exp, _0, tmp0 | ||
| xm.ldd tmp0,tmp1, len(b) | ||
| xm.fmakes tmp1, b_exp, tmp1, _0 | ||
| xm.fmakes tmp0, b_exp, tmp0, _0 | ||
| xm.std tmp0,tmp1, len(a) | ||
| { addi len, len, -1 ; xm.bt len, .L_loop } | ||
| .L_loop_end: | ||
|
|
||
| xm.lddsp s3,s2,0 | ||
| lw s4, 8(sp) | ||
| xm.retsp (NSTACKWORDS)*4 | ||
|
|
||
|
|
||
|
|
||
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.
Now that xm.entsp is gone, I would remove NSTACKWORDS altogether, so it's not modifiable anymore