[Bug target/124948] wrong code with wrapping __atomic_add_fetch() on _BitInt(17) on riscv
law at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Tue May 12 01:27:26 GMT 2026
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=124948
--- Comment #3 from Jeffrey A. Law <law at gcc dot gnu.org> ---
I get a completely different read on this situation. I don't see a problem the
amo sequence. What I see a problem is with the expansion of the load after hte
amoadd.
lui a5,%hi(b) # 9 [c=8 l=4] *movdi_64bit/1
lw a4,%lo(b)(a5) # 10 [c=32 l=8]
*extendsidi2_internal/1
li a5,16 # 11 [c=4 l=4] *movdi_64bit/1
beq a4,a5,.L2 # 12 [c=16 l=4] *branchdi
THe object is a 17 bit BitInt. We should have zero extended from bit 16 to bit
63 before the comparison against 16.
I'm not at all familiar with the bitint expansion paths. Where is that masking
supposed to show up? Presumably its at the gimple->rtl expansion, but what
code during expansion is supposed to handle that?
More information about the Gcc-bugs
mailing list