diff options
author | Juzhe-Zhong <juzhe.zhong@rivai.ai> | 2023-08-22 18:51:37 +0800 |
---|---|---|
committer | Pan Li <pan2.li@intel.com> | 2023-08-22 22:10:25 +0800 |
commit | f4658e025424ac281dd8b7e61f798f435dbf1cab (patch) | |
tree | 6df89fa7bf24c43ed51abd0478c0657f0082a76e /gcc/optabs.def | |
parent | 2c27600fa79431576f47d55b9ed7b2f4790def67 (diff) | |
download | gcc-f4658e025424ac281dd8b7e61f798f435dbf1cab.zip gcc-f4658e025424ac281dd8b7e61f798f435dbf1cab.tar.gz gcc-f4658e025424ac281dd8b7e61f798f435dbf1cab.tar.bz2 |
VECT: Add LEN_FOLD_EXTRACT_LAST pattern
Hi, Richard and Richi.
This is the last autovec pattern I want to add for RVV (length loop control).
This patch is supposed to handled this following case:
int __attribute__ ((noinline, noclone))
condition_reduction (int *a, int min_v, int n)
{
int last = 66; /* High start value. */
for (int i = 0; i < n; i++)
if (a[i] < min_v)
last = i;
return last;
}
ARM SVE IR:
...
mask__7.11_39 = vect__4.10_37 < vect_cst__38;
_40 = loop_mask_36 & mask__7.11_39;
last_5 = .FOLD_EXTRACT_LAST (last_15, _40, vect_vec_iv_.7_32);
...
RVV IR, we want to see:
...
loop_len = SELECT_VL
mask__7.11_39 = vect__4.10_37 < vect_cst__38;
last_5 = .LEN_FOLD_EXTRACT_LAST (last_15, _40, vect_vec_iv_.7_32, loop_len, bias);
...
gcc/ChangeLog:
* doc/md.texi: Add LEN_FOLD_EXTRACT_LAST pattern.
* internal-fn.cc (fold_len_extract_direct): Ditto.
(expand_fold_len_extract_optab_fn): Ditto.
(direct_fold_len_extract_optab_supported_p): Ditto.
* internal-fn.def (LEN_FOLD_EXTRACT_LAST): Ditto.
* optabs.def (OPTAB_D): Ditto.
Diffstat (limited to 'gcc/optabs.def')
-rw-r--r-- | gcc/optabs.def | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/gcc/optabs.def b/gcc/optabs.def index e216572..2ccbe41 100644 --- a/gcc/optabs.def +++ b/gcc/optabs.def @@ -393,6 +393,7 @@ OPTAB_D (mask_len_fold_left_plus_optab, "mask_len_fold_left_plus_$a") OPTAB_D (extract_last_optab, "extract_last_$a") OPTAB_D (fold_extract_last_optab, "fold_extract_last_$a") +OPTAB_D (len_fold_extract_last_optab, "len_fold_extract_last_$a") OPTAB_D (uabd_optab, "uabd$a3") OPTAB_D (sabd_optab, "sabd$a3") |