This patch implements constant folding for svmul. It uses the
gimple_folder::const_fold function to fold constant integer operands.
Additionally, if at least one of the operands is a zero vector, svmul is
folded to a zero vector (in case of ptrue, _x, or _z).
Tests were added to check the produced assembly for different
predicates and signed and unsigned integers.

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

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

gcc/

        * config/aarch64/aarch64-sve-builtins-base.cc
        (svmul_impl::fold): Implement function and add constant folding.

gcc/testsuite/

        * gcc.target/aarch64/sve/const_fold_mul_1.c: New test.
        * gcc.target/aarch64/sve/const_fold_mul_zero.c: Likewise.

Attachment: 0002-SVE-intrinsics-Fold-constant-operands-for-svmul.patch
Description: Binary data

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

Reply via email to