Jennifer Schmitz <jschm...@nvidia.com> writes: > From 287073b46e3eb9e7786f95c1d4bd90208db51f75 Mon Sep 17 00:00:00 2001 > From: Jennifer Schmitz <jschm...@nvidia.com> > Date: Mon, 2 Sep 2024 06:46:57 -0700 > Subject: [PATCH] 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 <jschm...@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.
OK, thanks. Richard