public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH, i386]: Fix PR90547, ICE in gen_lowpart_general
@ 2019-05-21 18:00 Uros Bizjak
  0 siblings, 0 replies; only message in thread
From: Uros Bizjak @ 2019-05-21 18:00 UTC (permalink / raw)
  To: gcc-patches

[-- Attachment #1: Type: text/plain, Size: 480 bytes --]

2019-05-21  Uroš Bizjak  <ubizjak@gmail.com>

    PR target/90547
    * config/i386/i386.md (anddi_1 to andsi_1_zext splitter):
    Avoid calling gen_lowpart with CONST operand.

testsuite/ChangeLog:

2019-05-21  Uroš Bizjak  <ubizjak@gmail.com>

    PR target/90547
    * gcc.target/i386/pr90547.c: New test.

Bootstrapped and regression tested on x86_64-linux-gnu {,-m32}.

Committed to mainline SVN, patch will be backported to all release branches.

Uros.

[-- Attachment #2: p.diff.txt --]
[-- Type: text/plain, Size: 1248 bytes --]

Index: config/i386/i386.md
===================================================================
--- config/i386/i386.md	(revision 271467)
+++ config/i386/i386.md	(working copy)
@@ -8525,6 +8525,14 @@
       operands[2] = shallow_copy_rtx (operands[2]);
       PUT_MODE (operands[2], SImode);
     }
+  else if (GET_CODE (operands[2]) == CONST)
+    {
+      /* (const:DI (plus:DI (symbol_ref:DI ("...")) (const_int N))) */
+      operands[2] = copy_rtx (operands[2]);
+      PUT_MODE (operands[2], SImode);
+      PUT_MODE (XEXP (operands[2], 0), SImode);
+      PUT_MODE (XEXP (XEXP (operands[2], 0), 0), SImode);
+    }    
   else
     operands[2] = gen_lowpart (SImode, operands[2]);
 })
Index: testsuite/gcc.target/i386/pr90547.c
===================================================================
--- testsuite/gcc.target/i386/pr90547.c	(nonexistent)
+++ testsuite/gcc.target/i386/pr90547.c	(working copy)
@@ -0,0 +1,21 @@
+/* PR target/90547 */
+/* { dg-do compile } */
+/* { dg-options "-O2" } */
+
+void
+foo ()
+{
+  void *g[] = {&&a, &&b};
+
+  for (unsigned c = 0x1F;; c >>= 1)
+    {
+      unsigned d = (long)("a"+1);
+      long e = 8;
+
+      while (e)
+        {
+          a: goto *g[c&d];
+          b: e--;
+        }
+    }
+}

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2019-05-21 18:00 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-05-21 18:00 [PATCH, i386]: Fix PR90547, ICE in gen_lowpart_general Uros Bizjak

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).