]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
simplify-rtx.c (simplify_relational_operation_1): Simplify (ne:SI (zero_extract:SI...
authorRoger Sayle <roger@eyesopen.com>
Sun, 6 Feb 2005 23:33:25 +0000 (23:33 +0000)
committerRoger Sayle <sayle@gcc.gnu.org>
Sun, 6 Feb 2005 23:33:25 +0000 (23:33 +0000)
* simplify-rtx.c (simplify_relational_operation_1): Simplify
(ne:SI (zero_extract:SI FOO (const_int 1) BAR) (const_int 0))
into just (zero_extract:SI FOO (const_int 1) BAR).

Co-Authored-By: Andrew Pinski <pinskia@physics.uc.edu>
Co-Authored-By: Paolo Bonzini <paolo.bonzini@lu.unisi.ch>
From-SVN: r94684

gcc/ChangeLog
gcc/simplify-rtx.c

index c92e209834c043e1e70f203e4d320e149964229b..4ae512ab5c44feff276d76ef44d4749c9e71b34a 100644 (file)
@@ -1,3 +1,11 @@
+2005-02-06  Roger Sayle  <roger@eyesopen.com>
+           Andrew Pinski  <pinskia@physics.uc.edu>
+           Paolo Bonzini  <paolo.bonzini@lu.unisi.ch>
+
+       * simplify-rtx.c (simplify_relational_operation_1): Simplify
+       (ne:SI (zero_extract:SI FOO (const_int 1) BAR) (const_int 0))
+       into just (zero_extract:SI FOO (const_int 1) BAR).
+
 2005-02-06  Joseph S. Myers  <joseph@codesourcery.com>
 
        * doc/cpp.texi: Include gcc-common.texi.  Don't define gcctabopt
index a1a774752cf38209f7d134171ff338dcd85d72dc..f23dba7c63cc6b4c127f8518148275a40d821ea8 100644 (file)
@@ -2880,6 +2880,18 @@ simplify_relational_operation_1 (enum rtx_code code, enum machine_mode mode,
       return simplify_gen_relational (code, mode, cmp_mode, x, c);
     }
 
+  /* (ne:SI (zero_extract:SI FOO (const_int 1) BAR) (const_int 0))) is
+     the same as (zero_extract:SI FOO (const_int 1) BAR).  */
+  if (code == NE
+      && op1 == const0_rtx
+      && GET_MODE_CLASS (mode) == MODE_INT
+      && cmp_mode != VOIDmode
+      && nonzero_bits (op0, cmp_mode) == 1
+      && STORE_FLAG_VALUE == 1)
+    return GET_MODE_SIZE (mode) > GET_MODE_SIZE (cmp_mode)
+          ? simplify_gen_unary (ZERO_EXTEND, mode, op0, cmp_mode)
+          : gen_lowpart (mode, op0);
+
   return NULL_RTX;
 }