From d9c50233e48becdf628babd0dc03d379b1dec970 Mon Sep 17 00:00:00 2001 From: Claudiu Zissulescu Date: Fri, 22 Nov 2019 09:00:33 +0100 Subject: [PATCH] [ARC] Fix failing pr77309 for ARC700 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 * 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. From-SVN: r278610 --- gcc/ChangeLog | 8 +++++++ gcc/config/arc/arc.md | 52 ++++++++++++++++++++++++------------------- 2 files changed, 37 insertions(+), 23 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 8389a86387d..986324acba3 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,11 @@ +2019-11-22 Claudiu Zissulescu + + * 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. + 2019-11-21 Harald van Dijk * doc/invoke.texi (-fcommon): Remove claim about ISO C. diff --git a/gcc/config/arc/arc.md b/gcc/config/arc/arc.md index 98e96237206..6b4ed0e75de 100644 --- a/gcc/config/arc/arc.md +++ b/gcc/config/arc/arc.md @@ -1263,7 +1263,7 @@ core_3, archs4x, archs4xd, archs4xd_slow" "") (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 @@ -1277,6 +1277,34 @@ core_3, archs4x, archs4xd, archs4xd_slow" (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" ""))] @@ -3762,28 +3790,6 @@ core_3, archs4x, archs4xd, archs4xd_slow" } [(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.30.2