From d9937da063e5847f45f7f1f7a02bed7dbc8fb2f6 Mon Sep 17 00:00:00 2001 From: Prathamesh Kulkarni Date: Wed, 5 May 2021 21:11:45 +0530 Subject: [PATCH] arm/97903: Missed optimization in lowering test operation. gcc/ChangeLog: 2021-05-05 Prathamesh Kulkarni * config/arm/neon.md (neon_vtst_combine): New pattern. * config/arm/predicates.md (minus_one_operand): New predicate. --- gcc/config/arm/neon.md | 13 +++++++++++++ gcc/config/arm/predicates.md | 4 ++++ 2 files changed, 17 insertions(+) diff --git a/gcc/config/arm/neon.md b/gcc/config/arm/neon.md index fec2cc9..2a1e304 100644 --- a/gcc/config/arm/neon.md +++ b/gcc/config/arm/neon.md @@ -2588,6 +2588,19 @@ [(set_attr "type" "neon_tst")] ) +(define_insn "neon_vtst_combine" + [(set (match_operand:VDQIW 0 "s_register_operand" "=w") + (plus:VDQIW + (eq:VDQIW + (and:VDQIW (match_operand:VDQIW 1 "s_register_operand" "w") + (match_operand:VDQIW 2 "s_register_operand" "w")) + (match_operand:VDQIW 3 "zero_operand" "i")) + (match_operand:VDQIW 4 "minus_one_operand" "i")))] + "TARGET_NEON" + "vtst.\t%0, %1, %2" + [(set_attr "type" "neon_tst")] +) + (define_insn "neon_vabd" [(set (match_operand:VDQIW 0 "s_register_operand" "=w") (unspec:VDQIW [(match_operand:VDQIW 1 "s_register_operand" "w") diff --git a/gcc/config/arm/predicates.md b/gcc/config/arm/predicates.md index c661f01..9db061d 100644 --- a/gcc/config/arm/predicates.md +++ b/gcc/config/arm/predicates.md @@ -200,6 +200,10 @@ (and (match_code "const_int,const_double,const_vector") (match_test "op == CONST0_RTX (mode)"))) +(define_predicate "minus_one_operand" + (and (match_code "const_int,const_double,const_vector") + (match_test "op == CONSTM1_RTX (mode)"))) + ;; Match a register, or zero in the appropriate mode. (define_predicate "reg_or_zero_operand" (ior (match_operand 0 "s_register_operand") -- 2.7.4