Whoops, I forgot one.  Here it is.  Joern, please see
<https://gcc.gnu.org/ml/gcc-patches/2017-02/msg01291.html>.


2017-02-21  Segher Boessenkool  <seg...@kernel.crashing.org>

        * 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.

---
 gcc/config/arc/arc.c         | 8 +++++---
 gcc/config/arc/predicates.md | 2 ++
 2 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/gcc/config/arc/arc.c b/gcc/config/arc/arc.c
index 8a838f9..4c99f1d 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 159a6b4..0dec736 100644
--- a/gcc/config/arc/predicates.md
+++ b/gcc/config/arc/predicates.md
@@ -458,8 +458,10 @@ (define_predicate "ge_lt_comparison_operator"
 (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
-- 
1.9.3

Reply via email to