Commit 5422cd26 by Richard Henderson Committed by David S. Miller

Add missing sparc shift zero extensions, and fix shift attributes.

	* config/sparc/sparc.md (ashlsi3, *ashldi3_sp64): Remove
	conditional insn type setting, we always emit a shift.
	(*ashlsi3_extend, *lshrsi3_extend0): New patterns.
	(*lshrsi3_extend): Rename to *lshrsi3_extend1.

Co-Authored-By: David S. Miller <davem@davemloft.net>

From-SVN: r179441
parent 073c1757
2011-10-02 Richard Henderson <rth@redhat.com>
David S. Miller <davem@davemloft.net>
* config/sparc/sparc.md (ashlsi3, *ashldi3_sp64): Remove
conditional insn type setting, we always emit a shift.
(*ashlsi3_extend, *lshrsi3_extend0): New patterns.
(*lshrsi3_extend): Rename to *lshrsi3_extend1.
2011-10-02 Gerald Pfeifer <gerald@pfeifer.com> 2011-10-02 Gerald Pfeifer <gerald@pfeifer.com>
* invoke.texi (SPARC Options): Refer to GNU/Linux. * invoke.texi (SPARC Options): Refer to GNU/Linux.
...@@ -24,11 +24,6 @@ ...@@ -24,11 +24,6 @@
(and (match_code "const_int,const_double,const_vector") (and (match_code "const_int,const_double,const_vector")
(match_test "op == CONST0_RTX (mode)"))) (match_test "op == CONST0_RTX (mode)")))
;; Return true if OP is the one constant for MODE.
(define_predicate "const_one_operand"
(and (match_code "const_int,const_double,const_vector")
(match_test "op == CONST1_RTX (mode)")))
;; Return true if the integer representation of OP is ;; Return true if the integer representation of OP is
;; all-ones. ;; all-ones.
(define_predicate "const_all_ones_operand" (define_predicate "const_all_ones_operand"
......
...@@ -5814,9 +5814,20 @@ ...@@ -5814,9 +5814,20 @@
operands[2] = GEN_INT (INTVAL (operands[2]) & 0x1f); operands[2] = GEN_INT (INTVAL (operands[2]) & 0x1f);
return "sll\t%1, %2, %0"; return "sll\t%1, %2, %0";
} }
[(set (attr "type") [(set_attr "type" "shift")])
(if_then_else (match_operand 2 "const_one_operand" "")
(const_string "ialu") (const_string "shift")))]) (define_insn "*ashlsi3_extend"
[(set (match_operand:DI 0 "register_operand" "=r")
(zero_extend:DI
(ashift:SI (match_operand:SI 1 "register_operand" "r")
(match_operand:SI 2 "arith_operand" "rI"))))]
"TARGET_ARCH64"
{
if (GET_CODE (operands[2]) == CONST_INT)
operands[2] = GEN_INT (INTVAL (operands[2]) & 0x1f);
return "sll\t%1, %2, %0";
}
[(set_attr "type" "shift")])
(define_expand "ashldi3" (define_expand "ashldi3"
[(set (match_operand:DI 0 "register_operand" "=r") [(set (match_operand:DI 0 "register_operand" "=r")
...@@ -5843,9 +5854,7 @@ ...@@ -5843,9 +5854,7 @@
operands[2] = GEN_INT (INTVAL (operands[2]) & 0x3f); operands[2] = GEN_INT (INTVAL (operands[2]) & 0x3f);
return "sllx\t%1, %2, %0"; return "sllx\t%1, %2, %0";
} }
[(set (attr "type") [(set_attr "type" "shift")])
(if_then_else (match_operand 2 "const_one_operand" "")
(const_string "ialu") (const_string "shift")))])
;; XXX UGH! ;; XXX UGH!
(define_insn "ashldi3_v8plus" (define_insn "ashldi3_v8plus"
...@@ -5980,10 +5989,23 @@ ...@@ -5980,10 +5989,23 @@
} }
[(set_attr "type" "shift")]) [(set_attr "type" "shift")])
(define_insn "*lshrsi3_extend0"
[(set (match_operand:DI 0 "register_operand" "=r")
(zero_extend:DI
(lshiftrt:SI (match_operand:SI 1 "register_operand" "r")
(match_operand:SI 2 "arith_operand" "rI"))))]
"TARGET_ARCH64"
{
if (GET_CODE (operands[2]) == CONST_INT)
operands[2] = GEN_INT (INTVAL (operands[2]) & 0x1f);
return "srl\t%1, %2, %0";
}
[(set_attr "type" "shift")])
;; This handles the case where ;; This handles the case where
;; (zero_extend:DI (lshiftrt:SI (match_operand:SI) (match_operand:SI))), ;; (zero_extend:DI (lshiftrt:SI (match_operand:SI) (match_operand:SI))),
;; but combiner "simplifies" it for us. ;; but combiner "simplifies" it for us.
(define_insn "*lshrsi3_extend" (define_insn "*lshrsi3_extend1"
[(set (match_operand:DI 0 "register_operand" "=r") [(set (match_operand:DI 0 "register_operand" "=r")
(and:DI (subreg:DI (lshiftrt:SI (match_operand:SI 1 "register_operand" "r") (and:DI (subreg:DI (lshiftrt:SI (match_operand:SI 1 "register_operand" "r")
(match_operand:SI 2 "arith_operand" "r")) 0) (match_operand:SI 2 "arith_operand" "r")) 0)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment