mips.c (mips_zero_if_equal): Only use XORs if the second operand is an uns_arith_oper...
authorRichard Sandiford <rsandifo@redhat.com>
Fri, 16 Jul 2004 07:53:47 +0000 (07:53 +0000)
committerRichard Sandiford <rsandifo@gcc.gnu.org>
Fri, 16 Jul 2004 07:53:47 +0000 (07:53 +0000)
* config/mips/mips.c (mips_zero_if_equal): Only use XORs if the second
operand is an uns_arith_operand; use subtraction otherwise.
* config/mips/mips.md (cmpsi, cmpdi): Allow any nonmemory_operand,
not just arith_operands.

From-SVN: r84809

gcc/ChangeLog
gcc/config/mips/mips.c
gcc/config/mips/mips.md

index a57ee1c7d86408b2b6ebca371d3615360e36b380..52c646fe2efd4e7bbd4bf562499c7cef764443e1 100644 (file)
@@ -1,3 +1,10 @@
+2004-07-16  Richard Sandiford  <rsandifo@redhat.com>
+
+       * config/mips/mips.c (mips_zero_if_equal): Only use XORs if the second
+       operand is an uns_arith_operand; use subtraction otherwise.
+       * config/mips/mips.md (cmpsi, cmpdi): Allow any nonmemory_operand,
+       not just arith_operands.
+
 2004-07-16  Richard Sandiford  <rsandifo@redhat.com>
 
        * config/mips/mips-protos.h (gen_int_relational): Delete.
index 648abbf00d2bb494b2f9b5eacd132ca2589f357d..489016af4649f91908843583d14fef33b1617d0d 100644 (file)
@@ -2776,7 +2776,11 @@ mips_zero_if_equal (rtx cmp0, rtx cmp1)
   if (cmp1 == const0_rtx)
     return cmp0;
 
-  return expand_binop (GET_MODE (cmp0), xor_optab,
+  if (uns_arith_operand (cmp1, VOIDmode))
+    return expand_binop (GET_MODE (cmp0), xor_optab,
+                        cmp0, cmp1, 0, 0, OPTAB_DIRECT);
+
+  return expand_binop (GET_MODE (cmp0), sub_optab,
                       cmp0, cmp1, 0, 0, OPTAB_DIRECT);
 }
 
index 08f04f8ded327cd1d3f546b9fd6565cb8014af21..abb5d442949efa042678fcd60f0a8cefabd224e1 100644 (file)
@@ -5472,7 +5472,7 @@ dsrl\t%3,%3,1\n\
 (define_expand "cmpsi"
   [(set (cc0)
        (compare:CC (match_operand:SI 0 "register_operand")
-                   (match_operand:SI 1 "arith_operand")))]
+                   (match_operand:SI 1 "nonmemory_operand")))]
   ""
 {
   cmp_operands[0] = operands[0];
@@ -5483,7 +5483,7 @@ dsrl\t%3,%3,1\n\
 (define_expand "cmpdi"
   [(set (cc0)
        (compare:CC (match_operand:DI 0 "register_operand")
-                   (match_operand:DI 1 "arith_operand")))]
+                   (match_operand:DI 1 "nonmemory_operand")))]
   "TARGET_64BIT"
 {
   cmp_operands[0] = operands[0];