Commit f4e0b104 by Segher Boessenkool Committed by Segher Boessenkool

rs6000.md (ctz<mode>2, [...]): Tidy.

2014-09-21  Segher Boessenkool  <segher@kernel.crashing.org>

	* config/rs6000/rs6000.md (ctz<mode>2, ffs<mode>2, popcount<mode>2,
	popcntb<mode>2, popcntd<mode>2, parity<mode>2, parity<mode>2_cmpb):
	Tidy.

From-SVN: r215435
parent 9f31288f
2014-09-21 Segher Boessenkool <segher@kernel.crashing.org> 2014-09-21 Segher Boessenkool <segher@kernel.crashing.org>
* config/rs6000/rs6000.md (ctz<mode>2, ffs<mode>2, popcount<mode>2,
popcntb<mode>2, popcntd<mode>2, parity<mode>2, parity<mode>2_cmpb):
Tidy.
2014-09-21 Segher Boessenkool <segher@kernel.crashing.org>
* config/rs6000/rs6000.md (strlensi): Don't use subsi3 with a * config/rs6000/rs6000.md (strlensi): Don't use subsi3 with a
constant, use addsi3 directly. constant, use addsi3 directly.
(three anonymous define_insn, two define_split): Delete. (three anonymous define_insn, two define_split): Delete.
...@@ -1797,12 +1797,12 @@ ...@@ -1797,12 +1797,12 @@
(match_dup 4))) (match_dup 4)))
(clobber (reg:GPR CA_REGNO))])] (clobber (reg:GPR CA_REGNO))])]
"" ""
{ {
operands[2] = gen_reg_rtx (<MODE>mode); operands[2] = gen_reg_rtx (<MODE>mode);
operands[3] = gen_reg_rtx (<MODE>mode); operands[3] = gen_reg_rtx (<MODE>mode);
operands[4] = gen_reg_rtx (<MODE>mode); operands[4] = gen_reg_rtx (<MODE>mode);
operands[5] = GEN_INT (GET_MODE_BITSIZE (<MODE>mode) - 1); operands[5] = GEN_INT (GET_MODE_BITSIZE (<MODE>mode) - 1);
}) })
(define_expand "ffs<mode>2" (define_expand "ffs<mode>2"
[(set (match_dup 2) [(set (match_dup 2)
...@@ -1817,55 +1817,55 @@ ...@@ -1817,55 +1817,55 @@
(match_dup 4))) (match_dup 4)))
(clobber (reg:GPR CA_REGNO))])] (clobber (reg:GPR CA_REGNO))])]
"" ""
{ {
operands[2] = gen_reg_rtx (<MODE>mode); operands[2] = gen_reg_rtx (<MODE>mode);
operands[3] = gen_reg_rtx (<MODE>mode); operands[3] = gen_reg_rtx (<MODE>mode);
operands[4] = gen_reg_rtx (<MODE>mode); operands[4] = gen_reg_rtx (<MODE>mode);
operands[5] = GEN_INT (GET_MODE_BITSIZE (<MODE>mode)); operands[5] = GEN_INT (GET_MODE_BITSIZE (<MODE>mode));
}) })
(define_expand "popcount<mode>2"
[(set (match_operand:GPR 0 "gpc_reg_operand" "")
(popcount:GPR (match_operand:GPR 1 "gpc_reg_operand" "")))]
"TARGET_POPCNTB || TARGET_POPCNTD"
{
rs6000_emit_popcount (operands[0], operands[1]);
DONE;
})
(define_insn "popcntb<mode>2" (define_insn "popcntb<mode>2"
[(set (match_operand:GPR 0 "gpc_reg_operand" "=r") [(set (match_operand:GPR 0 "gpc_reg_operand" "=r")
(unspec:GPR [(match_operand:GPR 1 "gpc_reg_operand" "r")] (unspec:GPR [(match_operand:GPR 1 "gpc_reg_operand" "r")]
UNSPEC_POPCNTB))] UNSPEC_POPCNTB))]
"TARGET_POPCNTB" "TARGET_POPCNTB"
"popcntb %0,%1" "popcntb %0,%1"
[(set_attr "length" "4") [(set_attr "type" "popcnt")])
(set_attr "type" "popcnt")])
(define_insn "popcntd<mode>2" (define_insn "popcntd<mode>2"
[(set (match_operand:GPR 0 "gpc_reg_operand" "=r") [(set (match_operand:GPR 0 "gpc_reg_operand" "=r")
(popcount:GPR (match_operand:GPR 1 "gpc_reg_operand" "r")))] (popcount:GPR (match_operand:GPR 1 "gpc_reg_operand" "r")))]
"TARGET_POPCNTD" "TARGET_POPCNTD"
"popcnt<wd> %0,%1" "popcnt<wd> %0,%1"
[(set_attr "length" "4") [(set_attr "type" "popcnt")])
(set_attr "type" "popcnt")])
(define_expand "popcount<mode>2"
(define_expand "parity<mode>2"
[(set (match_operand:GPR 0 "gpc_reg_operand" "") [(set (match_operand:GPR 0 "gpc_reg_operand" "")
(popcount:GPR (match_operand:GPR 1 "gpc_reg_operand" "")))] (parity:GPR (match_operand:GPR 1 "gpc_reg_operand" "")))]
"TARGET_POPCNTB || TARGET_POPCNTD" "TARGET_POPCNTB"
{ {
rs6000_emit_popcount (operands[0], operands[1]); rs6000_emit_parity (operands[0], operands[1]);
DONE; DONE;
}) })
(define_insn "parity<mode>2_cmpb" (define_insn "parity<mode>2_cmpb"
[(set (match_operand:GPR 0 "gpc_reg_operand" "=r") [(set (match_operand:GPR 0 "gpc_reg_operand" "=r")
(unspec:GPR [(match_operand:GPR 1 "gpc_reg_operand" "r")] UNSPEC_PARITY))] (unspec:GPR [(match_operand:GPR 1 "gpc_reg_operand" "r")] UNSPEC_PARITY))]
"TARGET_CMPB && TARGET_POPCNTB" "TARGET_CMPB && TARGET_POPCNTB"
"prty<wd> %0,%1" "prty<wd> %0,%1"
[(set_attr "length" "4") [(set_attr "type" "popcnt")])
(set_attr "type" "popcnt")])
(define_expand "parity<mode>2"
[(set (match_operand:GPR 0 "gpc_reg_operand" "")
(parity:GPR (match_operand:GPR 1 "gpc_reg_operand" "")))]
"TARGET_POPCNTB"
{
rs6000_emit_parity (operands[0], operands[1]);
DONE;
})
;; Since the hardware zeros the upper part of the register, save generating the ;; Since the hardware zeros the upper part of the register, save generating the
;; AND immediate if we are converting to unsigned ;; AND immediate if we are converting to unsigned
......
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