+2013-08-01 Kyrylo Tkachov <kyrylo.tkachov@arm.com>
+
+ * config/arm/arm.md (peepholes for eq (reg1) (reg2/imm)):
+ Generate canonical plus rtx with negated immediate instead of minus
+ where appropriate.
+ * config/arm/arm.c (thumb2_reorg): Handle ADCS <Rd>, <Rn> case.
+
2013-08-01 Jan Hubicka <jh@suse.cz>
* cgraph.c (cgraph_release_function_body): Use used_as_abstract_origin.
&& IN_RANGE (INTVAL (op1), -7, 7))
action = CONV;
}
+ /* ADCS <Rd>, <Rn> */
+ else if (GET_CODE (XEXP (src, 0)) == PLUS
+ && rtx_equal_p (XEXP (XEXP (src, 0), 0), dst)
+ && low_register_operand (XEXP (XEXP (src, 0), 1),
+ SImode)
+ && COMPARISON_P (op1)
+ && cc_register (XEXP (op1, 0), VOIDmode)
+ && maybe_get_arm_condition_code (op1) == ARM_CS
+ && XEXP (op1, 1) == const0_rtx)
+ action = CONV;
break;
case MINUS:
(geu:SI (reg:CC CC_REGNUM) (const_int 0))))]
)
-;; Rd = (eq (reg1) (reg2/imm)) // ARMv5
+;; Rd = (eq (reg1) (reg2/imm)) // ARMv5 and optimising for speed.
;; sub Rd, Reg1, reg2
;; clz Rd, Rd
;; lsr Rd, Rd, #5
(set (match_operand:SI 0 "register_operand" "") (const_int 0)))
(cond_exec (eq (reg:CC CC_REGNUM) (const_int 0))
(set (match_dup 0) (const_int 1)))]
- "arm_arch5 && TARGET_32BIT && peep2_regno_dead_p (3, CC_REGNUM)"
+ "arm_arch5 && TARGET_32BIT && peep2_regno_dead_p (3, CC_REGNUM)
+ && !(TARGET_THUMB2 && optimize_insn_for_size_p ())"
[(set (match_dup 0) (minus:SI (match_dup 1) (match_dup 2)))
(set (match_dup 0) (clz:SI (match_dup 0)))
(set (match_dup 0) (lshiftrt:SI (match_dup 0) (const_int 5)))]
)
-;; Rd = (eq (reg1) (reg2/imm)) // ! ARMv5
+;; Rd = (eq (reg1) (reg2)) // ! ARMv5 or optimising for size.
;; sub T1, Reg1, reg2
;; negs Rd, T1
;; adc Rd, Rd, T1
(set (match_dup 0) (const_int 1)))
(match_scratch:SI 3 "r")]
"TARGET_32BIT && peep2_regno_dead_p (3, CC_REGNUM)"
- [(set (match_dup 3) (minus:SI (match_dup 1) (match_dup 2)))
+ [(set (match_dup 3) (match_dup 4))
(parallel
[(set (reg:CC CC_REGNUM)
(compare:CC (const_int 0) (match_dup 3)))
(set (match_dup 0)
(plus:SI (plus:SI (match_dup 0) (match_dup 3))
(geu:SI (reg:CC CC_REGNUM) (const_int 0))))]
-)
+ "
+ if (CONST_INT_P (operands[2]))
+ operands[4] = plus_constant (SImode, operands[1], -INTVAL (operands[2]));
+ else
+ operands[4] = gen_rtx_MINUS (SImode, operands[1], operands[2]);
+ ")
(define_insn "*cond_move"
[(set (match_operand:SI 0 "s_register_operand" "=r,r,r")