+2017-06-05 Kyrylo Tkachov <kyrylo.tkachov@arm.com>
+
+ * config/aarch64/aarch64.md (sub<mode>3_compare1_imm): New define_insn.
+ (peephole2): New peephole2 to emit the above.
+ * config/aarch64/predicates.md (aarch64_sub_immediate): New predicate.
+
2017-06-05 Kyrylo Tkachov <kyrylo.tkachov@arm.com>
* config/aarch64/aarch64.c (define_peephole2 above
[(set_attr "type" "alus_sreg")]
)
+(define_insn "sub<mode>3_compare1_imm"
+ [(set (reg:CC CC_REGNUM)
+ (compare:CC
+ (match_operand:GPI 1 "register_operand" "r")
+ (match_operand:GPI 3 "const_int_operand" "n")))
+ (set (match_operand:GPI 0 "register_operand" "=r")
+ (plus:GPI (match_dup 1)
+ (match_operand:GPI 2 "aarch64_sub_immediate" "J")))]
+ "INTVAL (operands[3]) == -INTVAL (operands[2])"
+ "subs\\t%<w>0, %<w>1, #%n2"
+ [(set_attr "type" "alus_sreg")]
+)
+
(define_peephole2
[(set (match_operand:GPI 0 "register_operand")
(minus:GPI (match_operand:GPI 1 "aarch64_reg_or_zero")
}
)
+(define_peephole2
+ [(set (match_operand:GPI 0 "register_operand")
+ (plus:GPI (match_operand:GPI 1 "register_operand")
+ (match_operand:GPI 2 "aarch64_sub_immediate")))
+ (set (reg:CC CC_REGNUM)
+ (compare:CC
+ (match_dup 1)
+ (match_operand:GPI 3 "const_int_operand")))]
+ "!reg_overlap_mentioned_p (operands[0], operands[1])
+ && INTVAL (operands[3]) == -INTVAL (operands[2])"
+ [(const_int 0)]
+ {
+ emit_insn (gen_sub<mode>3_compare1_imm (operands[0], operands[1],
+ operands[2], operands[3]));
+ DONE;
+ }
+)
+
(define_insn "*sub_<shift>_<mode>"
[(set (match_operand:GPI 0 "register_operand" "=r")
(minus:GPI (match_operand:GPI 3 "register_operand" "r")
(define_predicate "aarch64_fp_vec_pow2"
(match_test "aarch64_vec_fpconst_pow_of_2 (op) > 0"))
+(define_predicate "aarch64_sub_immediate"
+ (and (match_code "const_int")
+ (match_test "aarch64_uimm12_shift (-INTVAL (op))")))
+
(define_predicate "aarch64_plus_immediate"
(and (match_code "const_int")
(ior (match_test "aarch64_uimm12_shift (INTVAL (op))")