re PR rtl-optimization/10588 ([PPC] i==0||j==0 should use cntlzw and srawi)
authorDavid Edelsohn <edelsohn@gnu.org>
Wed, 8 Jun 2005 14:46:09 +0000 (14:46 +0000)
committerDavid Edelsohn <dje@gcc.gnu.org>
Wed, 8 Jun 2005 14:46:09 +0000 (10:46 -0400)
* config/rs6000/rs6000.md (call_indirect_nonlocal_aix32): Prefer
CTR to LR.
(call_indirect_nonlocal_aix64): Same.
(call_value_indirect_nonlocal_aix32): Same.
(call_value_indirect_nonlocal_aix64): Same.

PR target/10588
(eq): Use CLZ splitter for compare with zero.

From-SVN: r100759

gcc/ChangeLog
gcc/config/rs6000/rs6000.md

index 8f54ae374009c6c090acf36d8aa87f0be4cbd62a..44fbfdb568c80539cc88b54149495fa07815d295 100644 (file)
@@ -1,3 +1,14 @@
+2005-06-08  David Edelsohn  <edelsohn@gnu.org>
+
+       * config/rs6000/rs6000.md (call_indirect_nonlocal_aix32): Prefer
+       CTR to LR.
+       (call_indirect_nonlocal_aix64): Same.
+       (call_value_indirect_nonlocal_aix32): Same.
+       (call_value_indirect_nonlocal_aix64): Same.
+
+       PR target/10588
+       (eq): Use CLZ splitter for compare with zero.
+
 2005-06-08  Bernd Schmidt  <bernd.schmidt@analog.com>
 
        * config/bfin/bfin.c (bfin_return_in_memory): Simplify; return
index 633dd7c1ca312435463dcca483ec2a73b6c333d2..9cd1350782d57b0a092d30e91cb27564b84f54aa 100644 (file)
 ;; and < 0 if they were not.
 
 (define_insn "*call_indirect_nonlocal_aix32"
-  [(call (mem:SI (match_operand:SI 0 "register_operand" "cl"))
-        (match_operand 1 "" "g"))
+  [(call (mem:SI (match_operand:SI 0 "register_operand" "c,*l"))
+        (match_operand 1 "" "g,g"))
    (use (reg:SI 2))
    (use (reg:SI 11))
    (set (reg:SI 2)
        (mem:SI (plus:SI (reg:SI 1) (const_int 20))))
-   (clobber (match_scratch:SI 2 "=l"))]
+   (clobber (match_scratch:SI 2 "=l,l"))]
   "TARGET_32BIT && DEFAULT_ABI == ABI_AIX"
   "b%T0l\;{l|lwz} 2,20(1)"
   [(set_attr "type" "jmpreg")
    (set_attr "length" "8")])
 
 (define_insn "*call_indirect_nonlocal_aix64"
-  [(call (mem:SI (match_operand:DI 0 "register_operand" "cl"))
-        (match_operand 1 "" "g"))
+  [(call (mem:SI (match_operand:DI 0 "register_operand" "c,*l"))
+        (match_operand 1 "" "g,g"))
    (use (reg:DI 2))
    (use (reg:DI 11))
    (set (reg:DI 2)
        (mem:DI (plus:DI (reg:DI 1) (const_int 40))))
-   (clobber (match_scratch:SI 2 "=l"))]
+   (clobber (match_scratch:SI 2 "=l,l"))]
   "TARGET_64BIT && DEFAULT_ABI == ABI_AIX"
   "b%T0l\;ld 2,40(1)"
   [(set_attr "type" "jmpreg")
 
 (define_insn "*call_value_indirect_nonlocal_aix32"
   [(set (match_operand 0 "" "")
-       (call (mem:SI (match_operand:SI 1 "register_operand" "cl"))
-             (match_operand 2 "" "g")))
+       (call (mem:SI (match_operand:SI 1 "register_operand" "c,*l"))
+             (match_operand 2 "" "g,g")))
    (use (reg:SI 2))
    (use (reg:SI 11))
    (set (reg:SI 2)
        (mem:SI (plus:SI (reg:SI 1) (const_int 20))))
-   (clobber (match_scratch:SI 3 "=l"))]
+   (clobber (match_scratch:SI 3 "=l,l"))]
   "TARGET_32BIT && DEFAULT_ABI == ABI_AIX"
   "b%T1l\;{l|lwz} 2,20(1)"
   [(set_attr "type" "jmpreg")
 
 (define_insn "*call_value_indirect_nonlocal_aix64"
   [(set (match_operand 0 "" "")
-       (call (mem:SI (match_operand:DI 1 "register_operand" "cl"))
-             (match_operand 2 "" "g")))
+       (call (mem:SI (match_operand:DI 1 "register_operand" "c,*l"))
+             (match_operand 2 "" "g,g")))
    (use (reg:DI 2))
    (use (reg:DI 11))
    (set (reg:DI 2)
        (mem:DI (plus:DI (reg:DI 1) (const_int 40))))
-   (clobber (match_scratch:SI 3 "=l"))]
+   (clobber (match_scratch:SI 3 "=l,l"))]
   "TARGET_64BIT && DEFAULT_ABI == ABI_AIX"
   "b%T1l\;ld 2,40(1)"
   [(set_attr "type" "jmpreg")
   [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r,r")
        (eq:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r")
               (match_operand:SI 2 "reg_or_cint_operand" "r,O,K,L,I")))
-   (clobber (match_scratch:SI 3 "=r,&r,r,r,r"))]
+   (clobber (match_scratch:SI 3 "=r,X,r,r,r"))]
   "TARGET_32BIT"
   "@
    xor %0,%1,%2\;{sfi|subfic} %3,%0,0\;{ae|adde} %0,%3,%0
