From 4075fc70242c293fa46eef78af924ed5cc3f6647 Mon Sep 17 00:00:00 2001 From: Mateusz B Date: Mon, 7 Jan 2019 08:31:19 +0100 Subject: [PATCH] re PR target/88521 (GCC from r266355 miscompiles x265 for mingw-w64 target) PR target/88521 * config/i386/i386.c (function_value_ms_64): Return small sturct in AX_REG and float/double in FIRST_SSE_REG for 4 or 8 byte modes. From-SVN: r267622 --- gcc/ChangeLog | 6 +++++ gcc/config/i386/i386.c | 7 ++++++ gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/gcc.target/i386/pr88521.c | 30 +++++++++++++++++++++++++ 4 files changed, 48 insertions(+) create mode 100644 gcc/testsuite/gcc.target/i386/pr88521.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 1741b7ef6ce..9a0151684f5 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2018-12-26 Mateusz B + + PR target/88521 + * config/i386/i386.c (function_value_ms_64): Return small sturct in + AX_REG and float/double in FIRST_SSE_REG for 4 or 8 byte modes. + 2019-01-05 Jan Hubicka PR tree-opt/86020 diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c index 5cf876a16a7..d01278d866f 100644 --- a/gcc/config/i386/i386.c +++ b/gcc/config/i386/i386.c @@ -9063,6 +9063,13 @@ function_value_ms_64 (machine_mode orig_mode, machine_mode mode, && !COMPLEX_MODE_P (mode)) regno = FIRST_SSE_REG; break; + case 8: + case 4: + if (valtype != NULL_TREE && AGGREGATE_TYPE_P (valtype)) + break; + if (mode == SFmode || mode == DFmode) + regno = FIRST_SSE_REG; + break; default: break; } diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index fcbbd7432ae..c0bb2817873 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2018-12-26 Mateusz B + + PR target/88521 + * gcc.target/i386/pr88521.c: New testcase. + 2019-01-06 Thomas Koenig PR fortran/88658 diff --git a/gcc/testsuite/gcc.target/i386/pr88521.c b/gcc/testsuite/gcc.target/i386/pr88521.c new file mode 100644 index 00000000000..f42703add64 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/pr88521.c @@ -0,0 +1,30 @@ +/* { dg-do compile { target lp64 } } */ +/* { dg-options "-O2" } */ +/* { dg-final { scan-assembler-times "movl\[^\n\r]*, %eax|mov\[ \t]*eax," 1 } } */ +/* { dg-final { scan-assembler-times "movss\[^\n\r]*, %xmm" 1 } } */ +/* { dg-final { scan-assembler-times "movsd\[^\n\r]*, %xmm" 1 } } */ +typedef struct +{ + float x; +} Float; + +Float __attribute__((ms_abi)) fn1() +{ + Float v; + v.x = 3.145F; + return v; +} + +float __attribute__((ms_abi)) fn2 () +{ + float v; + v = 3.145F; + return v; +} + +double __attribute__((ms_abi)) fn3 () +{ + double v; + v = 3.145; + return v; +} -- 2.30.2