OSDN Git Service

ChangeLog:
authoruweigand <uweigand@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 17 Feb 2004 22:07:51 +0000 (22:07 +0000)
committeruweigand <uweigand@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 17 Feb 2004 22:07:51 +0000 (22:07 +0000)
* combine.c (simplify_if_then_else): Do not replace
(if_then_else (ne reg 0) (0) (const_int)) by (reg) if the
modes differ.

testsuite/ChangeLog:

* gcc.dg/20040217-1.c: New test.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@77988 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/ChangeLog
gcc/combine.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/20040217-1.c [new file with mode: 0644]

index 5ece10c..700cccd 100644 (file)
@@ -1,3 +1,9 @@
+2004-02-17  Ulrich Weigand  <uweigand@de.ibm.com>
+
+       * combine.c (simplify_if_then_else): Do not replace 
+       (if_then_else (ne reg 0) (0) (const_int)) by (reg) if the
+       modes differ.
+
 2004-02017  Steven Bosscher  <stevenb@suse.de>
 
        * (c-decl.c, c-semantics.c, calls.c, cgraph.c, cgraphunit.c,
index 14cd64b..3cf8ae0 100644 (file)
@@ -4930,6 +4930,7 @@ simplify_if_then_else (rtx x)
   /* (IF_THEN_ELSE (NE REG 0) (0) (8)) is REG for nonzero_bits (REG) == 8.  */
   if (true_code == NE && XEXP (cond, 1) == const0_rtx
       && false_rtx == const0_rtx && GET_CODE (true_rtx) == CONST_INT
+      && GET_MODE (XEXP (cond, 0)) == mode
       && (INTVAL (true_rtx) & GET_MODE_MASK (mode))
          == nonzero_bits (XEXP (cond, 0), mode)
       && (i = exact_log2 (INTVAL (true_rtx) & GET_MODE_MASK (mode))) >= 0)
index 1e39c0e..52863b0 100644 (file)
@@ -1,3 +1,7 @@
+2004-02-17  Ulrich Weigand  <uweigand@de.ibm.com>
+
+       * gcc.dg/20040217-1.c: New test.
+
 2004-02-17  Zack Weinberg  <zack@codesourcery.com>
 
        * gcc.c-torture/execute/990208-1.x: Delete.
diff --git a/gcc/testsuite/gcc.dg/20040217-1.c b/gcc/testsuite/gcc.dg/20040217-1.c
new file mode 100644 (file)
index 0000000..7ca7388
--- /dev/null
@@ -0,0 +1,19 @@
+/* This used to ICE on s390x due to a bug in simplify_if_then_else.  */
+/* { dg-do compile } */
+/* { dg-options "-O2" } */
+
+extern void use (int);
+void test (void)
+{
+  union 
+   {
+     unsigned long ul;
+     signed char sc;
+   } u;
+
+  u.sc = 8;
+  u.sc &= 25;
+
+  use (u.sc);
+}
+