The patterns neg_scc_insn and not_scc_insn are not correct, leading to failing pr77309 test for ARC700. Add two new bic compare with zero patterns to improve output code.
gcc/ xxxx-xx-xx Claudiu Zissulescu <claz...@synopsys.com> * config/arc/arc.md (bic_f): Use cc_set_register predicate. (bic_cmp0_noout): New pattern. (bic_cmp0): Likewise. (neg_scc_insn): Remove pattern. (not_scc_insn): Likewise. --- gcc/config/arc/arc.md | 52 ++++++++++++++++++++++++------------------- 1 file changed, 29 insertions(+), 23 deletions(-) diff --git a/gcc/config/arc/arc.md b/gcc/config/arc/arc.md index 7da52199415..d2b7a45b6e6 100644 --- a/gcc/config/arc/arc.md +++ b/gcc/config/arc/arc.md @@ -1272,7 +1272,7 @@ archs4x, archs4xd" "") (define_insn "*bic_f" - [(set (match_operand 3 "cc_register" "=Rcc,Rcc,Rcc") + [(set (match_operand 3 "cc_set_register" "") (match_operator 4 "zn_compare_operator" [(and:SI (match_operand:SI 1 "register_operand" "c,0,c") (not:SI @@ -1286,6 +1286,34 @@ archs4x, archs4xd" (set_attr "cond" "set_zn,set_zn,set_zn") (set_attr "length" "4,4,8")]) +(define_insn "*bic_cmp0_noout" + [(set (match_operand 0 "cc_set_register" "") + (compare:CC_ZN + (and:SI (not:SI (match_operand:SI 1 "nonmemory_operand" "Lr,Cal,r")) + (match_operand:SI 2 "nonmemory_operand" "r,r,Cal")) + (const_int 0)))] + "register_operand (operands[1], SImode) + || register_operand (operands[2], SImode)" + "bic.f\\t0,%2,%1" + [(set_attr "type" "unary") + (set_attr "cond" "set_zn") + (set_attr "length" "4,8,8")]) + +(define_insn "*bic_cmp0" + [(set (match_operand 0 "cc_set_register" "") + (compare:CC_ZN + (and:SI (not:SI (match_operand:SI 1 "nonmemory_operand" "Lr,Cal,r")) + (match_operand:SI 2 "nonmemory_operand" "r,r,Cal")) + (const_int 0))) + (set (match_operand:SI 3 "register_operand" "=r,r,r") + (and:SI (not:SI (match_dup 1)) (match_dup 2)))] + "register_operand (operands[1], SImode) + || register_operand (operands[2], SImode)" + "bic.f\\t%3,%2,%1" + [(set_attr "type" "unary") + (set_attr "cond" "set_zn") + (set_attr "length" "4,8,8")]) + (define_expand "movdi" [(set (match_operand:DI 0 "move_dest_operand" "") (match_operand:DI 1 "general_operand" ""))] @@ -3763,28 +3791,6 @@ archs4x, archs4xd" } [(set_attr "type" "unary")]) -;; ??? At least for ARC600, we should use sbc b,b,s12 if we want a value -;; that is one lower if the carry flag is set. - -;; ??? Look up negscc insn. See pa.md for example. -(define_insn "*neg_scc_insn" - [(set (match_operand:SI 0 "dest_reg_operand" "=w") - (neg:SI (match_operator:SI 1 "proper_comparison_operator" - [(reg CC_REG) (const_int 0)])))] - "" - "mov %0,-1\;sub.%D1 %0,%0,%0" - [(set_attr "type" "unary") - (set_attr "length" "8")]) - -(define_insn "*not_scc_insn" - [(set (match_operand:SI 0 "dest_reg_operand" "=w") - (not:SI (match_operator:SI 1 "proper_comparison_operator" - [(reg CC_REG) (const_int 0)])))] - "" - "mov %0,1\;sub.%d1 %0,%0,%0" - [(set_attr "type" "unary") - (set_attr "length" "8")]) - ; cond_exec patterns (define_insn "*movsi_ne" [(cond_exec -- 2.23.0