public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
From: Max Filippov <jcmvbkbc@gcc.gnu.org>
To: gcc-cvs@gcc.gnu.org
Subject: [gcc r11-10054] gcc: xtensa: fix PR target/105879
Date: Wed,  8 Jun 2022 16:24:59 +0000 (GMT)	[thread overview]
Message-ID: <20220608162459.1E1BC3853558@sourceware.org> (raw)

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

commit r11-10054-gee9cd6d6e504cb67b27b1a5e39f965bafd62653b
Author: Max Filippov <jcmvbkbc@gmail.com>
Date:   Tue Jun 7 21:01:01 2022 -0700

    gcc: xtensa: fix PR target/105879
    
    split_double operates with the 'word that comes first in memory in the
    target' terminology, while gen_lowpart operates with the 'value
    representing some low-order bits of X' terminology. They are not
    equivalent and must be dealt with differently on little- and big-endian
    targets.
    
    gcc/
            PR target/105879
            * config/xtensa/xtensa.md (movdi): Rename 'first' and 'second'
            to 'lowpart' and 'highpart' so that they match 'gen_lowpart' and
            'gen_highpart' bitwise semantics and fix order of highpart and
            lowpart depending on target endianness.
    
    (cherry picked from commit e94c6dbfb57a862dd8a8685eabc4886ad1aaea25)

Diff:
---
 gcc/config/xtensa/xtensa.md | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)

diff --git a/gcc/config/xtensa/xtensa.md b/gcc/config/xtensa/xtensa.md
index cdf22f14b94..fabc313197a 100644
--- a/gcc/config/xtensa/xtensa.md
+++ b/gcc/config/xtensa/xtensa.md
@@ -754,11 +754,14 @@
 	 because of offering further optimization opportunities.  */
       if (register_operand (operands[0], DImode))
 	{
-	  rtx first, second;
-
-	  split_double (operands[1], &first, &second);
-	  emit_insn (gen_movsi (gen_lowpart (SImode, operands[0]), first));
-	  emit_insn (gen_movsi (gen_highpart (SImode, operands[0]), second));
+	  rtx lowpart, highpart;
+
+	  if (TARGET_BIG_ENDIAN)
+	    split_double (operands[1], &highpart, &lowpart);
+	  else
+	    split_double (operands[1], &lowpart, &highpart);
+	  emit_insn (gen_movsi (gen_lowpart (SImode, operands[0]), lowpart));
+	  emit_insn (gen_movsi (gen_highpart (SImode, operands[0]), highpart));
 	  DONE;
 	}


                 reply	other threads:[~2022-06-08 16:24 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=20220608162459.1E1BC3853558@sourceware.org \
    --to=jcmvbkbc@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).