]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR target/89945 (ICE in gen_lowpart_general, at rtlhooks.c:63)
authorUros Bizjak <ubizjak@gmail.com>
Mon, 8 Apr 2019 05:33:01 +0000 (07:33 +0200)
committerUros Bizjak <uros@gcc.gnu.org>
Mon, 8 Apr 2019 05:33:01 +0000 (07:33 +0200)
PR target/89945
* config/i386/i386.md (anddi_1 to andsi_1_zext splitter):
Avoid calling gen_lowpart with SYMBOL_REF and LABEL_REF operand.

testsuite/ChangeLog:

PR target/89945
* gcc.target/i386/pr89945.c: New test.

From-SVN: r270197

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

index b32a5d734e35fd94bebbd1bbcfcd1875c7afa9cd..08e2ec88ba2c895687a68bae8d6bd366c5ebed86 100644 (file)
@@ -1,3 +1,9 @@
+2019-04-07  Uroš Bizjak  <ubizjak@gmail.com>
+
+       PR target/89945
+       * config/i386/i386.md (anddi_1 to andsi_1_zext splitter):
+       Avoid calling gen_lowpart with SYMBOL_REF and LABEL_REF operand.
+
 2019-04-06  Eric Botcazou  <ebotcazou@adacore.com>
 
        Backport from mainline
index 3ae4e70b4facfe1a333986900936b206027b75f1..b665dc5834a5d791ce607043c9e0828d4ab2246e 100644 (file)
   [(parallel [(set (match_dup 0)
                   (zero_extend:DI (and:SI (match_dup 1) (match_dup 2))))
              (clobber (reg:CC FLAGS_REG))])]
-  "operands[2] = gen_lowpart (SImode, operands[2]);")
+{
+  if (GET_CODE (operands[2]) == SYMBOL_REF
+      || GET_CODE (operands[2]) == LABEL_REF)
+    {
+      operands[2] = shallow_copy_rtx (operands[2]);
+      PUT_MODE (operands[2], SImode);
+    }
+  else
+    operands[2] = gen_lowpart (SImode, operands[2]);
+})
 
 ;; See comment for addsi_1_zext why we do use nonimmediate_operand
 (define_insn "*andsi_1_zext"
index 5175202bff5bb0a90fc1b19fc0a5826a2bfc6643..ffca0544038cf6740ecd62fcfdc0156eade6889d 100644 (file)
@@ -1,3 +1,8 @@
+2019-04-07  Uroš Bizjak  <ubizjak@gmail.com>
+
+       PR target/89945
+       * gcc.target/i386/pr89945.c: New test.
+
 2019-04-06  Eric Botcazou  <ebotcazou@adacore.com>
 
        * gnat.dg/opt73.adb: New test.
diff --git a/gcc/testsuite/gcc.target/i386/pr89945.c b/gcc/testsuite/gcc.target/i386/pr89945.c
new file mode 100644 (file)
index 0000000..39e864a
--- /dev/null
@@ -0,0 +1,21 @@
+/* PR target/89945 */
+/* { dg-do compile } */
+/* { dg-options "-O2" } */
+
+void
+foo ()
+{
+  void *g[] = {&&a, &&b};
+
+  for (unsigned c = 0x1F;; c >>= 1)
+    {
+      unsigned d = (long)"a";
+      long e = 8;
+
+      while (e)
+        {
+          a: goto *g[c&d];
+          b: e--;
+        }
+    }
+}