llvm-project
3f679c2a - [Mips] Fix the MIPS I %lo offset fold for loads and stores (#245716)

Commit
1 day ago
[Mips] Fix the MIPS I %lo offset fold for loads and stores (#245716) On MIPS I a double is loaded or stored with two lwc1 or swc1, and selectAddrFrameIndexOffset() folds the %lo of the address into both. That fold had three bugs: - For a constant pool entry it dropped the %lo but kept the offset, so the second half of an f64 constant was loaded from %hi(sym) + 4. - For a global it always used %lo, so a $gp relative address got %lo(sym+4)($gp) instead of %gp_rel(sym+4)($gp). - Inline asm memory operands could get a symbolic offset, which hit an assertion in MipsAsmPrinter::PrintAsmMemoryOperand(). Fold the offset into the constant pool entry or global with its own relocation, only when the offset is within the alignment of the symbol, so %hi(sym) is also %hi(sym+offset), as GCC does. Do not fold jump tables, and only accept an immediate offset for inline asm memory operands. Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Author
Parents
Loading