llvm / llvm-project

The LLVM Project is a collection of modular and reusable compiler and toolchain technologies.
http://llvm.org
Other
29.44k stars 12.16k forks source link

APFloat incorrectly generates signaling NaNs on MIPS #60796

Open Muon opened 1 year ago

Muon commented 1 year ago

The signaling bit convention on MIPS is opposite that of x86 and ARM, but APFloat doesn't know that. As a result, constant folding to a NaN erroneously produces a signaling NaN instead of a quiet NaN on MIPS: https://godbolt.org/z/TP5hePhWP

llvmbot commented 1 year ago

@llvm/issue-subscribers-backend-mips

RalfJung commented 1 year ago

The signaling bit convention on MIPS

From what I understand, this is true for some MIPS chips, but other more recent chips actually make this runtime-configurable. For those chips it is impossible to know at compiletime which NaN needs to be produced to get a quiet NaN, isn't it?

wzssyqa commented 1 year ago

For MIPSr2/r3/r5, we have an option -mnan=2008/legacy to swtich it. For r6, 2008 is required.