Projects
openEuler:24.03:SP1:Everything
gcc
_service:tar_scm:0046-Add-new-pattern-to-pass-t...
Sign Up
Log In
Username
Password
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File _service:tar_scm:0046-Add-new-pattern-to-pass-the-maxmin-tests.patch of Package gcc
From dbcb2630c426c8dd2117b5ce625da8422dd8cd65 Mon Sep 17 00:00:00 2001 From: Diachkov Ilia <diachkov.ilia1@huawei-partners.com> Date: Thu, 22 Feb 2024 17:20:17 +0800 Subject: [PATCH 14/18] Add new pattern to pass the maxmin tests --- gcc/match.pd | 24 ++++++++++++++++++++++++ gcc/testsuite/gcc.dg/combine-maxmin.c | 2 +- 2 files changed, 25 insertions(+), 1 deletion(-) diff --git a/gcc/match.pd b/gcc/match.pd index 3a19e93b3..aee58e47b 100644 --- a/gcc/match.pd +++ b/gcc/match.pd @@ -8038,6 +8038,10 @@ and, (match (minmax_cmp_arg @0 @1) (bit_and @0 INTEGER_CST@1) (if (wi::popcount (~wi::to_widest (@1) + 1) == 1))) +/* Match ((unsigned) a > 0b0..01..1) pattern. */ +(match (minmax_cmp_arg1 @0 @1) + (gt @0 INTEGER_CST@1) + (if (wi::popcount (wi::to_widest (@1) + 1) == 1))) /* Match (inversed_sign_bit >> sign_bit_pos) pattern. This statement is blocking for the transformation of unsigned integers. @@ -8095,6 +8099,26 @@ and, (convert (min (max @0 { integer_zero_node; }) { mask; }))))) + (simplify + (convert + (cond + (minmax_cmp_arg1 (convert? @0) INTEGER_CST@1) + (convert? (minmax_sat_arg @0)) + (convert? @0))) + (if (wi::geu_p (wi::to_widest (@1) + 1, TYPE_PRECISION (type))) + (with { tree mask = build_int_cst (integer_type_node, tree_to_shwi (@1)); } + (convert (min (max (convert:integer_type_node @0) { integer_zero_node; }) + { mask; }))))) + (simplify + (cond + (minmax_cmp_arg1 (convert? @0) INTEGER_CST@1) + (convert? (minmax_sat_arg @0)) + (convert? @0)) + (if (wi::geu_p (wi::to_widest (@1) + 1, TYPE_PRECISION (type))) + (with { tree mask = build_int_cst (integer_type_node, tree_to_shwi (@1)); } + (convert (min (max (convert:integer_type_node @0) { integer_zero_node; }) + { mask; }))))) + /* Truncation via bit_and with mask. Same concerns on convert? here. */ (simplify (convert diff --git a/gcc/testsuite/gcc.dg/combine-maxmin.c b/gcc/testsuite/gcc.dg/combine-maxmin.c index a984fa560..5c0c9cc49 100755 --- a/gcc/testsuite/gcc.dg/combine-maxmin.c +++ b/gcc/testsuite/gcc.dg/combine-maxmin.c @@ -52,4 +52,4 @@ void hf (uint8_t *dsth, uint8_t *dstv, uint8_t *dstc, uint8_t *src, /* { dg-final { scan-assembler-times {[us]min\t} 6 } } */ /* All of the vectorized patterns are expected to be matched. */ /* { dg-final { scan-assembler-not {cmtst\t} } } */ -/* { dg-final { scan-assembler-times {uzp1\t} 5 } } */ +/* { dg-final { scan-assembler-times {uzp1\t} 2 } } */ -- 2.33.0
Locations
Projects
Search
Status Monitor
Help
Open Build Service
OBS Manuals
API Documentation
OBS Portal
Reporting a Bug
Contact
Mailing List
Forums
Chat (IRC)
Twitter
Open Build Service (OBS)
is an
openSUSE project
.
浙ICP备2022010568号-2