public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
From: Uros Bizjak <uros@gcc.gnu.org>
To: gcc-cvs@gcc.gnu.org
Subject: [gcc r9-9096] i386: Fix up ix86_md_asm_adjust for TImode [PR98086]
Date: Thu,  3 Dec 2020 18:54:55 +0000 (GMT)	[thread overview]
Message-ID: <20201203185455.F00423854820@sourceware.org> (raw)

https://gcc.gnu.org/g:521c839fad4e4a30cdadda254fb3f07706285033

commit r9-9096-g521c839fad4e4a30cdadda254fb3f07706285033
Author: Uros Bizjak <ubizjak@gmail.com>
Date:   Thu Dec 3 19:08:23 2020 +0100

    i386: Fix up ix86_md_asm_adjust for TImode [PR98086]
    
    ix86_md_asm_adjust assumes that dest_mode can be only [QHSD]Imode
    and nothing else.  The patch rewrites zero-extension part to use
    convert_to_mode to handle TImode and hypothetically even wider modes.
    
    2020-12-03  Uroš Bizjak  <ubizjak@gmail.com>
                Jakub Jelinek  <jakub@redhat.com>
    
    gcc/
            PR target/98086
            * config/i386/i386.c (ix86_md_asm_adjustmd): Rewrite
            zero-extension part to use convert_to_mode.
    
    gcc/testsuite/
            PR target/98086
            * gcc.target/i386/pr98086.c: New test.

Diff:
---
 gcc/config/i386/i386.c                  | 38 +++++++--------------------------
 gcc/testsuite/gcc.target/i386/pr98086.c | 17 +++++++++++++++
 2 files changed, 25 insertions(+), 30 deletions(-)

diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c
index bd61be61fdf..e8982c507e4 100644
--- a/gcc/config/i386/i386.c
+++ b/gcc/config/i386/i386.c
@@ -44424,40 +44424,18 @@ ix86_md_asm_adjust (vec<rtx> &outputs, vec<rtx> &/*inputs*/,
 	  continue;
 	}
 
-      if (dest_mode == DImode && !TARGET_64BIT)
-	dest_mode = SImode;
-
-      if (dest_mode != QImode)
-	{
-	  rtx destqi = gen_reg_rtx (QImode);
-	  emit_insn (gen_rtx_SET (destqi, x));
-
-	  if (TARGET_ZERO_EXTEND_WITH_AND
-	      && optimize_function_for_speed_p (cfun))
-	    {
-	      x = force_reg (dest_mode, const0_rtx);
-
-	      emit_insn (gen_movstrictqi (gen_lowpart (QImode, x), destqi));
-	    }
-	  else
-	    {
-	      x = gen_rtx_ZERO_EXTEND (dest_mode, destqi);
-	      if (dest_mode == GET_MODE (dest)
-		  && !register_operand (dest, GET_MODE (dest)))
-		x = force_reg (dest_mode, x);
-	    }
-	}
-
-      if (dest_mode != GET_MODE (dest))
+      if (dest_mode == QImode)
+	emit_insn (gen_rtx_SET (dest, x));
+      else
 	{
-	  rtx tmp = gen_reg_rtx (SImode);
+	  rtx reg = gen_reg_rtx (QImode);
+	  emit_insn (gen_rtx_SET (reg, x));
 
-	  emit_insn (gen_rtx_SET (tmp, x));
-	  emit_insn (gen_zero_extendsidi2 (dest, tmp));
+	  reg = convert_to_mode (dest_mode, reg, 1);
+	  emit_move_insn (dest, reg);
 	}
-      else
-	emit_insn (gen_rtx_SET (dest, x));
     }
+
   rtx_insn *seq = get_insns ();
   end_sequence ();
 
diff --git a/gcc/testsuite/gcc.target/i386/pr98086.c b/gcc/testsuite/gcc.target/i386/pr98086.c
new file mode 100644
index 00000000000..254a3b9bef6
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr98086.c
@@ -0,0 +1,17 @@
+/* PR target/98086 */
+/* { dg-do compile } */
+/* { dg-options "" } */
+
+#ifdef __x86_64__
+typedef __int128 T;
+#else
+typedef long long T;
+#endif
+
+T x;
+
+void
+foo (void)
+{
+  __asm ("" : "=@ccc" (x));
+}


                 reply	other threads:[~2020-12-03 18:54 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=20201203185455.F00423854820@sourceware.org \
    --to=uros@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).