diff options
Diffstat (limited to '0046-Add-new-pattern-to-pass-the-maxmin-tests.patch')
-rw-r--r-- | 0046-Add-new-pattern-to-pass-the-maxmin-tests.patch | 65 |
1 files changed, 65 insertions, 0 deletions
diff --git a/0046-Add-new-pattern-to-pass-the-maxmin-tests.patch b/0046-Add-new-pattern-to-pass-the-maxmin-tests.patch new file mode 100644 index 0000000..9ceba88 --- /dev/null +++ b/0046-Add-new-pattern-to-pass-the-maxmin-tests.patch @@ -0,0 +1,65 @@ +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 + |