From 4844729e936516ad583d641df48f02e2d01ac33a Mon Sep 17 00:00:00 2001 From: Simon Scherer Date: Wed, 5 Aug 2026 13:13:04 +0200 Subject: [PATCH] unittests/ASM: Test lossy precision non-SVE path in Vector_F64ToI32 --- .../ASM/FEX_bugs/f64_to_i32_precision.asm | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 unittests/ASM/FEX_bugs/f64_to_i32_precision.asm diff --git a/unittests/ASM/FEX_bugs/f64_to_i32_precision.asm b/unittests/ASM/FEX_bugs/f64_to_i32_precision.asm new file mode 100644 index 000000000..b70e1b4b9 --- /dev/null +++ b/unittests/ASM/FEX_bugs/f64_to_i32_precision.asm @@ -0,0 +1,21 @@ +%ifdef CONFIG +{ + "HostFeatures": ["AVX"], + "Env": { "FEX_HOSTFEATURES": "disablesve,disablefrintts" }, + "RegData": { + "XMM0": ["0x297e3ce700000000", "0x0000000000000000", "0x0000000000000000", "0x0000000000000000"] + } +} +%endif + +; The non-SVE path in Vector_F64ToI32 (JIT/ConversionOps.cpp) had a precision issue: +; Used to narrow the 64-bit float down to a 32-bit float before +; converting to an integer, rather than converting directly to a 64-bit integer and +; narrowing that to a 32-bit float. +lea rdx, [rel .data] +vcvttpd2dq xmm0, oword [rdx] +hlt + +align 16 +.data: +dq 0x8d482dd627d581f1, 0x41c4bf1e7380f30a