diff options
author | Craig Topper <craig.topper@sifive.com> | 2024-04-01 14:14:49 -0700 |
---|---|---|
committer | Craig Topper <craig.topper@sifive.com> | 2024-04-02 11:58:41 -0700 |
commit | a9af66a90e625fdb3c7ad2193e827a49d185fe60 (patch) | |
tree | f8a6ab61bcf3706cd55942e4c3eb3573a8f68e07 /llvm/test/CodeGen/RISCV | |
parent | 8c1dc5dd589ce6c056b95e43b72338ddea40789c (diff) | |
download | llvm-a9af66a90e625fdb3c7ad2193e827a49d185fe60.zip llvm-a9af66a90e625fdb3c7ad2193e827a49d185fe60.tar.gz llvm-a9af66a90e625fdb3c7ad2193e827a49d185fe60.tar.bz2 |
[RISCV] Lower (vector_interleave X, undef) to (vzext_vl X). (#87283)
If the odd vector is undef or poison, the widening add and multiply trick
doesn't work unless we freeze the odd vector.
Unfortunately, freezing doesn't work when the operand is provably
undef/poison. MIR doesn't have a representation for freeze so it
just becomes a COPY from IMPLICIT_DEF which freely propagates undef
to each operand independently.
To work around this, check for undef explicitly and lower to a VZEXT_VL
of the even vector. This produces better code than we'd get from a
freeze anyway.
I've left a FIXME for adding a freeze. I'll do that as a separate patch
as it affects other tests and doesn't help with the new test.
Diffstat (limited to 'llvm/test/CodeGen/RISCV')
-rw-r--r-- | llvm/test/CodeGen/RISCV/rvv/vector-interleave.ll | 19 |
1 files changed, 6 insertions, 13 deletions
diff --git a/llvm/test/CodeGen/RISCV/rvv/vector-interleave.ll b/llvm/test/CodeGen/RISCV/rvv/vector-interleave.ll index 47cc4f0..0992c9f 100644 --- a/llvm/test/CodeGen/RISCV/rvv/vector-interleave.ll +++ b/llvm/test/CodeGen/RISCV/rvv/vector-interleave.ll @@ -656,26 +656,19 @@ define <vscale x 16 x double> @vector_interleave_nxv16f64_nxv8f64(<vscale x 8 x ret <vscale x 16 x double> %res } -; FIXME: The last operand to the vwaddu.vv and vwmaccu.vx are both undef. They -; need to be the same register with the same contents. Otherwise, the even -; elements will not contain just the values from %a. define <vscale x 8 x i32> @vector_interleave_nxv8i32_nxv4i32_poison(<vscale x 4 x i32> %a) { ; CHECK-LABEL: vector_interleave_nxv8i32_nxv4i32_poison: ; CHECK: # %bb.0: -; CHECK-NEXT: vsetvli a0, zero, e32, m2, ta, ma -; CHECK-NEXT: vwaddu.vv v12, v8, v10 -; CHECK-NEXT: li a0, -1 -; CHECK-NEXT: vwmaccu.vx v12, a0, v8 -; CHECK-NEXT: vmv4r.v v8, v12 +; CHECK-NEXT: vsetvli a0, zero, e64, m4, ta, ma +; CHECK-NEXT: vzext.vf2 v12, v8 +; CHECK-NEXT: vmv.v.v v8, v12 ; CHECK-NEXT: ret ; ; ZVBB-LABEL: vector_interleave_nxv8i32_nxv4i32_poison: ; ZVBB: # %bb.0: -; ZVBB-NEXT: li a0, 32 -; ZVBB-NEXT: vsetvli a1, zero, e32, m2, ta, ma -; ZVBB-NEXT: vwsll.vx v12, v10, a0 -; ZVBB-NEXT: vwaddu.wv v12, v12, v8 -; ZVBB-NEXT: vmv4r.v v8, v12 +; ZVBB-NEXT: vsetvli a0, zero, e64, m4, ta, ma +; ZVBB-NEXT: vzext.vf2 v12, v8 +; ZVBB-NEXT: vmv.v.v v8, v12 ; ZVBB-NEXT: ret %res = call <vscale x 8 x i32> @llvm.experimental.vector.interleave2.nxv8i32(<vscale x 4 x i32> %a, <vscale x 4 x i32> poison) ret <vscale x 8 x i32> %res |