aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFelix Yang <felix.yang@huawei.com>2014-11-18 14:45:09 +0000
committerFei Yang <fyang@gcc.gnu.org>2014-11-18 14:45:09 +0000
commit594bdd53d8f24ad406af1aa192d98d23bc841ae9 (patch)
tree2cfeccc460234f0fbe5b3157201045bf61d38971
parentef768ba35319435af3fcf4171253dd32a6ecc322 (diff)
downloadgcc-594bdd53d8f24ad406af1aa192d98d23bc841ae9.zip
gcc-594bdd53d8f24ad406af1aa192d98d23bc841ae9.tar.gz
gcc-594bdd53d8f24ad406af1aa192d98d23bc841ae9.tar.bz2
aarch64.c (doloop_end): New pattern.
* config/aarch64/aarch64.c (doloop_end): New pattern. * config/aarch64/aarch64.md (TARGET_CAN_USE_DOLOOP_P): Implement. From-SVN: r217717
-rw-r--r--gcc/ChangeLog5
-rw-r--r--gcc/config/aarch64/aarch64.c3
-rw-r--r--gcc/config/aarch64/aarch64.md37
3 files changed, 45 insertions, 0 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 66a2fd3..b8f9bd4 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,8 @@
+2014-11-18 Felix Yang <felix.yang@huawei.com>
+
+ * config/aarch64/aarch64.c (doloop_end): New pattern.
+ * config/aarch64/aarch64.md (TARGET_CAN_USE_DOLOOP_P): Implement.
+
2014-11-18 Jason Merrill <jason@redhat.com>
* tree.c (warn_deprecated_use): Show declaration with inform.
diff --git a/gcc/config/aarch64/aarch64.c b/gcc/config/aarch64/aarch64.c
index 3548335..4fec21e 100644
--- a/gcc/config/aarch64/aarch64.c
+++ b/gcc/config/aarch64/aarch64.c
@@ -10605,6 +10605,9 @@ aarch64_gen_ccmp_next (rtx prev, int cmp_code, rtx op0, rtx op1, int bit_code)
#define TARGET_USE_BY_PIECES_INFRASTRUCTURE_P \
aarch64_use_by_pieces_infrastructure_p
+#undef TARGET_CAN_USE_DOLOOP_P
+#define TARGET_CAN_USE_DOLOOP_P can_use_doloop_if_innermost
+
struct gcc_target targetm = TARGET_INITIALIZER;
#include "gt-aarch64.h"
diff --git a/gcc/config/aarch64/aarch64.md b/gcc/config/aarch64/aarch64.md
index b9f9a9d..597ff8c 100644
--- a/gcc/config/aarch64/aarch64.md
+++ b/gcc/config/aarch64/aarch64.md
@@ -4169,6 +4169,43 @@
[(set_attr "type" "mrs")])
+;; Define the subtract-one-and-jump insns so loop.c
+;; knows what to generate.
+(define_expand "doloop_end"
+ [(use (match_operand 0 "" "")) ; loop pseudo
+ (use (match_operand 1 "" ""))] ; label
+ "optimize > 0 && flag_modulo_sched"
+{
+ rtx s0;
+ rtx bcomp;
+ rtx loc_ref;
+ rtx cc_reg;
+ rtx insn;
+ rtx cmp;
+
+ /* Currently SMS relies on the do-loop pattern to recognize loops
+ where (1) the control part consists of all insns defining and/or
+ using a certain 'count' register and (2) the loop count can be
+ adjusted by modifying this register prior to the loop.
+ ??? The possible introduction of a new block to initialize the
+ new IV can potentially affect branch optimizations. */
+
+ if (GET_MODE (operands[0]) != DImode)
+ FAIL;
+
+ s0 = operands [0];
+ insn = emit_insn (gen_adddi3_compare0 (s0, s0, GEN_INT (-1)));
+
+ cmp = XVECEXP (PATTERN (insn), 0, 0);
+ cc_reg = SET_DEST (cmp);
+ bcomp = gen_rtx_NE (VOIDmode, cc_reg, const0_rtx);
+ loc_ref = gen_rtx_LABEL_REF (VOIDmode, operands [1]);
+ emit_jump_insn (gen_rtx_SET (VOIDmode, pc_rtx,
+ gen_rtx_IF_THEN_ELSE (VOIDmode, bcomp,
+ loc_ref, pc_rtx)));
+ DONE;
+})
+
;; AdvSIMD Stuff
(include "aarch64-simd.md")