public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Lokesh Janghel <lokeshjanghel91@gmail.com>
To: mateuszb@poczta.onet.pl
Cc: gcc-patches@gcc.gnu.org
Subject: [Patch] Bug 88521 - gcc 9.0 from r266355 miscompile x265 for mingw-w64 target
Date: Thu, 20 Dec 2018 08:12:00 -0000	[thread overview]
Message-ID: <CACcU4_o8SaP=NyDG4oVcS+-MJPx_MPmJfypNNdqJpdo_2+gTGg@mail.gmail.com> (raw)

[-- 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;
+}

             reply	other threads:[~2018-12-20  8:12 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-12-20  8:12 Lokesh Janghel [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CACcU4_o8SaP=NyDG4oVcS+-MJPx_MPmJfypNNdqJpdo_2+gTGg@mail.gmail.com' \
    --to=lokeshjanghel91@gmail.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=mateuszb@poczta.onet.pl \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).