<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/149295>149295</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
NaN-related regressions on hard float MIPS in LLVM 21
</td>
</tr>
<tr>
<th>Labels</th>
<td>
backend:MIPS,
regression
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
alexrp
</td>
</tr>
</table>
<pre>
In Zig, we're seeing these test failures on all hard float MIPS targets with LLVM 21:
```
test-std
└─ run test std-mips-linux-gnueabihf-mips32r2-Debug-libc 2834/2926 passed, 5 failed, 87 skipped
error: 'fmt.test.float.special' failed: ====== expected this output: =========
f64: -nan␃
======== instead found this: =========
f64: nan␃
======================================
First difference occurs on line 1:
expected:
f64: -nan
^ ('\x2d')
found:
f64: nan
^ ('\x6e')
/home/alexrp/Source/ziglang/zig-llvm21/lib/std/testing.zig:672:9: 0xcbd977 in expectEqualStrings (test)
return error.TestExpectedEqual;
^
/home/alexrp/Source/ziglang/zig-llvm21/lib/std/testing.zig:279:5: 0x15b609f in expectFmt__anon_206405 (test)
return expectEqualStrings(expected, actual);
^
/home/alexrp/Source/ziglang/zig-llvm21/lib/std/fmt.zig:1001:9: 0x15b712f in test.float.special (test)
try expectFmt("f64: -nan", "f64: {}", .{-math.nan(f64)});
^
error: 'fmt.test.float.hexadecimal.special' failed: ====== expected this output: =========
f64: -nan␃
======== instead found this: =========
f64: nan␃
======================================
First difference occurs on line 1:
expected:
f64: -nan
^ ('\x2d')
found:
f64: nan
^ ('\x6e')
/home/alexrp/Source/ziglang/zig-llvm21/lib/std/testing.zig:672:9: 0xcbd977 in expectEqualStrings (test)
return error.TestExpectedEqual;
^
/home/alexrp/Source/ziglang/zig-llvm21/lib/std/testing.zig:279:5: 0x15b800f in expectFmt__anon_206508 (test)
return expectEqualStrings(expected, actual);
^
/home/alexrp/Source/ziglang/zig-llvm21/lib/std/fmt.zig:1012:9: 0x15b9bff in test.float.hexadecimal.special (test)
try expectFmt("f64: -nan", "f64: {x}", .{-math.nan(f64)});
^
error: 'math.isnan.decltest.isSignalNan' failed: /home/alexrp/Source/ziglang/zig-llvm21/lib/std/testing.zig:606:14: 0xcc1713 in expect (test)
if (!ok) return error.TestUnexpectedResult;
^
/home/alexrp/Source/ziglang/zig-llvm21/lib/std/math/isnan.zig:43:9: 0x19f119f in decltest.isSignalNan (test)
try expect(!isSignalNan(math.nan(T)));
^
error: 'math.copysign.decltest.copysign' failed: /home/alexrp/Source/ziglang/zig-llvm21/lib/std/testing.zig:606:14: 0xcc1713 in expect (test)
if (!ok) return error.TestUnexpectedResult;
^
/home/alexrp/Source/ziglang/zig-llvm21/lib/std/math/copysign.zig:23:9: 0x1a0985f in decltest.copysign (test)
try expect(copysign(@as(T, 6.0), -math.nan(T)) == -6.0);
^
error: 'math.signbit.decltest.signbit' failed: /home/alexrp/Source/ziglang/zig-llvm21/lib/std/testing.zig:606:14: 0xcc1713 in expect (test)
if (!ok) return error.TestUnexpectedResult;
^
/home/alexrp/Source/ziglang/zig-llvm21/lib/std/math/signbit.zig:49:5: 0x1a34153 in testFloats__anon_341654 (test)
try expect(signbit(-math.nan(Type)));
^
/home/alexrp/Source/ziglang/zig-llvm21/lib/std/math/signbit.zig:27:5: 0x1a364df in decltest.signbit (test)
try testFloats(f32);
^
```
I'll attempt to reduce these failures soon; just filing the issue in advance.
</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJzsWE9vpLgT_TTuiwUyBbTh0IfOH6RIM6PRL_Pbw15GBgraM27D2iaTzKdfGejQPd3ZzSEj7SHIUohTRdWr91x2LKyVrUbckPSKpDcrMbhdZzZC4aPpV2VXP23uNP1TtgSu6Q8kwA1Siyh1S90OLVKH1tFGSDUYtLTTVChFd8LUtFGdcPTj3ed76oRp0Vn6Q7od_fDhj48UIhJvCRvHms2Dbf3XAutqP30LJE_8mF4yRs2gp3jW1cFe9jZQUg-PQasHFKXcNeNkD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