This patch folds the SVE intrinsic svdiv into a vector of 1's in case
1) the predicate is svptrue and
2) dividend and divisor are equal.
This is implemented in the gimple_folder for signed and unsigned
integers. Corresponding test cases were added to the existing test
suites.

The patch was bootstrapped and regtested on aarch64-linux-gnu, no regression.
OK for mainline?

Please also advise whether it makes sense to implement the same optimization
for float types and if so, under which conditions?

Signed-off-by: Jennifer Schmitz <jschm...@nvidia.com>

gcc/

        * config/aarch64/aarch64-sve-builtins-base.cc (svdiv_impl::fold):
        Add optimization.

gcc/testsuite/

        * gcc.target/aarch64/sve/acle/asm/div_s32.c: New test.
        * gcc.target/aarch64/sve/acle/asm/div_s64.c: Likewise.
        * gcc.target/aarch64/sve/acle/asm/div_u32.c: Likewise.
        * gcc.target/aarch64/sve/acle/asm/div_u64.c: Likewise.

Attachment: 0001-SVE-intrinsics-Fold-svdiv-svptrue-x-x-to-ones.patch
Description: Binary data

Attachment: smime.p7s
Description: S/MIME cryptographic signature

Reply via email to