https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70989
Oleg Endo <olegendo at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Last reconfirmed| |2024-10-11
Status|UNCONFIRMED |NEW
Ever confirmed|0 |1
--- Comment #3 from Oleg Endo <olegendo at gcc dot gnu.org> ---
Conditional shifts could be useful, too ...
void bleh (bool val)
{
*(volatile unsigned int*)12300 = 1 << (12 + (1u-val) * 16u);
}
currently compiles to:
extu.b r4,r0
mov.w .L9,r2
shll2 r0
shll2 r0
xor #16,r0
add #12,r0
mov #1,r1
shld r0,r1
mov.l r1,@r2
rts
nop
.L9:
.short 12300
possible ideal output:
mov.w .L9,r2
mov.w .L10,r0 // r0 = 1 << 12
tst r4,r4 // T = val == 0
bt 0f
shll16 r0
0:
mov.l r0,@r2