public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
From: Jakub Jelinek <jakub@gcc.gnu.org>
To: gcc-cvs@gcc.gnu.org
Subject: [gcc r11-9721] rs6000: Use rs6000_emit_move in movmisalign<mode> expander [PR104681]
Date: Tue, 29 Mar 2022 05:53:32 +0000 (GMT)	[thread overview]
Message-ID: <20220329055332.1E114385E830@sourceware.org> (raw)

https://gcc.gnu.org/g:b59d29392774b115bea0066b4ad1eb2b959a3a2b

commit r11-9721-gb59d29392774b115bea0066b4ad1eb2b959a3a2b
Author: Jakub Jelinek <jakub@redhat.com>
Date:   Fri Feb 25 18:58:48 2022 +0100

    rs6000: Use rs6000_emit_move in movmisalign<mode> expander [PR104681]
    
    The following testcase ICEs, because for some strange reason it decides to use
    movmisaligntf during expansion where the destination is MEM and source is
    CONST_DOUBLE.  For normal mov<mode> expanders the rs6000 backend uses
    rs6000_emit_move to ensure that if one operand is a MEM, the other is a REG
    and a few other things, but for movmisalign<mode> nothing enforced this.
    The middle-end documents that movmisalign<mode> shouldn't fail, so we can't
    force that through predicates or condition on the expander.
    
    2022-02-25  Jakub Jelinek  <jakub@redhat.com>
    
            PR target/104681
            * config/rs6000/vector.md (movmisalign<mode>): Use rs6000_emit_move.
    
            * g++.dg/opt/pr104681.C: New test.
    
    (cherry picked from commit 3885a122f817a1b6dca4a84ba9e020d5ab2060af)

Diff:
---
 gcc/config/rs6000/vector.md         |  5 ++++-
 gcc/testsuite/g++.dg/opt/pr104681.C | 19 +++++++++++++++++++
 2 files changed, 23 insertions(+), 1 deletion(-)

diff --git a/gcc/config/rs6000/vector.md b/gcc/config/rs6000/vector.md
index 7e36c788b97..20b8ba1666f 100644
--- a/gcc/config/rs6000/vector.md
+++ b/gcc/config/rs6000/vector.md
@@ -1521,7 +1521,10 @@
  [(set (match_operand:VEC_N 0 "nonimmediate_operand")
        (match_operand:VEC_N 1 "any_operand"))]
  "VECTOR_MEM_VSX_P (<MODE>mode) && TARGET_ALLOW_MOVMISALIGN"
- "")
+{
+  rs6000_emit_move (operands[0], operands[1], <MODE>mode);
+  DONE;
+})
 
 ;; Vector shift right in bits. Currently supported ony for shift
 ;; amounts that can be expressed as byte shifts (divisible by 8).
diff --git a/gcc/testsuite/g++.dg/opt/pr104681.C b/gcc/testsuite/g++.dg/opt/pr104681.C
new file mode 100644
index 00000000000..ea54940e7a3
--- /dev/null
+++ b/gcc/testsuite/g++.dg/opt/pr104681.C
@@ -0,0 +1,19 @@
+// PR target/104681
+// { dg-do compile }
+// { dg-options "-O2" }
+
+void bar ();
+struct A {
+  A (bool) : a(7.0L), b(0) {}
+  long double a;
+  long b;
+};
+struct B {
+  void foo () { c = bar; }
+  A c;
+};
+struct C {
+  void baz ();
+  B d;
+};
+void C::baz () { d.foo (); }


                 reply	other threads:[~2022-03-29  5:53 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20220329055332.1E114385E830@sourceware.org \
    --to=jakub@gcc.gnu.org \
    --cc=gcc-cvs@gcc.gnu.org \
    /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).