public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Lokesh Janghel <lokeshjanghel91@gmail.com>
To: JonY <10walls@gmail.com>
Cc: Uros Bizjak <ubizjak@gmail.com>, Jakub Jelinek <jakub@redhat.com>,
	mateuszb@poczta.onet.pl,
		"gcc-patches@gcc.gnu.org" <gcc-patches@gcc.gnu.org>
Subject: Re: [Patch] Bug 88521 - gcc 9.0 from r266355 miscompile x265 for mingw-w64 target
Date: Wed, 26 Dec 2018 16:19:00 -0000	[thread overview]
Message-ID: <CACcU4_qAPCjELr-KTAiR3gZVa96zy5mQf_CUcCRvX1Umcr4Xwg@mail.gmail.com> (raw)
In-Reply-To: <378e40d9-01d3-0d28-f6d3-c982b0cd47d3@gmail.com>

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

Hi,

Here is the patch for the issue.
Please let me know your thoughts.

On Fri, Dec 21, 2018 at 3:16 PM JonY <10walls@gmail.com> wrote:
>
> On 12/21/18 9:08 AM, Uros Bizjak wrote:
> > On Thu, Dec 20, 2018 at 1:09 PM Jakub Jelinek <jakub@redhat.com> wrote:
> >>
> >> On Thu, Dec 20, 2018 at 01:42:15PM +0530, Lokesh Janghel wrote:
> >>> 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.
> >>
> >> ChangeLog entry is missing, please write it (and mention there
> >> Mateusz's name/mail as he wrote the i386.c part).
> >>
>
> Patch looks good to me, but please add a ChangeLog.
>
>


-- 
Thanks & Regards
Lokesh Janghel
+91-9752984749

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

diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 12e8f05..21067f3 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -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.
+
 2018-12-19  Bin Cheng  <bin.cheng@linux.alibaba.com>
 
 	* auto-profile.c (afdo_indirect_call): Skip generating histogram
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/ChangeLog b/gcc/testsuite/ChangeLog
index 188b6c5..f4b3400 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2018-12-26  Mateusz B  <mateuszb@poczta.onet.pl>
+
+	PR target/88521
+	* gcc.target/i386/pr88521.c: New testcase.
+
 2018-12-18  Jakub Jelinek  <jakub@redhat.com>
 
 	PR rtl-optimization/87759
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-26 13:10 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-12-20  8:12 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 [this message]
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_qAPCjELr-KTAiR3gZVa96zy5mQf_CUcCRvX1Umcr4Xwg@mail.gmail.com \
    --to=lokeshjanghel91@gmail.com \
    --cc=10walls@gmail.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=jakub@redhat.com \
    --cc=mateuszb@poczta.onet.pl \
    --cc=ubizjak@gmail.com \
    /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).