aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/CodeGen/CGExprAgg.cpp
diff options
context:
space:
mode:
authorChia <sun1011jacobi@gmail.com>2024-04-10 15:26:17 +0900
committerGitHub <noreply@github.com>2024-04-10 15:26:17 +0900
commit469caa31e77f1da37434783f9b4f1d87fe8dff71 (patch)
tree5f860716526ff347afafe87bd9d1c2ef92337145 /clang/lib/CodeGen/CGExprAgg.cpp
parent313a33b9dff44dc2b0048484e54f9328d9a0d9db (diff)
downloadllvm-469caa31e77f1da37434783f9b4f1d87fe8dff71.zip
llvm-469caa31e77f1da37434783f9b4f1d87fe8dff71.tar.gz
llvm-469caa31e77f1da37434783f9b4f1d87fe8dff71.tar.bz2
[RISCV] Use vwadd.vx for splat vector with extension (#87249)
This patch allows `combineBinOp_VLToVWBinOp_VL` to handle patterns like `(splat_vector (sext op))` or `(splat_vector (zext op))`. Then we can use `vwadd.vx` and `vwadd.w` for such a case. ### Source code ``` define <vscale x 8 x i64> @vwadd_vx_splat_sext(<vscale x 8 x i32> %va, i32 %b) { %sb = sext i32 %b to i64 %head = insertelement <vscale x 8 x i64> poison, i64 %sb, i32 0 %splat = shufflevector <vscale x 8 x i64> %head, <vscale x 8 x i64> poison, <vscale x 8 x i32> zeroinitializer %vc = sext <vscale x 8 x i32> %va to <vscale x 8 x i64> %ve = add <vscale x 8 x i64> %vc, %splat ret <vscale x 8 x i64> %ve } ``` ### Before this patch [Compiler Explorer](https://godbolt.org/z/sq191PsT4) ``` vwadd_vx_splat_sext: sext.w a0, a0 vsetvli a1, zero, e64, m8, ta, ma vmv.v.x v16, a0 vsetvli zero, zero, e32, m4, ta, ma vwadd.wv v16, v16, v8 vmv8r.v v8, v16 ret ``` ### After this patch ``` vwadd_vx_splat_sext vsetvli a1, zero, e32, m4, ta, ma vwadd.vx v16, v8, a0 vmv8r.v v8, v16 ret ```
Diffstat (limited to 'clang/lib/CodeGen/CGExprAgg.cpp')
0 files changed, 0 insertions, 0 deletions