re PR target/88521 (GCC from r266355 miscompiles x265 for mingw-w64 target)
authorMateusz B <mateuszb@poczta.onet.pl>
Mon, 7 Jan 2019 07:31:19 +0000 (08:31 +0100)
committerMartin Liska <marxin@gcc.gnu.org>
Mon, 7 Jan 2019 07:31:19 +0000 (07:31 +0000)
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
gcc/config/i386/i386.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.target/i386/pr88521.c [new file with mode: 0644]

index 1741b7e..9a01516 100644 (file)
@@ -1,3 +1,9 @@
+2018-12-26  Mateusz B  <mateuszb@poczta.onet.pl>
+
+       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  <hubicka@ucw.cz>
 
        PR tree-opt/86020
index 5cf876a..d01278d 100644 (file)
@@ -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;
         }
index fcbbd74..c0bb281 100644 (file)
@@ -1,3 +1,8 @@
+2018-12-26  Mateusz B  <mateuszb@poczta.onet.pl>
+
+       PR target/88521
+       * gcc.target/i386/pr88521.c: New testcase.
+
 2019-01-06  Thomas Koenig  <tkoenig@gcc.gnu.org>
 
        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 (file)
index 0000000..f42703a
--- /dev/null
@@ -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;
+}