[PATCH, i386]: Add some more x86_maybe_negate_const_int usages
Uros Bizjak
ubizjak@gmail.com
Fri Jun 11 10:03:00 GMT 2010
Hello!
2010-06-11 Uros Bizjak <ubizjak@gmail.com>
* config/i386/i386.md (pro_epilogue_adjust_stack_1) <TYPE_ALU>: Assert
that operand 0 == operand 1. Use x86_maybe_negate_const_int to output
insn mnemonic.
(pro_epilogue_adjust_stack_rex64) <TYPE_ALU>: Ditto.
Tested on x86_64-pc-linux-gnu, committed to mainline SVN.
Uros.
-------------- next part --------------
Index: i386.md
===================================================================
--- i386.md (revision 160599)
+++ i386.md (working copy)
@@ -16539,22 +16539,15 @@
return "mov{l}\t{%1, %0|%0, %1}";
case TYPE_ALU:
- if (CONST_INT_P (operands[2])
- && (INTVAL (operands[2]) == 128
- || (INTVAL (operands[2]) < 0
- && INTVAL (operands[2]) != -128)))
- {
- operands[2] = GEN_INT (-INTVAL (operands[2]));
- return "sub{l}\t{%2, %0|%0, %2}";
- }
+ gcc_assert (rtx_equal_p (operands[0], operands[1]));
+ if (x86_maybe_negate_const_int (&operands[2], SImode))
+ return "sub{l}\t{%2, %0|%0, %2}";
+
return "add{l}\t{%2, %0|%0, %2}";
- case TYPE_LEA:
+ default:
operands[2] = SET_SRC (XVECEXP (PATTERN (insn), 0, 0));
return "lea{l}\t{%a2, %0|%0, %a2}";
-
- default:
- gcc_unreachable ();
}
}
[(set (attr "type")
@@ -16589,24 +16582,15 @@
return "mov{q}\t{%1, %0|%0, %1}";
case TYPE_ALU:
- if (CONST_INT_P (operands[2])
- /* Avoid overflows. */
- && ((INTVAL (operands[2]) & ((((unsigned int) 1) << 31) - 1)))
- && (INTVAL (operands[2]) == 128
- || (INTVAL (operands[2]) < 0
- && INTVAL (operands[2]) != -128)))
- {
- operands[2] = GEN_INT (-INTVAL (operands[2]));
- return "sub{q}\t{%2, %0|%0, %2}";
- }
+ gcc_assert (rtx_equal_p (operands[0], operands[1]));
+ if (x86_maybe_negate_const_int (&operands[2], DImode))
+ return "sub{q}\t{%2, %0|%0, %2}";
+
return "add{q}\t{%2, %0|%0, %2}";
- case TYPE_LEA:
+ default:
operands[2] = SET_SRC (XVECEXP (PATTERN (insn), 0, 0));
return "lea{q}\t{%a2, %0|%0, %a2}";
-
- default:
- gcc_unreachable ();
}
}
[(set (attr "type")
More information about the Gcc-patches
mailing list