From 96d1447a7bc9aae1ea9b14104977d437ed4e0d07 Mon Sep 17 00:00:00 2001 From: segher Date: Sun, 21 Sep 2014 18:02:54 +0000 Subject: [PATCH] 2014-09-21 Segher Boessenkool * config/rs6000/rs6000.md (ctz2, ffs2, popcount2, popcntb2, popcntd2, parity2, parity2_cmpb): Tidy. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@215435 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 6 ++++ gcc/config/rs6000/rs6000.md | 70 ++++++++++++++++++++++----------------------- 2 files changed, 41 insertions(+), 35 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 08e66b7ee5f..fbbf00fd045 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,5 +1,11 @@ 2014-09-21 Segher Boessenkool + * config/rs6000/rs6000.md (ctz2, ffs2, popcount2, + popcntb2, popcntd2, parity2, parity2_cmpb): + Tidy. + +2014-09-21 Segher Boessenkool + * config/rs6000/rs6000.md (strlensi): Don't use subsi3 with a constant, use addsi3 directly. (three anonymous define_insn, two define_split): Delete. diff --git a/gcc/config/rs6000/rs6000.md b/gcc/config/rs6000/rs6000.md index dfebf5ab87c..059dd99a572 100644 --- a/gcc/config/rs6000/rs6000.md +++ b/gcc/config/rs6000/rs6000.md @@ -1797,12 +1797,12 @@ (match_dup 4))) (clobber (reg:GPR CA_REGNO))])] "" - { - operands[2] = gen_reg_rtx (mode); - operands[3] = gen_reg_rtx (mode); - operands[4] = gen_reg_rtx (mode); - operands[5] = GEN_INT (GET_MODE_BITSIZE (mode) - 1); - }) +{ + operands[2] = gen_reg_rtx (mode); + operands[3] = gen_reg_rtx (mode); + operands[4] = gen_reg_rtx (mode); + operands[5] = GEN_INT (GET_MODE_BITSIZE (mode) - 1); +}) (define_expand "ffs2" [(set (match_dup 2) @@ -1817,55 +1817,55 @@ (match_dup 4))) (clobber (reg:GPR CA_REGNO))])] "" - { - operands[2] = gen_reg_rtx (mode); - operands[3] = gen_reg_rtx (mode); - operands[4] = gen_reg_rtx (mode); - operands[5] = GEN_INT (GET_MODE_BITSIZE (mode)); - }) +{ + operands[2] = gen_reg_rtx (mode); + operands[3] = gen_reg_rtx (mode); + operands[4] = gen_reg_rtx (mode); + operands[5] = GEN_INT (GET_MODE_BITSIZE (mode)); +}) + + +(define_expand "popcount2" + [(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 "popcntb2" [(set (match_operand:GPR 0 "gpc_reg_operand" "=r") - (unspec:GPR [(match_operand:GPR 1 "gpc_reg_operand" "r")] - UNSPEC_POPCNTB))] + (unspec:GPR [(match_operand:GPR 1 "gpc_reg_operand" "r")] + UNSPEC_POPCNTB))] "TARGET_POPCNTB" "popcntb %0,%1" - [(set_attr "length" "4") - (set_attr "type" "popcnt")]) + [(set_attr "type" "popcnt")]) (define_insn "popcntd2" [(set (match_operand:GPR 0 "gpc_reg_operand" "=r") (popcount:GPR (match_operand:GPR 1 "gpc_reg_operand" "r")))] "TARGET_POPCNTD" "popcnt %0,%1" - [(set_attr "length" "4") - (set_attr "type" "popcnt")]) + [(set_attr "type" "popcnt")]) -(define_expand "popcount2" + +(define_expand "parity2" [(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; - }) + (parity:GPR (match_operand:GPR 1 "gpc_reg_operand" "")))] + "TARGET_POPCNTB" +{ + rs6000_emit_parity (operands[0], operands[1]); + DONE; +}) (define_insn "parity2_cmpb" [(set (match_operand:GPR 0 "gpc_reg_operand" "=r") (unspec:GPR [(match_operand:GPR 1 "gpc_reg_operand" "r")] UNSPEC_PARITY))] "TARGET_CMPB && TARGET_POPCNTB" "prty %0,%1" - [(set_attr "length" "4") - (set_attr "type" "popcnt")]) + [(set_attr "type" "popcnt")]) -(define_expand "parity2" - [(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 ;; AND immediate if we are converting to unsigned -- 2.11.4.GIT