From 8f5764ecbf56955515573e833b50d071380eb123 Mon Sep 17 00:00:00 2001 From: Walter Bright Date: Wed, 18 Oct 2023 23:29:42 -0700 Subject: [PATCH] fix Issue 24181 - reading double parameter from RCX rather than XMM1 (#15707) --- compiler/src/dmd/backend/cod1.d | 2 +- compiler/test/runnable/test24181.c | 15 +++++++++++++++ 2 files changed, 16 insertions(+), 1 deletion(-) create mode 100644 compiler/test/runnable/test24181.c diff --git a/compiler/src/dmd/backend/cod1.d b/compiler/src/dmd/backend/cod1.d index 4ae52f0ebc..f4306631f8 100644 --- a/compiler/src/dmd/backend/cod1.d +++ b/compiler/src/dmd/backend/cod1.d @@ -1402,7 +1402,7 @@ void getlvalue(ref CodeBuilder cdb,code *pcs,elem *e,regm_t keepmsk) if (preg != NOREG && regcon.params & mask(preg)) { //printf("sz %d, preg %s, Voffset %d\n", cast(int)sz, regm_str(mask(preg)), cast(int)voffset); - if (mask(preg) & XMMREGS && sz != REGSIZE) + if (mask(preg) & XMMREGS) { /* The following fails with this from std.math on Linux64: void main() diff --git a/compiler/test/runnable/test24181.c b/compiler/test/runnable/test24181.c new file mode 100644 index 0000000000..e2b28a66ab --- /dev/null +++ b/compiler/test/runnable/test24181.c @@ -0,0 +1,15 @@ +// https://issues.dlang.org/show_bug.cgi?id=24181 + +#include + +unsigned equ(double x, double y) +{ + return *(long long *)&x == *(long long *)&y; +} + +int main() +{ + assert(equ(1.0, 2.0) == 0); + assert(equ(527, 527) != 0); + return 0; +}