From 4173ddafe21fd49f78a69bc94f0ba4ccde118685 Mon Sep 17 00:00:00 2001 From: Segher Boessenkool Date: Fri, 24 Feb 2017 23:20:14 +0100 Subject: [PATCH] arc: Fixes for RTL checking * config/arc/arc.c (arc_ccfsm_advance): Only take the PATTERN of this_insn if it is an INSN or JUMP_INSN. (force_offsettable): Look at base, not at addr. * config/arc/predicates.md (brcc_nolimm_operator): Don't call INTVAL on things that aren' necessarily CONST_INTs. From-SVN: r245720 --- gcc/ChangeLog | 8 ++++++++ gcc/config/arc/arc.c | 8 +++++--- gcc/config/arc/predicates.md | 2 ++ 3 files changed, 15 insertions(+), 3 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 5e65244458e..d8766e27727 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,11 @@ +2017-02-24 Segher Boessenkool + + * config/arc/arc.c (arc_ccfsm_advance): Only take the PATTERN of + this_insn if it is an INSN or JUMP_INSN. + (force_offsettable): Look at base, not at addr. + * config/arc/predicates.md (brcc_nolimm_operator): Don't call INTVAL + on things that aren't necessarily CONST_INTs. + 2017-02-24 Uros Bizjak * doc/invoke.texi (x86 Options, -mfpmath=sse): Mention that diff --git a/gcc/config/arc/arc.c b/gcc/config/arc/arc.c index 8a838f93c0b..4c99f1ddcaf 100644 --- a/gcc/config/arc/arc.c +++ b/gcc/config/arc/arc.c @@ -3832,8 +3832,6 @@ arc_ccfsm_advance (rtx_insn *insn, struct arc_ccfsm *state) break; } - scanbody = PATTERN (this_insn); - switch (GET_CODE (this_insn)) { case CODE_LABEL: @@ -3868,6 +3866,8 @@ arc_ccfsm_advance (rtx_insn *insn, struct arc_ccfsm *state) break; case JUMP_INSN: + scanbody = PATTERN (this_insn); + /* If this is an unconditional branch to the same label, succeed. If it is to another label, do nothing. If it is conditional, fail. */ @@ -3902,6 +3902,8 @@ arc_ccfsm_advance (rtx_insn *insn, struct arc_ccfsm *state) break; case INSN: + scanbody = PATTERN (this_insn); + /* We can only do this with insns that can use the condition codes (and don't set them). */ if (GET_CODE (scanbody) == SET @@ -7401,7 +7403,7 @@ force_offsettable (rtx addr, HOST_WIDE_INT size, bool reuse) } if (!REG_P (base) || (REGNO (base) != STACK_POINTER_REGNUM - && REGNO_PTR_FRAME_P (REGNO (addr))) + && REGNO_PTR_FRAME_P (REGNO (base))) || !CONST_INT_P (offs) || !SMALL_INT (INTVAL (offs)) || !SMALL_INT (INTVAL (offs) + size)) { diff --git a/gcc/config/arc/predicates.md b/gcc/config/arc/predicates.md index 159a6b4a433..0dec736be5f 100644 --- a/gcc/config/arc/predicates.md +++ b/gcc/config/arc/predicates.md @@ -458,8 +458,10 @@ (define_predicate "brcc_nolimm_operator" (ior (match_test "REG_P (XEXP (op, 1))") (and (match_code "eq, ne, lt, ge, ltu, geu") + (match_test "CONST_INT_P (XEXP (op, 1))") (match_test "u6_immediate_operand (XEXP (op, 1), SImode)")) (and (match_code "le, gt, leu, gtu") + (match_test "CONST_INT_P (XEXP (op, 1))") (match_test "UNSIGNED_INT6 (INTVAL (XEXP (op, 1)) + 1)")))) ;; Return TRUE if this is the condition code register, if we aren't given -- 2.30.2