public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [Patch] Bug 88521 - gcc 9.0 from r266355 miscompile x265 for mingw-w64 target
@ 2018-12-20  8:12 Lokesh Janghel
  2018-12-20  8:31 ` Mateusz
  2018-12-20 12:16 ` Jakub Jelinek
  0 siblings, 2 replies; 9+ messages in thread
From: Lokesh Janghel @ 2018-12-20  8:12 UTC (permalink / raw)
  To: mateuszb; +Cc: gcc-patches

[-- Attachment #1: Type: text/plain, Size: 177 bytes --]

Hi Mateuszb,

I tested with your proposition patch and it is working right.
I also added the patch with test case.
Please let me know your thoughts/suggestions.


Thanks
Lokesh

[-- Attachment #2: 88521.patch --]
[-- Type: application/octet-stream, Size: 1335 bytes --]

diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c
index b3c8676..e54c489 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/gcc.target/i386/pr88521.c b/gcc/testsuite/gcc.target/i386/pr88521.c
new file mode 100644
index 0000000..f42703a
--- /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;
+}

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2019-01-07  7:31 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-12-20  8:12 [Patch] Bug 88521 - gcc 9.0 from r266355 miscompile x265 for mingw-w64 target Lokesh Janghel
2018-12-20  8:31 ` Mateusz
2018-12-20 12:16 ` Jakub Jelinek
2018-12-21  9:14   ` Uros Bizjak
2018-12-21  9:15     ` Jakub Jelinek
2018-12-21 10:05     ` JonY
2018-12-26 16:19       ` Lokesh Janghel
2018-12-29  2:34         ` JonY
2019-01-07  7:31           ` Martin Liška

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).