+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
"&& 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
{
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")))])