OSDN Git Service

PR 22077.
authorfjahanian <fjahanian@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 20 Jun 2005 17:59:35 +0000 (17:59 +0000)
committerfjahanian <fjahanian@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 20 Jun 2005 17:59:35 +0000 (17:59 +0000)
Oked by Roger Sayle.

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

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

index 92c4299..3f64b73 100644 (file)
@@ -1,3 +1,9 @@
+2005-06-20  Roger Sayle  <roger@eyesopen.com>
+2005-06-20  Fariborz Jahanian <fjahanian@apple.com>
+
+       * combine.c (simplify_set): Simplify setting of CC register
+       by removing redundant compare with 0 on RHS.
+
 2005-06-20  Jan Beulich  <jbeulich@novell.com>
 
        * config/i386/netware-libgcc.def: Update copyright.
index c4e6f95..e10d29f 100644 (file)
@@ -5274,6 +5274,11 @@ simplify_set (rtx x)
          SUBST (SET_SRC (x), gen_rtx_COMPARE (compare_mode, op0, op1));
          src = SET_SRC (x);
        }
+      else if (GET_MODE (op0) == compare_mode && op1 == const0_rtx)
+       {
+         SUBST(SET_SRC (x), op0);
+         src = SET_SRC (x);
+        }
       else
        {
          /* Otherwise, update the COMPARE if needed.  */
diff --git a/gcc/testsuite/gcc.dg/altivec-nomfcr.c b/gcc/testsuite/gcc.dg/altivec-nomfcr.c
new file mode 100644 (file)
index 0000000..5c8c96b
--- /dev/null
@@ -0,0 +1,10 @@
+/* { dg-do compile { target powerpc-*-* } } */
+/* { dg-options "-O3 -maltivec" } */
+/* { dg-final { scan-assembler-not "mfcr" } } */
+
+#include <altivec.h>
+
+int foo(vector float x, vector float y) {
+        if (vec_all_eq(x,y)) return 3245;
+        else return 12;
+}