summaryrefslogtreecommitdiff
path: root/gcc/ccmp.c
diff options
context:
space:
mode:
authorWilco Dijkstra <wdijkstr@arm.com>2016-01-19 13:59:56 +0000
committerJiong Wang <jiwang@gcc.gnu.org>2016-01-19 13:59:56 +0000
commitc8012fbce973bebc5cf2a9905ebfa9fbaec1afa0 (patch)
tree40411588caf22f22a87c45f55d64e7352997b459 /gcc/ccmp.c
parent756f4e9049bb7739624a8ad7b2ff36f151a7a983 (diff)
downloadgcc-c8012fbce973bebc5cf2a9905ebfa9fbaec1afa0.tar.gz
[Patch 1/4] Simplify the representation of CCMP patterns by using
2015-01-19 Wilco Dijkstra <wdijkstr@arm.com> gcc/ * target.def (gen_ccmp_first): Update documentation. (gen_ccmp_next): Likewise. * doc/tm.texi (gen_ccmp_first): Update documentation. (gen_ccmp_next): Likewise. * ccmp.c (expand_ccmp_expr): Extract cmp_code from return value of expand_ccmp_expr_1. Improve comments. * config/aarch64/aarch64.md (ccmp_and): Use if_then_else for ccmp. (ccmp_ior<mode>): Remove pattern. (cmp<mode>): Remove expand. (cmp): Globalize pattern. (cstorecc4): Use cc_register. (mov<mode>cc): Remove ccmp_cc_register check. * config/aarch64/aarch64.c (aarch64_get_condition_code_1): Simplify after removal of CC_DNE/* modes. (aarch64_ccmp_mode_to_code): Remove. (aarch64_print_operand): Remove 'K' case. Merge 'm' and 'M' cases. In 'k' case use integer as condition. (aarch64_nzcv_codes): Remove inverted cases. (aarch64_code_to_ccmode): Remove. (aarch64_gen_ccmp_first): Use cmp pattern directly. Return the correct comparison with CC register to be used in folowing CCMP/branch/CSEL. (aarch64_gen_ccmp_next): Use previous comparison and mode in CCMP pattern. Return the comparison with CC register. Invert conditions when bitcode is OR. * config/aarch64/aarch64-modes.def: Remove CC_DNE/* modes. * config/aarch64/predicates.md (ccmp_cc_register): Remove. From-SVN: r232561
Diffstat (limited to 'gcc/ccmp.c')
-rw-r--r--gcc/ccmp.c21
1 files changed, 14 insertions, 7 deletions
diff --git a/gcc/ccmp.c b/gcc/ccmp.c
index 72f2db1d62e..28fe189c67f 100644
--- a/gcc/ccmp.c
+++ b/gcc/ccmp.c
@@ -49,6 +49,10 @@ along with GCC; see the file COPYING3. If not see
- gen_ccmp_first expands the first compare in CCMP.
- gen_ccmp_next expands the following compares.
+ Both hooks return a comparison with the CC register that is equivalent
+ to the value of the gimple comparison. This is used by the next CCMP
+ and in the final conditional store.
+
* We use cstorecc4 pattern to convert the CCmode intermediate to
the integer mode result that expand_normal is expecting.
@@ -114,10 +118,12 @@ ccmp_candidate_p (gimple *g)
return false;
}
-/* PREV is the CC flag from precvious compares. The function expands the
- next compare based on G which ops previous compare with CODE.
+/* PREV is a comparison with the CC register which represents the
+ result of the previous CMP or CCMP. The function expands the
+ next compare based on G which is ANDed/ORed with the previous
+ compare depending on CODE.
PREP_SEQ returns all insns to prepare opearands for compare.
- GEN_SEQ returnss all compare insns. */
+ GEN_SEQ returns all compare insns. */
static rtx
expand_ccmp_next (gimple *g, enum tree_code code, rtx prev,
rtx *prep_seq, rtx *gen_seq)
@@ -210,7 +216,7 @@ expand_ccmp_expr_1 (gimple *g, rtx *prep_seq, rtx *gen_seq)
return NULL_RTX;
}
-/* Main entry to expand conditional compare statement G.
+/* Main entry to expand conditional compare statement G.
Return NULL_RTX if G is not a legal candidate or expand fail.
Otherwise return the target. */
rtx
@@ -233,9 +239,10 @@ expand_ccmp_expr (gimple *g)
enum insn_code icode;
enum machine_mode cc_mode = CCmode;
tree lhs = gimple_assign_lhs (g);
+ rtx_code cmp_code = GET_CODE (tmp);
#ifdef SELECT_CC_MODE
- cc_mode = SELECT_CC_MODE (NE, tmp, const0_rtx);
+ cc_mode = SELECT_CC_MODE (cmp_code, XEXP (tmp, 0), const0_rtx);
#endif
icode = optab_handler (cstore_optab, cc_mode);
if (icode != CODE_FOR_nothing)
@@ -246,8 +253,8 @@ expand_ccmp_expr (gimple *g)
emit_insn (prep_seq);
emit_insn (gen_seq);
- tmp = emit_cstore (target, icode, NE, cc_mode, cc_mode,
- 0, tmp, const0_rtx, 1, mode);
+ tmp = emit_cstore (target, icode, cmp_code, cc_mode, cc_mode,
+ 0, XEXP (tmp, 0), const0_rtx, 1, mode);
if (tmp)
return tmp;
}