]> git.ipfire.org Git - thirdparty/gcc.git/commit
Handle TYPE_OVERFLOW_UNDEFINED vectorized BB reductions
authorRichard Biener <rguenther@suse.de>
Tue, 15 Aug 2023 13:17:08 +0000 (15:17 +0200)
committerRichard Biener <rguenther@suse.de>
Thu, 17 Aug 2023 11:16:22 +0000 (13:16 +0200)
commit99b5921bfc8f9122fb7ccb0a4284179fd3a2f2ba
treef85a48ef714a413598269c83682a67da1ce7f9f4
parent17d670dbca16d8ccb502c5d82c67981b1ba937af
Handle TYPE_OVERFLOW_UNDEFINED vectorized BB reductions

The following changes the gate to perform vectorization of BB reductions
to use needs_fold_left_reduction_p which in turn requires handling
TYPE_OVERFLOW_UNDEFINED types in the epilogue code generation by
promoting any operations generated there to use unsigned arithmetic.

The following does this, there's currently only v16qi where x86
supports a .REDUC_PLUS reduction for integral modes so I had to
add a x86 specific testcase using GIMPLE IL.

* tree-vect-slp.cc (vect_slp_check_for_roots): Use
!needs_fold_left_reduction_p to decide whether we can
handle the reduction with association.
(vectorize_slp_instance_root_stmt): For TYPE_OVERFLOW_UNDEFINED
reductions perform all arithmetic in an unsigned type.

* gcc.target/i386/vect-reduc-2.c: New testcase.
gcc/testsuite/gcc.target/i386/vect-reduc-2.c [new file with mode: 0644]
gcc/tree-vect-slp.cc