diff options
author | Jennifer Schmitz <jschmitz@nvidia.com> | 2024-08-30 07:16:43 -0700 |
---|---|---|
committer | Jennifer Schmitz <jschmitz@nvidia.com> | 2024-09-03 09:24:15 +0200 |
commit | 6b1cf59e90d3d6391d61b2a8f77856b5aa044014 (patch) | |
tree | 0fccc9a8b943721411da9fa6ca8474538ca632de /gcc/config/aarch64 | |
parent | ee8b7231b03a36dfc09d94f2b663636ca2a36daf (diff) | |
download | gcc-6b1cf59e90d3d6391d61b2a8f77856b5aa044014.zip gcc-6b1cf59e90d3d6391d61b2a8f77856b5aa044014.tar.gz gcc-6b1cf59e90d3d6391d61b2a8f77856b5aa044014.tar.bz2 |
SVE intrinsics: Fold constant operands for svmul.
This patch implements constant folding for svmul by calling
gimple_folder::fold_const_binary with tree_code MULT_EXPR.
Tests were added to check the produced assembly for different
predicates, signed and unsigned integers, and the svmul_n_* case.
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 (svmul_impl::fold):
Try constant folding.
gcc/testsuite/
* gcc.target/aarch64/sve/const_fold_mul_1.c: New test.
Diffstat (limited to 'gcc/config/aarch64')
-rw-r--r-- | gcc/config/aarch64/aarch64-sve-builtins-base.cc | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/gcc/config/aarch64/aarch64-sve-builtins-base.cc b/gcc/config/aarch64/aarch64-sve-builtins-base.cc index 6c94d14..8f781e2 100644 --- a/gcc/config/aarch64/aarch64-sve-builtins-base.cc +++ b/gcc/config/aarch64/aarch64-sve-builtins-base.cc @@ -2000,6 +2000,19 @@ public: } }; +class svmul_impl : public rtx_code_function +{ +public: + CONSTEXPR svmul_impl () + : rtx_code_function (MULT, MULT, UNSPEC_COND_FMUL) {} + + gimple * + fold (gimple_folder &f) const override + { + return f.fold_const_binary (MULT_EXPR); + } +}; + class svnand_impl : public function_base { public: @@ -3184,7 +3197,7 @@ FUNCTION (svmls_lane, svmls_lane_impl,) FUNCTION (svmmla, svmmla_impl,) FUNCTION (svmov, svmov_impl,) FUNCTION (svmsb, svmsb_impl,) -FUNCTION (svmul, rtx_code_function, (MULT, MULT, UNSPEC_COND_FMUL)) +FUNCTION (svmul, svmul_impl,) FUNCTION (svmul_lane, CODE_FOR_MODE0 (aarch64_mul_lane),) FUNCTION (svmulh, unspec_based_function, (UNSPEC_SMUL_HIGHPART, UNSPEC_UMUL_HIGHPART, -1)) |