-   {sfi|subfic} %3,%1,0\;{ae|adde} %0,%3,%1
+   #
    {xoril|xori} %0,%1,%b2\;{sfi|subfic} %3,%0,0\;{ae|adde} %0,%3,%0
    {xoriu|xoris} %0,%1,%u2\;{sfi|subfic} %3,%0,0\;{ae|adde} %0,%3,%0
    {sfi|subfic} %0,%1,%2\;{sfi|subfic} %3,%0,0\;{ae|adde} %0,%3,%0"
   [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,r,r")
        (eq:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r,r,r,r")
               (match_operand:DI 2 "reg_or_cint_operand" "r,O,K,J,I")))
-   (clobber (match_scratch:DI 3 "=r,&r,r,r,r"))]
+   (clobber (match_scratch:DI 3 "=r,X,r,r,r"))]
   "TARGET_64BIT"
   "@
    xor %0,%1,%2\;subfic %3,%0,0\;adde %0,%3,%0
-   subfic %3,%1,0\;adde %0,%3,%1
+   #
    xori %0,%1,%b2\;subfic %3,%0,0\;adde %0,%3,%0
    xoris %0,%1,%u2\;subfic %3,%0,0\;adde %0,%3,%0
    subfic %0,%1,%2\;subfic %3,%0,0\;adde %0,%3,%0"
   [(set_attr "type" "three,two,three,three,three")
    (set_attr "length" "12,8,12,12,12")])
 
+(define_split
+  [(set (match_operand:GPR 0 "gpc_reg_operand" "")
+       (eq:GPR (match_operand:GPR 1 "gpc_reg_operand" "")
+              (match_operand:GPR 2 "zero_constant" "")))
+   (clobber (match_scratch:GPR 3 ""))]
+  ""
+  [(set (match_dup 0)
+       (clz:GPR (match_dup 1)))
+   (set (match_dup 0)
+       (lshiftrt:GPR (match_dup 0) (match_dup 4)))]
+  {
+    operands[4] = GEN_INT (exact_log2 (GET_MODE_BITSIZE (<MODE>mode)));
+  })
+
 (define_insn ""
   [(set (match_operand:CC 4 "cc_reg_operand" "=x,x,x,x,x,?y,?y,?y,?y,?y")
        (compare:CC
         (const_int 0)))
    (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r,r,r,r,r,r,r")
        (eq:SI (match_dup 1) (match_dup 2)))
-   (clobber (match_scratch:SI 3 "=r,&r,r,r,r,r,&r,r,r,r"))]
+   (clobber (match_scratch:SI 3 "=r,X,r,r,r,r,X,r,r,r"))]
   "TARGET_32BIT"
   "@
    xor %0,%1,%2\;{sfi|subfic} %3,%0,0\;{ae.|adde.} %0,%3,%0
-   {sfi|subfic} %3,%1,0\;{ae.|adde.} %0,%3,%1
+   #
    {xoril|xori} %0,%1,%b2\;{sfi|subfic} %3,%0,0\;{ae.|adde.} %0,%3,%0
    {xoriu|xoris} %0,%1,%u2\;{sfi|subfic} %3,%0,0\;{ae.|adde.} %0,%3,%0
    {sfi|subfic} %0,%1,%2\;{sfi|subfic} %3,%0,0\;{ae.|adde.} %0,%3,%0
         (const_int 0)))
    (set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,r,r,r,r,r,r,r")
        (eq:DI (match_dup 1) (match_dup 2)))
-   (clobber (match_scratch:DI 3 "=r,&r,r,r,r,r,&r,r,r,r"))]
+   (clobber (match_scratch:DI 3 "=r,X,r,r,r,r,X,r,r,r"))]
   "TARGET_64BIT"
   "@
    xor %0,%1,%2\;subfic %3,%0,0\;adde. %0,%3,%0
-   subfic %3,%1,0\;adde. %0,%3,%1
+   #
    xori %0,%1,%b2\;subfic %3,%0,0\;adde. %0,%3,%0
    xoris %0,%1,%u2\;subfic %3,%0,0\;adde. %0,%3,%0
    subfic %0,%1,%2\;subfic %3,%0,0\;adde. %0,%3,%0
                    (const_int 0)))]
   "")
 
+(define_split
+  [(set (match_operand:CC 4 "cc_reg_operand" "")
+       (compare:CC
+        (eq:GPR (match_operand:GPR 1 "gpc_reg_operand" "")
+                (match_operand:GPR 2 "zero_constant" ""))
+        (const_int 0)))
+   (set (match_operand:GPR 0 "gpc_reg_operand" "")
+       (eq:GPR (match_dup 1) (match_dup 2)))
+   (clobber (match_scratch:GPR 3 ""))]
+  ""
+  [(set (match_dup 0)
+       (clz:GPR (match_dup 1)))
+   (parallel [(set (match_dup 4)
+                  (compare:CC (lshiftrt:GPR (match_dup 0) (match_dup 5))
+                              (const_int 0)))
+             (set (match_dup 0)
+                  (lshiftrt:GPR (match_dup 0) (match_dup 5)))])]
+  {
+    operands[5] = GEN_INT (exact_log2 (GET_MODE_BITSIZE (<MODE>mode)));
+  })
+
 ;; We have insns of the form shown by the first define_insn below.  If
 ;; there is something inside the comparison operation, we must split it.
 (define_split