From ad1812f90aa26c0ead768ab1ed32287fb9dccd67 Mon Sep 17 00:00:00 2001 From: Pierre Muller Date: Sun, 11 Jun 2023 15:56:54 +0100 Subject: [PATCH] Handle the specific NaN pattern of mips floating-point unit --- compiler/wasm32/agllvmmc.pas | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/compiler/wasm32/agllvmmc.pas b/compiler/wasm32/agllvmmc.pas index ec19678610..0612fb8420 100644 --- a/compiler/wasm32/agllvmmc.pas +++ b/compiler/wasm32/agllvmmc.pas @@ -241,7 +241,14 @@ implementation else begin result:=result+'nan'; +{$ifndef CPUMIPS} if fraction<>(int64(1) shl (fraction_bits-1)) then +{$else CPUMIPS} + { Legacy mips fpu has a different representation of 'standard' nan } + { Signalling bit is clear to signify non-signalling } + { Standard non-signalling NaN thus has all other bits set } + if fraction<>((int64(1) shl (fraction_bits-1))-1) then +{$endif CPUMIPS} result:=result+'(0x'+HexStr(fraction,fraction_hexdigits)+')'; end; end