From: Kyrylo Tkachov Date: Mon, 27 Apr 2015 13:45:26 +0000 (+0000) Subject: [simplify-rtx][trivial] Use std::swap instead of manually swapping X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=e2be0590fcecf5b0b369415848d7edbe18bca125;p=gcc.git [simplify-rtx][trivial] Use std::swap instead of manually swapping * simplify-rtx.c (simplify_gen_binary): Use std::swap instead of manually swapping. (simplify_associative_operation): Likewise. (simplify_binary_operation): Likewise. (simplify_plus_minus): Likewise. (simplify_relational_operation): Likewise. (simplify_ternary_operation): Likewise. From-SVN: r222465 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 07bbbce0097..b211083425e 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,13 @@ +2015-04-27 Kyrylo Tkachov + + * simplify-rtx.c (simplify_gen_binary): Use std::swap instead + of manually swapping. + (simplify_associative_operation): Likewise. + (simplify_binary_operation): Likewise. + (simplify_plus_minus): Likewise. + (simplify_relational_operation): Likewise. + (simplify_ternary_operation): Likewise. + 2015-04-27 Richard Sandiford * config/stormy16/predicates.md (xs_hi_general_operand): Delete. diff --git a/gcc/simplify-rtx.c b/gcc/simplify-rtx.c index b85ef996e53..665421b79a2 100644 --- a/gcc/simplify-rtx.c +++ b/gcc/simplify-rtx.c @@ -216,7 +216,7 @@ simplify_gen_binary (enum rtx_code code, machine_mode mode, rtx op0, /* Put complex operands first and constants second if commutative. */ if (GET_RTX_CLASS (code) == RTX_COMM_ARITH && swap_commutative_operands_p (op0, op1)) - tem = op0, op0 = op1, op1 = tem; + std::swap (op0, op1); return gen_rtx_fmt_ee (code, mode, op0, op1); } @@ -1926,9 +1926,7 @@ simplify_associative_operation (enum rtx_code code, machine_mode mode, if (! swap_commutative_operands_p (op1, op0)) return simplify_gen_binary (code, mode, op1, op0); - tem = op0; - op0 = op1; - op1 = tem; + std::swap (op0, op1); } if (GET_CODE (op0) == code) @@ -1977,9 +1975,7 @@ simplify_binary_operation (enum rtx_code code, machine_mode mode, /* Make sure the constant is second. */ if (GET_RTX_CLASS (code) == RTX_COMM_ARITH && swap_commutative_operands_p (op0, op1)) - { - tem = op0, op0 = op1, op1 = tem; - } + std::swap (op0, op1); trueop0 = avoid_constant_pool_reference (op0); trueop1 = avoid_constant_pool_reference (op1); @@ -4265,10 +4261,10 @@ simplify_plus_minus (enum rtx_code code, machine_mode mode, rtx op0, { ncode = MINUS; if (lneg) - tem = lhs, lhs = rhs, rhs = tem; + std::swap (lhs, rhs); } else if (swap_commutative_operands_p (lhs, rhs)) - tem = lhs, lhs = rhs, rhs = tem; + std::swap (lhs, rhs); if ((GET_CODE (lhs) == CONST || CONST_INT_P (lhs)) && (GET_CODE (rhs) == CONST || CONST_INT_P (rhs))) @@ -4458,7 +4454,7 @@ simplify_relational_operation (enum rtx_code code, machine_mode mode, /* For the following tests, ensure const0_rtx is op1. */ if (swap_commutative_operands_p (op0, op1) || (op0 == const0_rtx && op1 != const0_rtx)) - tem = op0, op0 = op1, op1 = tem, code = swap_condition (code); + std::swap (op0, op1), code = swap_condition (code); /* If op0 is a compare, extract the comparison arguments from it. */ if (GET_CODE (op0) == COMPARE && op1 == const0_rtx) @@ -4819,7 +4815,7 @@ simplify_const_relational_operation (enum rtx_code code, /* Make sure the constant is second. */ if (swap_commutative_operands_p (op0, op1)) { - tem = op0, op0 = op1, op1 = tem; + std::swap (op0, op1); code = swap_condition (code); } @@ -5180,7 +5176,7 @@ simplify_ternary_operation (enum rtx_code code, machine_mode mode, /* Canonicalize the two multiplication operands. */ /* a * -b + c => -b * a + c. */ if (swap_commutative_operands_p (op0, op1)) - tem = op0, op0 = op1, op1 = tem, any_change = true; + std::swap (op0, op1), any_change = true; if (any_change) return gen_rtx_FMA (mode, op0, op1, op2);