mirror of
git://gcc.gnu.org/git/gcc.git
synced 2025-04-10 21:41:14 +08:00
i386-protos.h (x86_maybe_negate_const_int): Declare.
* config/i386/i386-protos.h (x86_maybe_negate_const_int): Declare. * config/i386/i386.c (x86_maybe_negate_const_int): New. (x86_output_mi_thunk): Use x86_maybe_negate_const_int. * config/i386/i386.md (*add<mode>_1, *addsi_1_zext, *addhi_1, *addhi_1_lea, *addqi_1, *addqi_1_lea, *addqi_1_slp, *add<mode>_2, *addsi_2_zext, *addhi_2, *addqi_2, *add<mode>_3, *addsi_3_zext, *addhi_3, *addqi_3,*add<mode>_5, *addhi_5, *addqi_5): Use x86_maybe_negate_const_int to output insn mnemonic. (*adddi_4, *addsi_4, *addhi_4, *addqi_4): Ditto. Remove overflow check from instruction predicate. Update comments. * config/i386/sync.md (sync_add<mode>): Use x86_maybe_negate_const_int to output insn mnemonic. From-SVN: r158013
This commit is contained in:
parent
be59db2d47
commit
d079b87fab
@ -1,12 +1,28 @@
|
||||
2010-04-06 Jan Hubicka <jh@suse.czpli
|
||||
2010-04-06 Uros Bizjak <ubizjak@gmail.com>
|
||||
|
||||
* config/i386/i386-protos.h (x86_maybe_negate_const_int): Declare.
|
||||
* config/i386/i386.c (x86_maybe_negate_const_int): New.
|
||||
(x86_output_mi_thunk): Use x86_maybe_negate_const_int.
|
||||
* config/i386/i386.md (*add<mode>_1, *addsi_1_zext, *addhi_1,
|
||||
*addhi_1_lea, *addqi_1, *addqi_1_lea, *addqi_1_slp, *add<mode>_2,
|
||||
*addsi_2_zext, *addhi_2, *addqi_2, *add<mode>_3, *addsi_3_zext,
|
||||
*addhi_3, *addqi_3,*add<mode>_5, *addhi_5, *addqi_5):
|
||||
Use x86_maybe_negate_const_int to output insn mnemonic.
|
||||
(*adddi_4, *addsi_4, *addhi_4, *addqi_4): Ditto. Remove overflow
|
||||
check from instruction predicate. Update comments.
|
||||
* config/i386/sync.md (sync_add<mode>): Use
|
||||
x86_maybe_negate_const_int to output insn mnemonic.
|
||||
|
||||
|
||||
2010-04-06 Jan Hubicka <jh@suse.cz>
|
||||
|
||||
PR tree-optimization/42906
|
||||
|
||||
* tree-ssa-dce.c (mark_control_dependent_edges_necessary): Add IGNORE_SELF
|
||||
argument; set visited_control_parents for fully processed BBs.
|
||||
* tree-ssa-dce.c (mark_control_dependent_edges_necessary): Add
|
||||
IGNORE_SELF argument. Set visited_control_parents for fully
|
||||
processed BBs.
|
||||
(find_obviously_necessary_stmts): Update call of
|
||||
mark_control_dependent_edges_necessary.
|
||||
(propagate_necessity): Likewise; handle PHI edges more curefully.
|
||||
(propagate_necessity): Likewise. Handle PHI edges more curefully.
|
||||
|
||||
2010-04-06 Uros Bizjak <ubizjak@gmail.com>
|
||||
|
||||
@ -52,7 +68,7 @@
|
||||
|
||||
2010-04-02 Steven Bosscher <steven@gcc.gnu.org>
|
||||
|
||||
* ada/gcc-interface/Make-lang.in, alias.c, attribs.c, auto-inc-dec.c,
|
||||
* ada/gcc-interface/Make-lang.in, alias.c, attribs.c, auto-inc-dec.c,
|
||||
basic-block.h, bb-reorder.c, calls.c, c-common.c, cgraph.h,
|
||||
collect2.h, config/alpha/alpha.c, config/alpha/alpha.md,
|
||||
config/alpha/predicates.md, config/arm/arm.md,
|
||||
@ -123,7 +139,7 @@
|
||||
2010-04-02 Richard Earnshaw <rearnsha@arm.com>
|
||||
|
||||
PR target/43469
|
||||
* arm.c (legitimize_tls_address): Adjust call to
|
||||
* arm.c (legitimize_tls_address): Adjust call to
|
||||
gen_tls_load_dot_plus_four.
|
||||
(arm_note_pic_base): New function.
|
||||
(arm_cannot_copy_insn_p): Use it.
|
||||
@ -2684,7 +2700,7 @@
|
||||
|
||||
2010-02-15 Nick Clifton <nickc@redhat.com>
|
||||
|
||||
* config/h8300/h8300.c: (h8300_push_pop): Use bool type for
|
||||
* config/h8300/h8300.c (h8300_push_pop): Use bool type for
|
||||
boolean parameters. Use emit_jump_insn when emitting a pop
|
||||
instruction containing a return insn.
|
||||
(push): Use 'true' rather than '1' as second parameter to F.
|
||||
|
@ -44,6 +44,7 @@ extern int symbolic_reference_mentioned_p (rtx);
|
||||
extern bool extended_reg_mentioned_p (rtx);
|
||||
extern bool x86_extended_QIreg_mentioned_p (rtx);
|
||||
extern bool x86_extended_reg_mentioned_p (rtx);
|
||||
extern bool x86_maybe_negate_const_int (rtx *, enum machine_mode);
|
||||
extern enum machine_mode ix86_cc_mode (enum rtx_code, rtx, rtx);
|
||||
|
||||
extern int avx_vpermilp_parallel (rtx par, enum machine_mode mode);
|
||||
|
@ -26202,10 +26202,7 @@ x86_output_mi_thunk (FILE *file,
|
||||
/* Adjust the this parameter by a fixed constant. */
|
||||
if (delta)
|
||||
{
|
||||
/* Make things pretty and `subl $4,%eax' rather than `addl $-4,%eax'.
|
||||
Exceptions: -128 encodes smaller than 128, so swap sign and op. */
|
||||
bool sub = delta < 0 || delta == 128;
|
||||
xops[0] = GEN_INT (sub ? -delta : delta);
|
||||
xops[0] = GEN_INT (delta);
|
||||
xops[1] = this_reg ? this_reg : this_param;
|
||||
if (TARGET_64BIT)
|
||||
{
|
||||
@ -26217,12 +26214,12 @@ x86_output_mi_thunk (FILE *file,
|
||||
xops[0] = tmp;
|
||||
xops[1] = this_param;
|
||||
}
|
||||
if (sub)
|
||||
if (x86_maybe_negate_const_int (&xops[0], DImode))
|
||||
output_asm_insn ("sub{q}\t{%0, %1|%1, %0}", xops);
|
||||
else
|
||||
output_asm_insn ("add{q}\t{%0, %1|%1, %0}", xops);
|
||||
}
|
||||
else if (sub)
|
||||
else if (x86_maybe_negate_const_int (&xops[0], SImode))
|
||||
output_asm_insn ("sub{l}\t{%0, %1|%1, %0}", xops);
|
||||
else
|
||||
output_asm_insn ("add{l}\t{%0, %1|%1, %0}", xops);
|
||||
@ -26649,6 +26646,52 @@ x86_extended_reg_mentioned_p (rtx insn)
|
||||
extended_reg_mentioned_1, NULL);
|
||||
}
|
||||
|
||||
/* If profitable, negate (without causing overflow) integer constant
|
||||
of mode MODE at location LOC. Return true in this case. */
|
||||
bool
|
||||
x86_maybe_negate_const_int (rtx *loc, enum machine_mode mode)
|
||||
{
|
||||
HOST_WIDE_INT val;
|
||||
|
||||
if (!CONST_INT_P (*loc))
|
||||
return false;
|
||||
|
||||
switch (mode)
|
||||
{
|
||||
case DImode:
|
||||
/* DImode x86_64 constants must fit in 32 bits. */
|
||||
gcc_assert (x86_64_immediate_operand (*loc, mode));
|
||||
|
||||
mode = SImode;
|
||||
break;
|
||||
|
||||
case SImode:
|
||||
case HImode:
|
||||
case QImode:
|
||||
break;
|
||||
|
||||
default:
|
||||
gcc_unreachable ();
|
||||
}
|
||||
|
||||
/* Avoid overflows. */
|
||||
if (mode_signbit_p (mode, *loc))
|
||||
return false;
|
||||
|
||||
val = INTVAL (*loc);
|
||||
|
||||
/* Make things pretty and `subl $4,%eax' rather than `addl $-4,%eax'.
|
||||
Exceptions: -128 encodes smaller than 128, so swap sign and op. */
|
||||
if ((val < 0 && val != -128)
|
||||
|| val == 128)
|
||||
{
|
||||
*loc = GEN_INT (-val);
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/* Generate an unsigned DImode/SImode to FP conversion. This is the same code
|
||||
optabs would emit if we didn't have TFmode patterns. */
|
||||
|
||||
|
@ -6010,20 +6010,9 @@
|
||||
return "add{<imodesuffix>}\t{%1, %0|%0, %1}";
|
||||
|
||||
gcc_assert (rtx_equal_p (operands[0], operands[1]));
|
||||
if (x86_maybe_negate_const_int (&operands[2], <MODE>mode))
|
||||
return "sub{<imodesuffix>}\t{%2, %0|%0, %2}";
|
||||
|
||||
/* Make things pretty and `subl $4,%eax' rather than `addl $-4,%eax'.
|
||||
Exceptions: -128 encodes smaller than 128, so swap sign and op. */
|
||||
if (CONST_INT_P (operands[2])
|
||||
/* Avoid overflows. */
|
||||
&& (<MODE>mode != DImode
|
||||
|| ((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{<imodesuffix>}\t{%2, %0|%0, %2}";
|
||||
}
|
||||
return "add{<imodesuffix>}\t{%2, %0|%0, %2}";
|
||||
}
|
||||
}
|
||||
@ -6078,16 +6067,9 @@
|
||||
}
|
||||
|
||||
default:
|
||||
/* Make things pretty and `subl $4,%eax' rather than `addl $-4,%eax'.
|
||||
Exceptions: -128 encodes smaller than 128, so swap sign and op. */
|
||||
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, %k0|%k0, %2}";
|
||||
}
|
||||
if (x86_maybe_negate_const_int (&operands[2], SImode))
|
||||
return "sub{l}\t{%2, %k0|%k0, %2}";
|
||||
|
||||
return "add{l}\t{%2, %k0|%k0, %2}";
|
||||
}
|
||||
}
|
||||
@ -6129,16 +6111,9 @@
|
||||
}
|
||||
|
||||
default:
|
||||
/* Make things pretty and `subw $4,%ax' rather than `addw $-4,%ax'.
|
||||
Exceptions: -128 encodes smaller than 128, so swap sign and op. */
|
||||
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{w}\t{%2, %0|%0, %2}";
|
||||
}
|
||||
if (x86_maybe_negate_const_int (&operands[2], HImode))
|
||||
return "sub{w}\t{%2, %0|%0, %2}";
|
||||
|
||||
return "add{w}\t{%2, %0|%0, %2}";
|
||||
}
|
||||
}
|
||||
@ -6179,16 +6154,9 @@
|
||||
}
|
||||
|
||||
default:
|
||||
/* Make things pretty and `subw $4,%ax' rather than `addw $-4,%ax'.
|
||||
Exceptions: -128 encodes smaller than 128, so swap sign and op. */
|
||||
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{w}\t{%2, %0|%0, %2}";
|
||||
}
|
||||
if (x86_maybe_negate_const_int (&operands[2], HImode))
|
||||
return "sub{w}\t{%2, %0|%0, %2}";
|
||||
|
||||
return "add{w}\t{%2, %0|%0, %2}";
|
||||
}
|
||||
}
|
||||
@ -6226,14 +6194,8 @@
|
||||
}
|
||||
|
||||
default:
|
||||
/* Make things pretty and `subb $4,%al' rather than `addb $-4,%al'.
|
||||
Exceptions: -128 encodes smaller than 128, so swap sign and op. */
|
||||
if (CONST_INT_P (operands[2])
|
||||
&& (INTVAL (operands[2]) == 128
|
||||
|| (INTVAL (operands[2]) < 0
|
||||
&& INTVAL (operands[2]) != -128)))
|
||||
if (x86_maybe_negate_const_int (&operands[2], QImode))
|
||||
{
|
||||
operands[2] = GEN_INT (-INTVAL (operands[2]));
|
||||
if (widen)
|
||||
return "sub{l}\t{%2, %k0|%k0, %2}";
|
||||
else
|
||||
@ -6280,14 +6242,8 @@
|
||||
}
|
||||
|
||||
default:
|
||||
/* Make things pretty and `subb $4,%al' rather than `addb $-4,%al'.
|
||||
Exceptions: -128 encodes smaller than 128, so swap sign and op. */
|
||||
if (CONST_INT_P (operands[2])
|
||||
&& (INTVAL (operands[2]) == 128
|
||||
|| (INTVAL (operands[2]) < 0
|
||||
&& INTVAL (operands[2]) != -128)))
|
||||
if (x86_maybe_negate_const_int (&operands[2], QImode))
|
||||
{
|
||||
operands[2] = GEN_INT (-INTVAL (operands[2]));
|
||||
if (widen)
|
||||
return "sub{l}\t{%2, %k0|%k0, %2}";
|
||||
else
|
||||
@ -6332,13 +6288,9 @@
|
||||
}
|
||||
|
||||
default:
|
||||
/* Make things pretty and `subb $4,%al' rather than `addb $-4,%al'. */
|
||||
if (CONST_INT_P (operands[1])
|
||||
&& INTVAL (operands[1]) < 0)
|
||||
{
|
||||
operands[1] = GEN_INT (-INTVAL (operands[1]));
|
||||
return "sub{b}\t{%1, %0|%0, %1}";
|
||||
}
|
||||
if (x86_maybe_negate_const_int (&operands[1], QImode))
|
||||
return "sub{b}\t{%1, %0|%0, %1}";
|
||||
|
||||
return "add{b}\t{%1, %0|%0, %1}";
|
||||
}
|
||||
}
|
||||
@ -6383,19 +6335,9 @@
|
||||
gcc_assert (rtx_equal_p (operands[0], operands[1]));
|
||||
/* ???? In DImode, we ought to handle there the 32bit case too
|
||||
- do we need new constraint? */
|
||||
/* Make things pretty and `subl $4,%eax' rather than `addl $-4,%eax'.
|
||||
Exceptions: -128 encodes smaller than 128, so swap sign and op. */
|
||||
if (CONST_INT_P (operands[2])
|
||||
/* Avoid overflows. */
|
||||
&& (<MODE>mode != DImode
|
||||
|| ((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{<imodesuffix>}\t{%2, %0|%0, %2}";
|
||||
}
|
||||
if (x86_maybe_negate_const_int (&operands[2], <MODE>mode))
|
||||
return "sub{<imodesuffix>}\t{%2, %0|%0, %2}";
|
||||
|
||||
return "add{<imodesuffix>}\t{%2, %0|%0, %2}";
|
||||
}
|
||||
}
|
||||
@ -6437,16 +6379,9 @@
|
||||
}
|
||||
|
||||
default:
|
||||
/* Make things pretty and `subl $4,%eax' rather than `addl $-4,%eax'.
|
||||
Exceptions: -128 encodes smaller than 128, so swap sign and op. */
|
||||
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, %k0|%k0, %2}";
|
||||
}
|
||||
if (x86_maybe_negate_const_int (&operands[2], SImode))
|
||||
return "sub{l}\t{%2, %k0|%k0, %2}";
|
||||
|
||||
return "add{l}\t{%2, %k0|%k0, %2}";
|
||||
}
|
||||
}
|
||||
@ -6484,16 +6419,9 @@
|
||||
}
|
||||
|
||||
default:
|
||||
/* Make things pretty and `subw $4,%ax' rather than `addw $-4,%ax'.
|
||||
Exceptions: -128 encodes smaller than 128, so swap sign and op. */
|
||||
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{w}\t{%2, %0|%0, %2}";
|
||||
}
|
||||
if (x86_maybe_negate_const_int (&operands[2], HImode))
|
||||
return "sub{w}\t{%2, %0|%0, %2}";
|
||||
|
||||
return "add{w}\t{%2, %0|%0, %2}";
|
||||
}
|
||||
}
|
||||
@ -6533,13 +6461,9 @@
|
||||
}
|
||||
|
||||
default:
|
||||
/* Make things pretty and `subb $4,%al' rather than `addb $-4,%al'. */
|
||||
if (CONST_INT_P (operands[2])
|
||||
&& INTVAL (operands[2]) < 0)
|
||||
{
|
||||
operands[2] = GEN_INT (-INTVAL (operands[2]));
|
||||
return "sub{b}\t{%2, %0|%0, %2}";
|
||||
}
|
||||
if (x86_maybe_negate_const_int (&operands[2], QImode))
|
||||
return "sub{b}\t{%2, %0|%0, %2}";
|
||||
|
||||
return "add{b}\t{%2, %0|%0, %2}";
|
||||
}
|
||||
}
|
||||
@ -6577,19 +6501,9 @@
|
||||
gcc_assert (rtx_equal_p (operands[0], operands[1]));
|
||||
/* ???? In DImode, we ought to handle there the 32bit case too
|
||||
- do we need new constraint? */
|
||||
/* Make things pretty and `subl $4,%eax' rather than `addl $-4, %eax'.
|
||||
Exceptions: -128 encodes smaller than 128, so swap sign and op. */
|
||||
if (CONST_INT_P (operands[2])
|
||||
/* Avoid overflows. */
|
||||
&& (<MODE>mode != DImode
|
||||
|| ((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{<imodesuffix>}\t{%2, %0|%0, %2}";
|
||||
}
|
||||
if (x86_maybe_negate_const_int (&operands[2], <MODE>mode))
|
||||
return "sub{<imodesuffix>}\t{%2, %0|%0, %2}";
|
||||
|
||||
return "add{<imodesuffix>}\t{%2, %0|%0, %2}";
|
||||
}
|
||||
}
|
||||
@ -6630,16 +6544,9 @@
|
||||
}
|
||||
|
||||
default:
|
||||
/* Make things pretty and `subl $4,%eax' rather than `addl $-4,%eax'.
|
||||
Exceptions: -128 encodes smaller than 128, so swap sign and op. */
|
||||
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, %k0|%k0, %2}";
|
||||
}
|
||||
if (x86_maybe_negate_const_int (&operands[2], SImode))
|
||||
return "sub{l}\t{%2, %k0|%k0, %2}";
|
||||
|
||||
return "add{l}\t{%2, %k0|%k0, %2}";
|
||||
}
|
||||
}
|
||||
@ -6675,16 +6582,9 @@
|
||||
}
|
||||
|
||||
default:
|
||||
/* Make things pretty and `subw $4,%ax' rather than `addw $-4,%ax'.
|
||||
Exceptions: -128 encodes smaller than 128, so swap sign and op. */
|
||||
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{w}\t{%2, %0|%0, %2}";
|
||||
}
|
||||
if (x86_maybe_negate_const_int (&operands[2], HImode))
|
||||
return "sub{w}\t{%2, %0|%0, %2}";
|
||||
|
||||
return "add{w}\t{%2, %0|%0, %2}";
|
||||
}
|
||||
}
|
||||
@ -6722,13 +6622,9 @@
|
||||
}
|
||||
|
||||
default:
|
||||
/* Make things pretty and `subb $4,%al' rather than `addb $-4,%al'. */
|
||||
if (CONST_INT_P (operands[2])
|
||||
&& INTVAL (operands[2]) < 0)
|
||||
{
|
||||
operands[2] = GEN_INT (-INTVAL (operands[2]));
|
||||
return "sub{b}\t{%2, %0|%0, %2}";
|
||||
}
|
||||
if (x86_maybe_negate_const_int (&operands[2], QImode))
|
||||
return "sub{b}\t{%2, %0|%0, %2}";
|
||||
|
||||
return "add{b}\t{%2, %0|%0, %2}";
|
||||
}
|
||||
}
|
||||
@ -6742,8 +6638,6 @@
|
||||
; by converting cmp to add, inc or dec as done by peephole2. This pattern
|
||||
; is matched then. We can't accept general immediate, because for
|
||||
; case of overflows, the result is messed up.
|
||||
; This pattern also don't hold of 0x8000000000000000, since the value
|
||||
; overflows when negated.
|
||||
; Also carry flag is reversed compared to cmp, so this conversion is valid
|
||||
; only for comparisons not depending on it.
|
||||
|
||||
@ -6769,16 +6663,10 @@
|
||||
|
||||
default:
|
||||
gcc_assert (rtx_equal_p (operands[0], operands[1]));
|
||||
/* Make things pretty and `subl $4,%eax' rather than `addl $-4,%eax'.
|
||||
Exceptions: -128 encodes smaller than 128, so swap sign and op. */
|
||||
if ((INTVAL (operands[2]) == -128
|
||||
|| (INTVAL (operands[2]) > 0
|
||||
&& INTVAL (operands[2]) != 128))
|
||||
/* Avoid overflows. */
|
||||
&& ((INTVAL (operands[2]) & ((((unsigned int) 1) << 31) - 1))))
|
||||
return "sub{q}\t{%2, %0|%0, %2}";
|
||||
operands[2] = GEN_INT (-INTVAL (operands[2]));
|
||||
return "add{q}\t{%2, %0|%0, %2}";
|
||||
if (x86_maybe_negate_const_int (&operands[2], DImode))
|
||||
return "add{q}\t{%2, %0|%0, %2}";
|
||||
|
||||
return "sub{q}\t{%2, %0|%0, %2}";
|
||||
}
|
||||
}
|
||||
[(set (attr "type")
|
||||
@ -6796,8 +6684,6 @@
|
||||
; by converting cmp to add, inc or dec as done by peephole2. This pattern
|
||||
; is matched then. We can't accept general immediate, because for
|
||||
; case of overflows, the result is messed up.
|
||||
; This pattern also don't hold of 0x80000000, since the value overflows
|
||||
; when negated.
|
||||
; Also carry flag is reversed compared to cmp, so this conversion is valid
|
||||
; only for comparisons not depending on it.
|
||||
|
||||
@ -6807,8 +6693,7 @@
|
||||
(match_operand:SI 1 "nonimmediate_operand" "0")
|
||||
(match_operand:SI 2 "const_int_operand" "n")))
|
||||
(clobber (match_scratch:SI 0 "=rm"))]
|
||||
"ix86_match_ccmode (insn, CCGCmode)
|
||||
&& (INTVAL (operands[2]) & 0xffffffff) != 0x80000000"
|
||||
"ix86_match_ccmode (insn, CCGCmode)"
|
||||
{
|
||||
switch (get_attr_type (insn))
|
||||
{
|
||||
@ -6823,14 +6708,10 @@
|
||||
|
||||
default:
|
||||
gcc_assert (rtx_equal_p (operands[0], operands[1]));
|
||||
/* Make things pretty and `subl $4,%eax' rather than `addl $-4,%eax'.
|
||||
Exceptions: -128 encodes smaller than 128, so swap sign and op. */
|
||||
if ((INTVAL (operands[2]) == -128
|
||||
|| (INTVAL (operands[2]) > 0
|
||||
&& INTVAL (operands[2]) != 128)))
|
||||
return "sub{l}\t{%2, %0|%0, %2}";
|
||||
operands[2] = GEN_INT (-INTVAL (operands[2]));
|
||||
return "add{l}\t{%2, %0|%0, %2}";
|
||||
if (x86_maybe_negate_const_int (&operands[2], SImode))
|
||||
return "add{l}\t{%2, %0|%0, %2}";
|
||||
|
||||
return "sub{l}\t{%2, %0|%0, %2}";
|
||||
}
|
||||
}
|
||||
[(set (attr "type")
|
||||
@ -6852,8 +6733,7 @@
|
||||
(match_operand:HI 1 "nonimmediate_operand" "0")
|
||||
(match_operand:HI 2 "const_int_operand" "n")))
|
||||
(clobber (match_scratch:HI 0 "=rm"))]
|
||||
"ix86_match_ccmode (insn, CCGCmode)
|
||||
&& (INTVAL (operands[2]) & 0xffff) != 0x8000"
|
||||
"ix86_match_ccmode (insn, CCGCmode)"
|
||||
{
|
||||
switch (get_attr_type (insn))
|
||||
{
|
||||
@ -6868,14 +6748,10 @@
|
||||
|
||||
default:
|
||||
gcc_assert (rtx_equal_p (operands[0], operands[1]));
|
||||
/* Make things pretty and `subw $4,%ax' rather than `addw $-4,%ax'.
|
||||
Exceptions: -128 encodes smaller than 128, so swap sign and op. */
|
||||
if ((INTVAL (operands[2]) == -128
|
||||
|| (INTVAL (operands[2]) > 0
|
||||
&& INTVAL (operands[2]) != 128)))
|
||||
return "sub{w}\t{%2, %0|%0, %2}";
|
||||
operands[2] = GEN_INT (-INTVAL (operands[2]));
|
||||
return "add{w}\t{%2, %0|%0, %2}";
|
||||
if (x86_maybe_negate_const_int (&operands[2], HImode))
|
||||
return "add{w}\t{%2, %0|%0, %2}";
|
||||
|
||||
return "sub{w}\t{%2, %0|%0, %2}";
|
||||
}
|
||||
}
|
||||
[(set (attr "type")
|
||||
@ -6897,8 +6773,7 @@
|
||||
(match_operand:QI 1 "nonimmediate_operand" "0")
|
||||
(match_operand:QI 2 "const_int_operand" "n")))
|
||||
(clobber (match_scratch:QI 0 "=qm"))]
|
||||
"ix86_match_ccmode (insn, CCGCmode)
|
||||
&& (INTVAL (operands[2]) & 0xff) != 0x80"
|
||||
"ix86_match_ccmode (insn, CCGCmode)"
|
||||
{
|
||||
switch (get_attr_type (insn))
|
||||
{
|
||||
@ -6915,11 +6790,9 @@
|
||||
|
||||
default:
|
||||
gcc_assert (rtx_equal_p (operands[0], operands[1]));
|
||||
if (INTVAL (operands[2]) < 0)
|
||||
{
|
||||
operands[2] = GEN_INT (-INTVAL (operands[2]));
|
||||
return "add{b}\t{%2, %0|%0, %2}";
|
||||
}
|
||||
if (x86_maybe_negate_const_int (&operands[2], QImode))
|
||||
return "add{b}\t{%2, %0|%0, %2}";
|
||||
|
||||
return "sub{b}\t{%2, %0|%0, %2}";
|
||||
}
|
||||
}
|
||||
@ -6957,19 +6830,9 @@
|
||||
|
||||
default:
|
||||
gcc_assert (rtx_equal_p (operands[0], operands[1]));
|
||||
/* Make things pretty and `subl $4,%eax' rather than `addl $-4,%eax'.
|
||||
Exceptions: -128 encodes smaller than 128, so swap sign and op. */
|
||||
if (CONST_INT_P (operands[2])
|
||||
/* Avoid overflows. */
|
||||
&& (<MODE>mode != DImode
|
||||
|| ((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{<imodesuffix>}\t{%2, %0|%0, %2}";
|
||||
}
|
||||
if (x86_maybe_negate_const_int (&operands[2], <MODE>mode))
|
||||
return "sub{<imodesuffix>}\t{%2, %0|%0, %2}";
|
||||
|
||||
return "add{<imodesuffix>}\t{%2, %0|%0, %2}";
|
||||
}
|
||||
}
|
||||
@ -7006,16 +6869,9 @@
|
||||
}
|
||||
|
||||
default:
|
||||
/* Make things pretty and `subw $4,%ax' rather than `addw $-4,%ax'.
|
||||
Exceptions: -128 encodes smaller than 128, so swap sign and op. */
|
||||
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{w}\t{%2, %0|%0, %2}";
|
||||
}
|
||||
if (x86_maybe_negate_const_int (&operands[2], HImode))
|
||||
return "sub{w}\t{%2, %0|%0, %2}";
|
||||
|
||||
return "add{w}\t{%2, %0|%0, %2}";
|
||||
}
|
||||
}
|
||||
@ -7054,13 +6910,9 @@
|
||||
}
|
||||
|
||||
default:
|
||||
/* Make things pretty and `subb $4,%al' rather than `addb $-4,%al'. */
|
||||
if (CONST_INT_P (operands[2])
|
||||
&& INTVAL (operands[2]) < 0)
|
||||
{
|
||||
operands[2] = GEN_INT (-INTVAL (operands[2]));
|
||||
return "sub{b}\t{%2, %0|%0, %2}";
|
||||
}
|
||||
if (x86_maybe_negate_const_int (&operands[2], QImode))
|
||||
return "sub{b}\t{%2, %0|%0, %2}";
|
||||
|
||||
return "add{b}\t{%2, %0|%0, %2}";
|
||||
}
|
||||
}
|
||||
|
@ -202,6 +202,9 @@
|
||||
return "lock{%;| }dec{<imodesuffix>}\t%0";
|
||||
}
|
||||
|
||||
if (x86_maybe_negate_const_int (&operands[1], <MODE>mode))
|
||||
return "lock{%;| }sub{<imodesuffix>}\t{%1, %0|%0, %1}";
|
||||
|
||||
return "lock{%;| }add{<imodesuffix>}\t{%1, %0|%0, %1}";
|
||||
})
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user