]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
backport: re PR inline-asm/92615 (ICE in extract_insn)
authorJakub Jelinek <jakub@redhat.com>
Fri, 20 Dec 2019 16:57:21 +0000 (17:57 +0100)
committerJakub Jelinek <jakub@gcc.gnu.org>
Fri, 20 Dec 2019 16:57:21 +0000 (17:57 +0100)
Backported from mainline
2019-11-23  Jakub Jelinek  <jakub@redhat.com>

PR target/92615
* config/i386/i386.c (ix86_md_asm_adjust): If dest_mode is
GET_MODE (dest), is not QImode, using ZERO_EXTEND and dest is not
register_operand, force x into register before storing it into dest.
Formatting fix.

* gcc.target/i386/pr92615.c: New test.

From-SVN: r279651

gcc/ChangeLog
gcc/config/i386/i386.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.target/i386/pr92615.c [new file with mode: 0644]

index 9b5b4a0cf5b91f6c92f3c8bf54e9c5b81f5f9d5d..6803846520c861e6275dc81709e0be4c9e350c88 100644 (file)
@@ -1,3 +1,14 @@
+2019-12-20  Jakub Jelinek  <jakub@redhat.com>
+
+       Backported from mainline
+       2019-11-23  Jakub Jelinek  <jakub@redhat.com>
+
+       PR target/92615
+       * config/i386/i386.c (ix86_md_asm_adjust): If dest_mode is
+       GET_MODE (dest), is not QImode, using ZERO_EXTEND and dest is not
+       register_operand, force x into register before storing it into dest.
+       Formatting fix.
+
 2019-12-20  Roman Zhuykov  <zhroma@ispras.ru>
 
        Backport from mainline
index ce3fbd120ed73ff6edb3ac1ae3e81b9ccda6ac2e..ed1f767c7496bef53b77575edb8b09d10bc2861e 100644 (file)
@@ -44385,11 +44385,15 @@ ix86_md_asm_adjust (vec<rtx> &outputs, vec<rtx> &/*inputs*/,
            {
              x = force_reg (dest_mode, const0_rtx);
 
-             emit_insn (gen_movstrictqi
-                        (gen_lowpart (QImode, x), destqi));
+             emit_insn (gen_movstrictqi (gen_lowpart (QImode, x), destqi));
            }
          else
-           x = gen_rtx_ZERO_EXTEND (dest_mode, destqi);
+           {
+             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))
index c1d3e99b58a3812277e11a92c34dd3fcd60bcb29..f3d0452f6e8a741c87570d84859f79a475bde9fa 100644 (file)
@@ -1,6 +1,11 @@
 2019-12-20  Jakub Jelinek  <jakub@redhat.com>
 
        Backported from mainline
+       2019-11-23  Jakub Jelinek  <jakub@redhat.com>
+
+       PR target/92615
+       * gcc.target/i386/pr92615.c: New test.
+
        2019-11-22  Jakub Jelinek  <jakub@redhat.com>
 
        PR c/90677
diff --git a/gcc/testsuite/gcc.target/i386/pr92615.c b/gcc/testsuite/gcc.target/i386/pr92615.c
new file mode 100644 (file)
index 0000000..b84bfcd
--- /dev/null
@@ -0,0 +1,45 @@
+/* PR target/92615 */
+/* { dg-do compile } */
+/* { dg-options "-O2" } */
+
+void *a;
+long long b;
+char c;
+
+void
+foo (void)
+{
+  void *p;
+  long long q;
+  char r;
+  __asm__ ("" : : "r" (&p), "r" (&q), "r" (&r));
+  __asm__ ("" : "=@cca" (p));
+  a = p;
+  __asm__ ("" : "=@cca" (q));
+  b = q;
+  __asm__ ("" : "=@cca" (r));
+  c = r;
+  __asm__ ("" : : "r" (&p), "r" (&q), "r" (&r));
+}
+
+void
+bar (void)
+{
+  void *p;
+  long long q;
+  char r;
+  __asm__ ("" : "=@cca" (p));
+  a = p;
+  __asm__ ("" : "=@cca" (q));
+  b = q;
+  __asm__ ("" : "=@cca" (r));
+  c = r;
+  __asm__ ("" : : "r" (p), "A" (q), "q" (r));
+}
+
+void
+baz (void)
+{
+  void *p = (void *) &p;
+  __asm__ __volatile__ ("" : "=@ccng" (p) : "r" (1));
+}