aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree-ssa-phiopt.cc
diff options
context:
space:
mode:
authorJennifer Schmitz <jschmitz@nvidia.com>2024-09-02 06:46:57 -0700
committerJennifer Schmitz <jschmitz@nvidia.com>2024-09-17 08:33:24 +0200
commite311dd13a9adbc51d56971cba06e1ff15a4256d2 (patch)
tree51d6d2561833fbbb1e387eb1bd48d03440577bea /gcc/tree-ssa-phiopt.cc
parent008f4510d7c073509a676899c3887b2ec7517233 (diff)
downloadgcc-e311dd13a9adbc51d56971cba06e1ff15a4256d2.zip
gcc-e311dd13a9adbc51d56971cba06e1ff15a4256d2.tar.gz
gcc-e311dd13a9adbc51d56971cba06e1ff15a4256d2.tar.bz2
SVE intrinsics: Fold svdiv with all-zero operands to zero vector
This patch folds svdiv where one of the operands is all-zeros to a zero vector, if one of the following conditions holds: - the dividend is all zeros or - the divisor is all zeros, and the predicate is ptrue or the predication is _x or _z. This case was not covered by the recent patch that implemented constant folding, because that covered only cases where both operands are constant vectors. Here, the operation is folded as soon as one of the operands is a constant zero vector. Folding of divison by 0 to return 0 is in accordance with the semantics of sdiv and udiv. The patch was bootstrapped and regtested on aarch64-linux-gnu, no regression. OK for mainline? Signed-off-by: Jennifer Schmitz <jschmitz@nvidia.com> gcc/ * config/aarch64/aarch64-sve-builtins-base.cc (svdiv_impl::fold): Add folding of all-zero operands to zero vector. gcc/testsuite/ * gcc.target/aarch64/sve/fold_div_zero.c: New test. * gcc.target/aarch64/sve/const_fold_div_1.c: Adjust expected outcome.
Diffstat (limited to 'gcc/tree-ssa-phiopt.cc')
0 files changed, 0 insertions, 0 deletions