As recently implemented for svdiv, this patch folds svmul to a zero
vector if one of the operands is a zero vector. This transformation is
applied if at least one of the following conditions is met:
- the first operand is all zeros or
- the second operand is all zeros, and the predicate is ptrue or the
predication is _x or _z.

In contrast to constant folding, which was implemented in a previous
patch, this transformation is applied as soon as one of the operands is
a zero vector, while the other operand can be a variable.

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):
        Add folding of all-zero operands to zero vector.

gcc/testsuite/
        * gcc.target/aarch64/sve/const_fold_mul_1.c: Adjust expected
        outcome.
        * gcc.target/aarch64/sve/fold_mul_zero.c: New test.

Attachment: 0001-SVE-intrinsics-Fold-svmul-with-all-zero-operands-to-.patch
Description: Binary data

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

Reply via email to