[all-commits] [llvm/llvm-project] 71db60: [Mips] Respect FPU hazards on MIPS-I to MIPS-III (...
Christian Krause via All-commits
all-commits at lists.llvm.org
Wed Sep 23 08:36:52 PDT 2026
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: 71db60ced71917b09aaf117d900fadad4bb9e343
https://github.com/llvm/llvm-project/commit/71db60ced71917b09aaf117d900fadad4bb9e343
Author: Christian Krause <chris at christiankrause.de>
Date: 2026-09-23 (Wed, 23 Sep 2026)
Changed paths:
M llvm/lib/Target/Mips/MipsDelaySlotFiller.cpp
M llvm/lib/Target/Mips/MipsInstrInfo.cpp
A llvm/test/CodeGen/Mips/fpu-delay-in-delay-slot.ll
M llvm/test/CodeGen/Mips/llvm-ir/fptosi.ll
M llvm/test/CodeGen/Mips/llvm-ir/load.ll
M llvm/test/CodeGen/Mips/llvm-ir/select-dbl.ll
M llvm/test/CodeGen/Mips/llvm-ir/select-flt.ll
A llvm/test/CodeGen/Mips/mips1-fpu-load-delay.ll
Log Message:
-----------
[Mips] Respect FPU hazards on MIPS-I to MIPS-III (#223411)
On the oldest MIPS processors the hardware does not wait for a value
loaded from memory to arrive before it runs the next instruction: the
compiler has to leave a one-instruction gap itself. It already did this
for whole-number loads, but not for floating-point ones, so float code
could read the register a moment too early and quietly compute with a
stale value. This change makes the compiler treat floating-point loads
and moves off the math unit the same way it treats whole-number loads,
fixing that silent wrong answer. Newer chips are unaffected: they wait
on their own, and no gap is added for them.
GCC models both of these: [ISA_HAS_LOAD_DELAY and
ISA_HAS_XFER_DELAY](https://github.com/gcc-mirror/gcc/blob/5115c7e447fc07457443df874bf57840e8316d5f/gcc/config/mips/mips.h#L1322-L1334)
in mips.h, and the [hazard/can_delay
attributes](https://github.com/gcc-mirror/gcc/blob/5115c7e447fc07457443df874bf57840e8316d5f/gcc/config/mips/mips.md#L756-L789).
I used Opus 5 (Anthropic) as an assistant while preparing this patch. I
did the investigation and diagnosis myself, reviewed and tested every
change, and verified the GCC source references above against the actual
GCC source before linking them.
To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications
More information about the All-commits
mailing list