From a1ac80507d37425ef84fa68431bb2c63d6b27fef Mon Sep 17 00:00:00 2001 From: Kyrylo Tkachov Date: Wed, 4 Feb 2015 13:53:56 +0000 Subject: [PATCH] [AArch64] Use std::swap instead of manually swapping in aarch64-ldpstp.md * config/aarch64/aarch64-ldpstp.md: Use std::swap instead of manual swaps in all peepholes. From-SVN: r220403 --- gcc/ChangeLog | 5 + gcc/config/aarch64/aarch64-ldpstp.md | 168 ++++++++------------------- 2 files changed, 53 insertions(+), 120 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 165f521f806..d63c59cacbe 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2015-02-04 Kyrylo Tkachov + + * config/aarch64/aarch64-ldpstp.md: Use std::swap instead of + manual swaps in all peepholes. + 2015-02-04 Kyrylo Tkachov * config/aarch64/aarch64.c (aarch64_evpc_ext): Use std::swap instead diff --git a/gcc/config/aarch64/aarch64-ldpstp.md b/gcc/config/aarch64/aarch64-ldpstp.md index af8d50e1891..8d6d88259d5 100644 --- a/gcc/config/aarch64/aarch64-ldpstp.md +++ b/gcc/config/aarch64/aarch64-ldpstp.md @@ -27,18 +27,14 @@ [(parallel [(set (match_dup 0) (match_dup 1)) (set (match_dup 2) (match_dup 3))])] { - rtx base, offset_1, offset_2, tmp; + rtx base, offset_1, offset_2; extract_base_offset_in_addr (operands[1], &base, &offset_1); extract_base_offset_in_addr (operands[3], &base, &offset_2); if (INTVAL (offset_1) > INTVAL (offset_2)) { - tmp = operands[0]; - operands[0] = operands[2]; - operands[2] = tmp; - tmp = operands[1]; - operands[1] = operands[3]; - operands[3] = tmp; + std::swap (operands[0], operands[2]); + std::swap (operands[1], operands[3]); } }) @@ -51,18 +47,14 @@ [(parallel [(set (match_dup 0) (match_dup 1)) (set (match_dup 2) (match_dup 3))])] { - rtx base, offset_1, offset_2, tmp; + rtx base, offset_1, offset_2; extract_base_offset_in_addr (operands[0], &base, &offset_1); extract_base_offset_in_addr (operands[2], &base, &offset_2); if (INTVAL (offset_1) > INTVAL (offset_2)) { - tmp = operands[0]; - operands[0] = operands[2]; - operands[2] = tmp; - tmp = operands[1]; - operands[1] = operands[3]; - operands[3] = tmp; + std::swap (operands[0], operands[2]); + std::swap (operands[1], operands[3]); } }) @@ -75,18 +67,14 @@ [(parallel [(set (match_dup 0) (match_dup 1)) (set (match_dup 2) (match_dup 3))])] { - rtx base, offset_1, offset_2, tmp; + rtx base, offset_1, offset_2; extract_base_offset_in_addr (operands[1], &base, &offset_1); extract_base_offset_in_addr (operands[3], &base, &offset_2); if (INTVAL (offset_1) > INTVAL (offset_2)) { - tmp = operands[0]; - operands[0] = operands[2]; - operands[2] = tmp; - tmp = operands[1]; - operands[1] = operands[3]; - operands[3] = tmp; + std::swap (operands[0], operands[2]); + std::swap (operands[1], operands[3]); } }) @@ -99,18 +87,14 @@ [(parallel [(set (match_dup 0) (match_dup 1)) (set (match_dup 2) (match_dup 3))])] { - rtx base, offset_1, offset_2, tmp; + rtx base, offset_1, offset_2; extract_base_offset_in_addr (operands[0], &base, &offset_1); extract_base_offset_in_addr (operands[2], &base, &offset_2); if (INTVAL (offset_1) > INTVAL (offset_2)) { - tmp = operands[0]; - operands[0] = operands[2]; - operands[2] = tmp; - tmp = operands[1]; - operands[1] = operands[3]; - operands[3] = tmp; + std::swap (operands[0], operands[2]); + std::swap (operands[1], operands[3]); } }) @@ -125,18 +109,14 @@ [(parallel [(set (match_dup 0) (sign_extend:DI (match_dup 1))) (set (match_dup 2) (sign_extend:DI (match_dup 3)))])] { - rtx base, offset_1, offset_2, tmp; + rtx base, offset_1, offset_2; extract_base_offset_in_addr (operands[1], &base, &offset_1); extract_base_offset_in_addr (operands[3], &base, &offset_2); if (INTVAL (offset_1) > INTVAL (offset_2)) { - tmp = operands[0]; - operands[0] = operands[2]; - operands[2] = tmp; - tmp = operands[1]; - operands[1] = operands[3]; - operands[3] = tmp; + std::swap (operands[0], operands[2]); + std::swap (operands[1], operands[3]); } }) @@ -149,18 +129,14 @@ [(parallel [(set (match_dup 0) (zero_extend:DI (match_dup 1))) (set (match_dup 2) (zero_extend:DI (match_dup 3)))])] { - rtx base, offset_1, offset_2, tmp; + rtx base, offset_1, offset_2; extract_base_offset_in_addr (operands[1], &base, &offset_1); extract_base_offset_in_addr (operands[3], &base, &offset_2); if (INTVAL (offset_1) > INTVAL (offset_2)) { - tmp = operands[0]; - operands[0] = operands[2]; - operands[2] = tmp; - tmp = operands[1]; - operands[1] = operands[3]; - operands[3] = tmp; + std::swap (operands[0], operands[2]); + std::swap (operands[1], operands[3]); } }) @@ -183,24 +159,16 @@ "aarch64_operands_adjust_ok_for_ldpstp (operands, true, mode)" [(const_int 0)] { - rtx base, offset_1, offset_2, tmp; + rtx base, offset_1, offset_2; extract_base_offset_in_addr (operands[1], &base, &offset_1); extract_base_offset_in_addr (operands[3], &base, &offset_2); if (INTVAL (offset_1) > INTVAL (offset_2)) { - tmp = operands[0]; - operands[0] = operands[6]; - operands[6] = tmp; - tmp = operands[1]; - operands[1] = operands[7]; - operands[7] = tmp; - tmp = operands[2]; - operands[2] = operands[4]; - operands[4] = tmp; - tmp = operands[3]; - operands[3] = operands[5]; - operands[5] = tmp; + std::swap (operands[0], operands[6]); + std::swap (operands[1], operands[7]); + std::swap (operands[2], operands[4]); + std::swap (operands[3], operands[5]); } if (aarch64_gen_adjusted_ldpstp (operands, true, mode, UNKNOWN)) @@ -223,24 +191,16 @@ "aarch64_operands_adjust_ok_for_ldpstp (operands, true, mode)" [(const_int 0)] { - rtx base, offset_1, offset_2, tmp; + rtx base, offset_1, offset_2; extract_base_offset_in_addr (operands[1], &base, &offset_1); extract_base_offset_in_addr (operands[3], &base, &offset_2); if (INTVAL (offset_1) > INTVAL (offset_2)) { - tmp = operands[0]; - operands[0] = operands[6]; - operands[6] = tmp; - tmp = operands[1]; - operands[1] = operands[7]; - operands[7] = tmp; - tmp = operands[2]; - operands[2] = operands[4]; - operands[4] = tmp; - tmp = operands[3]; - operands[3] = operands[5]; - operands[5] = tmp; + std::swap (operands[0], operands[6]); + std::swap (operands[1], operands[7]); + std::swap (operands[2], operands[4]); + std::swap (operands[3], operands[5]); } if (aarch64_gen_adjusted_ldpstp (operands, true, mode, UNKNOWN)) @@ -263,24 +223,16 @@ "aarch64_operands_adjust_ok_for_ldpstp (operands, true, SImode)" [(const_int 0)] { - rtx base, offset_1, offset_2, tmp; + rtx base, offset_1, offset_2; extract_base_offset_in_addr (operands[1], &base, &offset_1); extract_base_offset_in_addr (operands[3], &base, &offset_2); if (INTVAL (offset_1) > INTVAL (offset_2)) { - tmp = operands[0]; - operands[0] = operands[6]; - operands[6] = tmp; - tmp = operands[1]; - operands[1] = operands[7]; - operands[7] = tmp; - tmp = operands[2]; - operands[2] = operands[4]; - operands[4] = tmp; - tmp = operands[3]; - operands[3] = operands[5]; - operands[5] = tmp; + std::swap (operands[0], operands[6]); + std::swap (operands[1], operands[7]); + std::swap (operands[2], operands[4]); + std::swap (operands[3], operands[5]); } if (aarch64_gen_adjusted_ldpstp (operands, true, SImode, SIGN_EXTEND)) @@ -303,24 +255,16 @@ "aarch64_operands_adjust_ok_for_ldpstp (operands, true, SImode)" [(const_int 0)] { - rtx base, offset_1, offset_2, tmp; + rtx base, offset_1, offset_2; extract_base_offset_in_addr (operands[1], &base, &offset_1); extract_base_offset_in_addr (operands[3], &base, &offset_2); if (INTVAL (offset_1) > INTVAL (offset_2)) { - tmp = operands[0]; - operands[0] = operands[6]; - operands[6] = tmp; - tmp = operands[1]; - operands[1] = operands[7]; - operands[7] = tmp; - tmp = operands[2]; - operands[2] = operands[4]; - operands[4] = tmp; - tmp = operands[3]; - operands[3] = operands[5]; - operands[5] = tmp; + std::swap (operands[0], operands[6]); + std::swap (operands[1], operands[7]); + std::swap (operands[2], operands[4]); + std::swap (operands[3], operands[5]); } if (aarch64_gen_adjusted_ldpstp (operands, true, SImode, ZERO_EXTEND)) @@ -343,24 +287,16 @@ "aarch64_operands_adjust_ok_for_ldpstp (operands, false, mode)" [(const_int 0)] { - rtx base, offset_1, offset_2, tmp; + rtx base, offset_1, offset_2; extract_base_offset_in_addr (operands[0], &base, &offset_1); extract_base_offset_in_addr (operands[2], &base, &offset_2); if (INTVAL (offset_1) > INTVAL (offset_2)) { - tmp = operands[0]; - operands[0] = operands[6]; - operands[6] = tmp; - tmp = operands[1]; - operands[1] = operands[7]; - operands[7] = tmp; - tmp = operands[2]; - operands[2] = operands[4]; - operands[4] = tmp; - tmp = operands[3]; - operands[3] = operands[5]; - operands[5] = tmp; + std::swap (operands[0], operands[6]); + std::swap (operands[1], operands[7]); + std::swap (operands[2], operands[4]); + std::swap (operands[3], operands[5]); } if (aarch64_gen_adjusted_ldpstp (operands, false, mode, UNKNOWN)) @@ -383,24 +319,16 @@ "aarch64_operands_adjust_ok_for_ldpstp (operands, false, mode)" [(const_int 0)] { - rtx base, offset_1, offset_2, tmp; + rtx base, offset_1, offset_2; extract_base_offset_in_addr (operands[0], &base, &offset_1); extract_base_offset_in_addr (operands[2], &base, &offset_2); if (INTVAL (offset_1) > INTVAL (offset_2)) { - tmp = operands[0]; - operands[0] = operands[6]; - operands[6] = tmp; - tmp = operands[1]; - operands[1] = operands[7]; - operands[7] = tmp; - tmp = operands[2]; - operands[2] = operands[4]; - operands[4] = tmp; - tmp = operands[3]; - operands[3] = operands[5]; - operands[5] = tmp; + std::swap (operands[0], operands[6]); + std::swap (operands[1], operands[7]); + std::swap (operands[2], operands[4]); + std::swap (operands[3], operands[5]); } if (aarch64_gen_adjusted_ldpstp (operands, false, mode, UNKNOWN)) -- 2.30.2