Skip to content

Commit 22e7af0

Browse files
test
Signed-off-by: Mikhail R. Gadelha <[email protected]>
1 parent b3ce6dc commit 22e7af0

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

llvm/test/CodeGen/RISCV/rvv/splat-vectors.ll

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,3 +105,29 @@ define <vscale x 4 x float> @splat_idx_nxv4f32(<vscale x 4 x float> %v, i64 %idx
105105
%splat = shufflevector <vscale x 4 x float> %ins, <vscale x 4 x float> poison, <vscale x 4 x i32> zeroinitializer
106106
ret <vscale x 4 x float> %splat
107107
}
108+
109+
define <vscale x 4 x float> @splat_idx_constant_nxv8f32(<vscale x 8 x float> %v) {
110+
; CHECK-LABEL: splat_idx_constant_nxv8f32:
111+
; CHECK: # %bb.0:
112+
; CHECK-NEXT: vsetvli a0, zero, e32, m2, ta, ma
113+
; CHECK-NEXT: vrgather.vi v10, v8, 0
114+
; CHECK-NEXT: vmv.v.v v8, v10
115+
; CHECK-NEXT: ret
116+
%x = extractelement <vscale x 8 x float> %v, i64 0
117+
%ins = insertelement <vscale x 4 x float> poison, float %x, i32 0
118+
%splat = shufflevector <vscale x 4 x float> %ins, <vscale x 4 x float> poison, <vscale x 4 x i32> zeroinitializer
119+
ret <vscale x 4 x float> %splat
120+
}
121+
122+
define <vscale x 4 x i8> @splat_idx_constant_nxv4i8(<vscale x 8 x i8> %v) {
123+
; CHECK-LABEL: splat_idx_constant_nxv4i8:
124+
; CHECK: # %bb.0:
125+
; CHECK-NEXT: vsetvli a0, zero, e8, mf2, ta, ma
126+
; CHECK-NEXT: vmv.x.s a0, v8
127+
; CHECK-NEXT: vmv.v.x v8, a0
128+
; CHECK-NEXT: ret
129+
%x = extractelement <vscale x 8 x i8> %v, i64 0
130+
%ins = insertelement <vscale x 4 x i8> poison, i8 %x, i32 0
131+
%splat = shufflevector <vscale x 4 x i8> %ins, <vscale x 4 x i8> poison, <vscale x 4 x i32> zeroinitializer
132+
ret <vscale x 4 x i8> %splat
133+
}

0 commit comments

Comments
 (0)