+2014-11-11 Uros Bizjak <ubizjak@gmail.com>
+
+ * config/i386/i386.c (ix86_decompose_address): Replace open-coded
+ swap with std::swap to swap values.
+ (ix86_fixup_binary_operands): Ditto.
+ (ix86_binary_operator_ok): Ditto.
+ (ix86_prepare_fp_compare_args): Ditto.
+ (ix86_expand_branch): Ditto.
+ (ix86_expand_carry_flag_compare): Ditto.
+ (ix86_expand_int_movcc): Ditto.
+ (ix86_prepare_sse_fp_compare_args): Ditto.
+ (ix86_expand_sse_fp_minmax): Ditto.
+ (ix86_expand_int_vcond): Ditto.
+ (ix86_split_long_move): Ditto.
+ (ix86_expand_sse_comi): Ditto.
+ (ix86_expand_sse_compare_and_jump): Ditto.
+ (ix86_expand_sse_compare_mask): Ditto.
+ * config/i386/i386.md (*add<mode>_1): Ditto.
+ (addsi_1_zext): Ditto.
+ (*addhi_1): Ditto.
+ (*addqi_1): Ditto.
+ (*add<mode>_2): Ditto.
+ (*addsi_2_zext): Ditto.
+ (*add<mode>_3): Ditto.
+ (*addsi_3_zext): Ditto.
+ (*add<mode>_5): Ditto.
+ (absneg splitter): Ditto.
+
2014-11-11 Uros Bizjak <ubizjak@gmail.com>
Revert:
|| index_reg == frame_pointer_rtx
|| (REG_P (index_reg) && REGNO (index_reg) == STACK_POINTER_REGNUM)))
{
- rtx tmp;
- tmp = base, base = index, index = tmp;
- tmp = base_reg, base_reg = index_reg, index_reg = tmp;
+ std::swap (base, index);
+ std::swap (base_reg, index_reg);
}
/* Special case: %ebp cannot be encoded as a base without a displacement.
/* Canonicalize operand order. */
if (ix86_swap_binary_operands_p (code, mode, operands))
{
- rtx temp;
-
/* It is invalid to swap operands of different modes. */
gcc_assert (GET_MODE (src1) == GET_MODE (src2));
- temp = src1;
- src1 = src2;
- src2 = temp;
+ std::swap (src1, src2);
}
/* Both source operands cannot be in memory. */
/* Canonicalize operand order for commutative operators. */
if (ix86_swap_binary_operands_p (code, mode, operands))
- {
- rtx temp = src1;
- src1 = src2;
- src2 = temp;
- }
+ std::swap (src1, src2);
/* If the destination is memory, we must have a matching source operand. */
if (MEM_P (dst) && !rtx_equal_p (dst, src1))
enum rtx_code new_code = ix86_fp_swap_condition (code);
if (new_code != UNKNOWN)
{
- rtx tmp;
- tmp = op0, op0 = op1, op1 = tmp;
+ std::swap (op0, op1);
code = new_code;
}
}
> ix86_fp_comparison_cost (swap_condition (code))
&& (REG_P (op1) || can_create_pseudo_p ()))
{
- rtx tmp;
- tmp = op0, op0 = op1, op1 = tmp;
+ std::swap (op0, op1);
code = swap_condition (code);
if (!REG_P (op0))
op0 = force_reg (op_mode, op0);
if (CONSTANT_P (op0) && !CONSTANT_P (op1))
{
- tmp = op0, op0 = op1, op1 = tmp;
+ std::swap (op0, op1);
code = swap_condition (code);
}
if ((code == GT || code == UNLE || code == LE || code == UNGT)
&& !TARGET_IEEE_FP)
{
- rtx tmp = op0;
- op0 = op1;
- op1 = tmp;
+ std::swap (op0, op1);
code = swap_condition (code);
}
}
else
{
- rtx tmp = op1;
- op1 = op0;
- op0 = tmp;
+ std::swap (op1, op0);
code = (code == GTU ? LTU : GEU);
}
break;
{
machine_mode cmp_mode = GET_MODE (op0);
- HOST_WIDE_INT tmp;
- tmp = ct, ct = cf, cf = tmp;
+ std::swap (ct, cf);
diff = -diff;
if (SCALAR_FLOAT_MODE_P (cmp_mode))
compare_code = LT;
}
else
- {
- HOST_WIDE_INT tmp = cf;
- cf = ct;
- ct = tmp;
- }
+ std::swap (cf, ct);
out = emit_store_flag (out, code, op0, op1, VOIDmode, 0, -1);
}
ix86_prepare_sse_fp_compare_args (rtx dest, enum rtx_code code,
rtx *pop0, rtx *pop1)
{
- rtx tmp;
-
switch (code)
{
case LTGT:
ix86_expand_sse_fp_minmax only optimizes LT/UNGE. Swap the
comparison operands to transform into something that is
supported. */
- tmp = *pop0;
- *pop0 = *pop1;
- *pop1 = tmp;
+ std::swap (*pop0, *pop1);
code = swap_condition (code);
break;
if (code == LT)
;
else if (code == UNGE)
- {
- tmp = if_true;
- if_true = if_false;
- if_false = tmp;
- }
+ std::swap (if_true, if_false);
else
return false;
case LT:
case LTU:
+ std::swap (cop0, cop1);
code = swap_condition (code);
- x = cop0, cop0 = cop1, cop1 = x;
break;
default:
/* Collision in the middle part can be handled by reordering. */
if (collisions == 1 && nparts == 3 && collisionparts [1])
{
- tmp = part[0][1]; part[0][1] = part[0][2]; part[0][2] = tmp;
- tmp = part[1][1]; part[1][1] = part[1][2]; part[1][2] = tmp;
+ std::swap (part[0][1], part[0][2]);
+ std::swap (part[1][1], part[1][2]);
}
else if (collisions == 1
&& nparts == 4
{
if (collisionparts [1])
{
- tmp = part[0][1]; part[0][1] = part[0][2]; part[0][2] = tmp;
- tmp = part[1][1]; part[1][1] = part[1][2]; part[1][2] = tmp;
+ std::swap (part[0][1], part[0][2]);
+ std::swap (part[1][1], part[1][2]);
}
else
{
- tmp = part[0][2]; part[0][2] = part[0][3]; part[0][3] = tmp;
- tmp = part[1][2]; part[1][2] = part[1][3]; part[1][3] = tmp;
+ std::swap (part[0][2], part[0][3]);
+ std::swap (part[1][2], part[1][3]);
}
}
/* Swap operands if we have a comparison that isn't available in
hardware. */
if (d->flag & BUILTIN_DESC_SWAP_OPERANDS)
- {
- rtx tmp = op1;
- op1 = op0;
- op0 = tmp;
- }
+ std::swap (op1, op0);
target = gen_reg_rtx (SImode);
emit_move_insn (target, const0_rtx);
rtx tmp;
if (swap_operands)
- {
- tmp = op0;
- op0 = op1;
- op1 = tmp;
- }
+ std::swap (op0, op1);
label = gen_label_rtx ();
tmp = gen_rtx_REG (fpcmp_mode, FLAGS_REG);
rtx mask = gen_reg_rtx (mode);
if (swap_operands)
- {
- rtx tmp = op0;
- op0 = op1;
- op1 = tmp;
- }
+ std::swap (op0, op1);
insn = mode == DFmode ? gen_setcc_df_sse : gen_setcc_sf_sse;
/* For most processors, ADD is faster than LEA. This alternative
was added to use ADD as much as possible. */
if (which_alternative == 2)
- {
- rtx tmp;
- tmp = operands[1], operands[1] = operands[2], operands[2] = tmp;
- }
+ std::swap (operands[1], operands[2]);
gcc_assert (rtx_equal_p (operands[0], operands[1]));
if (x86_maybe_negate_const_int (&operands[2], <MODE>mode))
/* For most processors, ADD is faster than LEA. This alternative
was added to use ADD as much as possible. */
if (which_alternative == 1)
- {
- rtx tmp;
- tmp = operands[1], operands[1] = operands[2], operands[2] = tmp;
- }
+ std::swap (operands[1], operands[2]);
if (x86_maybe_negate_const_int (&operands[2], SImode))
return "sub{l}\t{%2, %k0|%k0, %2}";
/* For most processors, ADD is faster than LEA. This alternative
was added to use ADD as much as possible. */
if (which_alternative == 2)
- {
- rtx tmp;
- tmp = operands[1], operands[1] = operands[2], operands[2] = tmp;
- }
+ std::swap (operands[1], operands[2]);
gcc_assert (rtx_equal_p (operands[0], operands[1]));
if (x86_maybe_negate_const_int (&operands[2], HImode))
/* For most processors, ADD is faster than LEA. These alternatives
were added to use ADD as much as possible. */
if (which_alternative == 2 || which_alternative == 4)
- {
- rtx tmp;
- tmp = operands[1], operands[1] = operands[2], operands[2] = tmp;
- }
+ std::swap (operands[1], operands[2]);
gcc_assert (rtx_equal_p (operands[0], operands[1]));
if (x86_maybe_negate_const_int (&operands[2], QImode))
default:
if (which_alternative == 2)
- {
- rtx tmp;
- tmp = operands[1], operands[1] = operands[2], operands[2] = tmp;
- }
+ std::swap (operands[1], operands[2]);
gcc_assert (rtx_equal_p (operands[0], operands[1]));
if (x86_maybe_negate_const_int (&operands[2], <MODE>mode))
default:
if (which_alternative == 1)
- {
- rtx tmp;
- tmp = operands[1], operands[1] = operands[2], operands[2] = tmp;
- }
+ std::swap (operands[1], operands[2]);
if (x86_maybe_negate_const_int (&operands[2], SImode))
return "sub{l}\t{%2, %k0|%k0, %2}";
default:
if (which_alternative == 1)
- {
- rtx tmp;
- tmp = operands[1], operands[1] = operands[2], operands[2] = tmp;
- }
+ std::swap (operands[1], operands[2]);
gcc_assert (rtx_equal_p (operands[0], operands[1]));
if (x86_maybe_negate_const_int (&operands[2], <MODE>mode))
default:
if (which_alternative == 1)
- {
- rtx tmp;
- tmp = operands[1], operands[1] = operands[2], operands[2] = tmp;
- }
+ std::swap (operands[1], operands[2]);
if (x86_maybe_negate_const_int (&operands[2], SImode))
return "sub{l}\t{%2, %k0|%k0, %2}";
default:
if (which_alternative == 1)
- {
- rtx tmp;
- tmp = operands[1], operands[1] = operands[2], operands[2] = tmp;
- }
+ std::swap (operands[1], operands[2]);
gcc_assert (rtx_equal_p (operands[0], operands[1]));
if (x86_maybe_negate_const_int (&operands[2], <MODE>mode))
operands[0] = simplify_gen_subreg (vmode, operands[0], mode, 0);
operands[1] = simplify_gen_subreg (vmode, operands[1], mode, 0);
if (operands_match_p (operands[0], operands[2]))
- {
- tmp = operands[1];
- operands[1] = operands[2];
- operands[2] = tmp;
- }
+ std::swap (operands[1], operands[2]);
if (GET_CODE (operands[3]) == ABS)
tmp = gen_rtx_AND (vmode, operands[1], operands[2]);
else