diff options
author | Juzhe-Zhong <juzhe.zhong@rivai.ai> | 2023-08-24 10:08:36 +0800 |
---|---|---|
committer | Pan Li <pan2.li@intel.com> | 2023-08-24 17:02:28 +0800 |
commit | a28d4fce8ec2540259a257149de7081f27fb027e (patch) | |
tree | 4b51a04be4707ab994c4026e3aacdbd1276f2654 /gcc/c/c-lang.h | |
parent | 7b67cab154d4b5ec2a6bb62755da31cefbe63536 (diff) | |
download | gcc-a28d4fce8ec2540259a257149de7081f27fb027e.zip gcc-a28d4fce8ec2540259a257149de7081f27fb027e.tar.gz gcc-a28d4fce8ec2540259a257149de7081f27fb027e.tar.bz2 |
VECT: Apply LEN_FOLD_EXTRACT_LAST into loop vectorizer
Hi.
This patch is apply LEN_FOLD_EXTRACT_LAST into loop vectorizer.
Consider this following case:
/* Simple condition reduction. */
int __attribute__ ((noinline, noclone))
condition_reduction (int *a, int min_v)
{
int last = 66; /* High start value. */
for (int i = 0; i < N; i++)
if (a[i] < min_v)
last = i;
return last;
}
With this patch, we can generate this following IR:
_44 = .SELECT_VL (ivtmp_42, POLY_INT_CST [4, 4]);
_34 = vect_vec_iv_.5_33 + { POLY_INT_CST [4, 4], ... };
ivtmp_36 = _44 * 4;
vect__4.8_39 = .MASK_LEN_LOAD (vectp_a.6_37, 32B, { -1, ... }, _44, 0);
mask__11.9_41 = vect__4.8_39 < vect_cst__40;
last_5 = .LEN_FOLD_EXTRACT_LAST (last_14, mask__11.9_41, vect_vec_iv_.5_33, _44, 0);
...
gcc/ChangeLog:
* tree-vect-loop.cc (vectorizable_reduction): Apply
LEN_FOLD_EXTRACT_LAST.
* tree-vect-stmts.cc (vectorizable_condition): Ditto.
Diffstat (limited to 'gcc/c/c-lang.h')
0 files changed, 0 insertions, 0 deletions