rs6000: Improve scc isel
If we have a negative condition we can use a literal 0 in the isel, instead of having to load it into a register. If the condition is from a comparison with an immediate we can change e.g. LT to LE and adjust the immediate, saving a li instruction. * config/rs6000/rs6000.md (<code><GPR:mode><GPR2:mode>2_isel): Change LT/GT/LTU/GTU to LE/GE/LEU/GEU where possible. From-SVN: r255186
This commit is contained in:
parent
2ac1a8d832
commit
fd8bf76c90
|
@ -1,3 +1,8 @@
|
|||
2017-11-27 Segher Boessenkool <segher@kernel.crashing.org>
|
||||
|
||||
* config/rs6000/rs6000.md (<code><GPR:mode><GPR2:mode>2_isel): Change
|
||||
LT/GT/LTU/GTU to LE/GE/LEU/GEU where possible.
|
||||
|
||||
2017-11-27 Michael Meissner <meissner@linux.vnet.ibm.com>
|
||||
|
||||
PR middle_end/82333
|
||||
|
|
|
@ -12333,8 +12333,34 @@
|
|||
"&& 1"
|
||||
[(pc)]
|
||||
{
|
||||
if (<CODE> == NE || <CODE> == LE || <CODE> == GE
|
||||
|| <CODE> == LEU || <CODE> == GEU)
|
||||
rtx_code code = <CODE>;
|
||||
if (CONST_INT_P (operands[2]) && code != EQ && code != NE)
|
||||
{
|
||||
HOST_WIDE_INT val = INTVAL (operands[2]);
|
||||
if (code == LT && val != -0x8000)
|
||||
{
|
||||
code = LE;
|
||||
val--;
|
||||
}
|
||||
if (code == GT && val != 0x7fff)
|
||||
{
|
||||
code = GE;
|
||||
val++;
|
||||
}
|
||||
if (code == LTU && val != 0)
|
||||
{
|
||||
code = LEU;
|
||||
val--;
|
||||
}
|
||||
if (code == GTU && val != 0xffff)
|
||||
{
|
||||
code = GEU;
|
||||
val++;
|
||||
}
|
||||
operands[2] = GEN_INT (val);
|
||||
}
|
||||
|
||||
if (code == NE || code == LE || code == GE || code == LEU || code == GEU)
|
||||
operands[3] = const0_rtx;
|
||||
else
|
||||
{
|
||||
|
@ -12353,14 +12379,16 @@
|
|||
rtx c1 = gen_rtx_COMPARE (<UNS>mode, operands[1], operands[2]);
|
||||
emit_insn (gen_rtx_SET (operands[5], c1));
|
||||
|
||||
rtx c2 = gen_rtx_fmt_ee (<CODE>, <GPR:MODE>mode, operands[5], const0_rtx);
|
||||
rtx c2 = gen_rtx_fmt_ee (code, <GPR:MODE>mode, operands[5], const0_rtx);
|
||||
rtx x = gen_rtx_IF_THEN_ELSE (<GPR:MODE>mode, c2, operands[4], operands[3]);
|
||||
emit_move_insn (operands[0], x);
|
||||
|
||||
DONE;
|
||||
}
|
||||
[(set (attr "cost")
|
||||
(if_then_else (match_test "<CODE> == NE || <CODE> == LE || <CODE> == GE
|
||||
(if_then_else (match_test "(CONST_INT_P (operands[2]) && <CODE> != EQ)
|
||||
|| <CODE> == NE
|
||||
|| <CODE> == LE || <CODE> == GE
|
||||
|| <CODE> == LEU || <CODE> == GEU")
|
||||
(const_string "9")
|
||||
(const_string "10")))])
|
||||
|
|
Loading…
Reference in New Issue