2012-11-12 Ian Bolton <ian.bolton@arm.com>
+ * config/aarch64/aarch64.md (cmov<mode>_insn): Emit CSINC when
+ one of the alternatives is constant 1.
+ * config/aarch64/constraints.md: New constraint.
+ * config/aarch64/predicates.md: Rename predicate
+ aarch64_reg_zero_or_m1 to aarch64_reg_zero_or_m1_or_1.
+
+2012-11-12 Ian Bolton <ian.bolton@arm.com>
+
* config/aarch64/aarch64.md (*compare_neg<mode>): New pattern.
2012-11-12 Tobias Burnus <burnus@net-b.de>
)
(define_insn "*cmov<mode>_insn"
- [(set (match_operand:ALLI 0 "register_operand" "=r,r,r,r")
+ [(set (match_operand:ALLI 0 "register_operand" "=r,r,r,r,r,r,r")
(if_then_else:ALLI
(match_operator 1 "aarch64_comparison_operator"
[(match_operand 2 "cc_register" "") (const_int 0)])
- (match_operand:ALLI 3 "aarch64_reg_zero_or_m1" "rZ,rZ,UsM,UsM")
- (match_operand:ALLI 4 "aarch64_reg_zero_or_m1" "rZ,UsM,rZ,UsM")))]
- ""
- ;; Final alternative should be unreachable, but included for completeness
+ (match_operand:ALLI 3 "aarch64_reg_zero_or_m1_or_1" "rZ,rZ,UsM,rZ,Ui1,UsM,Ui1")
+ (match_operand:ALLI 4 "aarch64_reg_zero_or_m1_or_1" "rZ,UsM,rZ,Ui1,rZ,UsM,Ui1")))]
+ "!((operands[3] == const1_rtx && operands[4] == constm1_rtx)
+ || (operands[3] == constm1_rtx && operands[4] == const1_rtx))"
+ ;; Final two alternatives should be unreachable, but included for completeness
"@
csel\\t%<w>0, %<w>3, %<w>4, %m1
csinv\\t%<w>0, %<w>3, <w>zr, %m1
csinv\\t%<w>0, %<w>4, <w>zr, %M1
- mov\\t%<w>0, -1"
+ csinc\\t%<w>0, %<w>3, <w>zr, %m1
+ csinc\\t%<w>0, %<w>4, <w>zr, %M1
+ mov\\t%<w>0, -1
+ mov\\t%<w>0, 1"
[(set_attr "v8type" "csel")
(set_attr "mode" "<MODE>")]
)
(ior (match_operand 0 "register_operand")
(match_test "op == const0_rtx"))))
-(define_predicate "aarch64_reg_zero_or_m1"
+(define_predicate "aarch64_reg_zero_or_m1_or_1"
(and (match_code "reg,subreg,const_int")
(ior (match_operand 0 "register_operand")
(ior (match_test "op == const0_rtx")
- (match_test "op == constm1_rtx")))))
+ (ior (match_test "op == constm1_rtx")
+ (match_test "op == const1_rtx"))))))
(define_predicate "aarch64_fp_compare_operand"
(ior (match_operand 0 "register_operand")