diff options
author | Pan Li <pan2.li@intel.com> | 2024-06-27 09:28:04 +0800 |
---|---|---|
committer | Pan Li <pan2.li@intel.com> | 2024-06-27 14:12:27 +0800 |
commit | f2476a2649e9975d454d179145574c21d8218aee (patch) | |
tree | 92079234d88d5b26cffbddf4e3f123fa6142162c /gcc/tree-vectorizer.h | |
parent | c7cb0dd94589ab501bca27f93641b4074e5a2e99 (diff) | |
download | gcc-f2476a2649e9975d454d179145574c21d8218aee.zip gcc-f2476a2649e9975d454d179145574c21d8218aee.tar.gz gcc-f2476a2649e9975d454d179145574c21d8218aee.tar.bz2 |
Vect: Support truncate after .SAT_SUB pattern in zip
The zip benchmark of coremark-pro have one SAT_SUB like pattern but
truncated as below:
void test (uint16_t *x, unsigned b, unsigned n)
{
unsigned a = 0;
register uint16_t *p = x;
do {
a = *--p;
*p = (uint16_t)(a >= b ? a - b : 0); // Truncate after .SAT_SUB
} while (--n);
}
It will have gimple before vect pass, it cannot hit any pattern of
SAT_SUB and then cannot vectorize to SAT_SUB.
_2 = a_11 - b_12(D);
iftmp.0_13 = (short unsigned int) _2;
_18 = a_11 >= b_12(D);
iftmp.0_5 = _18 ? iftmp.0_13 : 0;
This patch would like to improve the pattern match to recog above
as truncate after .SAT_SUB pattern. Then we will have the pattern
similar to below, as well as eliminate the first 3 dead stmt.
_2 = a_11 - b_12(D);
iftmp.0_13 = (short unsigned int) _2;
_18 = a_11 >= b_12(D);
iftmp.0_5 = (short unsigned int).SAT_SUB (a_11, b_12(D));
The below tests are passed for this patch.
1. The rv64gcv fully regression tests.
2. The rv64gcv build with glibc.
3. The x86 bootstrap tests.
4. The x86 fully regression tests.
gcc/ChangeLog:
* match.pd: Add convert description for minus and capture.
* tree-vect-patterns.cc (vect_recog_build_binary_gimple_call): Add
new logic to handle in_type is incompatibile with out_type, as
well as rename from.
(vect_recog_build_binary_gimple_stmt): Rename to.
(vect_recog_sat_add_pattern): Leverage above renamed func.
(vect_recog_sat_sub_pattern): Ditto.
Signed-off-by: Pan Li <pan2.li@intel.com>
Diffstat (limited to 'gcc/tree-vectorizer.h')
0 files changed, 0 insertions, 0 deletions