-
Notifications
You must be signed in to change notification settings - Fork 26
microblaze: Fix -Os right shift optimization is allowed into delay slot #37
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
Conversation
39eb6ac to
0e3007a
Compare
|
Fix seems to have worked, new disassembly as below:
After the jump
CC @keith-packard you can grab a copy of the toolchain from https://github.com/zephyrproject-rtos/sdk-ng/actions/runs/11407925329?pr=647 if it's of any interest. p.s. new disassembly again but compared to: |
0e3007a to
815ae62
Compare
815ae62 to
e60c96c
Compare
During picolibc testing, it's found that `-Os` produces assembly code that compiler squeezes into a single delay slot. Thus, only the first instruction (the one in delay slot) emitted by this optimization is executed and the rest is skipped. Signed-off-by: Alp Sayin <[email protected]>
e60c96c to
7a5d3b9
Compare
|
This needs to be opened against |
|
Outdated, closing. Will re-open against |
During picolibc testing, it's found that `-Os` produces assembly code that compiler squeezes into a single delay slot. Thus, only the first instruction (the one in delay slot) emitted by this optimization is executed and the rest is skipped. This is a regression introduced by applying Microblaze gcc patches zephyrproject-rtos#24. This patch is a 14.3.0 equivalent of zephyrproject-rtos#37. Signed-off-by: Alp Sayin <[email protected]>
During picolibc testing, it's found that
-Osproduces assembly code that compilersqueezes into a single delay slot. Thus, only the first instruction emitted by this optimization is run and the rest is skipped.
Optimization is generated by
But
arithtype is NOT disallowed from going into delay slot (see below):gcc/gcc/config/microblaze/microblaze.md
Line 466 in 428d8d7
"Optimized" code is between [191b8-191c8]
where
operandsare:As a result, this code returns a
iy(r24) value of (whatever was in r24) - 1023`The fix is simple. I've redeclared this size-optimization as
multiwhich isgcc/gcc/config/microblaze/microblaze.md
Line 2070 in 428d8d7
gcc/gcc/config/microblaze/microblaze.md
Line 2483 in 428d8d7
For context, non-size-optimized code is
Ncopies of:And as per the above optimization rule, if
N <= 5we'll still get 5 copies ofsrainstruction.Currently under test via zephyrproject-rtos/sdk-ng#647