Skip to content

Commit 9ce4557

Browse files
committed
[RISCV] Add coverage for reported miscompile in shuffle lowering
Derived from the example in #134126
1 parent 01bc672 commit 9ce4557

File tree

1 file changed

+35
-0
lines changed

1 file changed

+35
-0
lines changed

llvm/test/CodeGen/RISCV/rvv/fixed-vectors-shuffle-int.ll

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1371,3 +1371,38 @@ define <8 x i64> @shuffle_v8i164_span_splat(<8 x i64> %a) nounwind {
13711371
%res = shufflevector <8 x i64> %a, <8 x i64> poison, <8 x i32> <i32 1, i32 0, i32 1, i32 0, i32 1, i32 0, i32 1, i32 0>
13721372
ret <8 x i64> %res
13731373
}
1374+
1375+
; FIXME: Doing this as a span spat requires rewriting the undef elements in
1376+
; the mask not just using a prefix of the mask.
1377+
define <8 x i64> @shuffle_v8i64_span_splat_neg(<8 x i64> %a) nounwind {
1378+
; CHECK-LABEL: shuffle_v8i64_span_splat_neg:
1379+
; CHECK: # %bb.0:
1380+
; CHECK-NEXT: vsetivli zero, 4, e32, m1, ta, ma
1381+
; CHECK-NEXT: vmv.v.i v9, 1
1382+
; CHECK-NEXT: vsetvli a0, zero, e64, m1, ta, ma
1383+
; CHECK-NEXT: vrgatherei16.vv v12, v8, v9
1384+
; CHECK-NEXT: vmv.v.v v13, v12
1385+
; CHECK-NEXT: vmv.v.v v14, v12
1386+
; CHECK-NEXT: vmv.v.v v15, v12
1387+
; CHECK-NEXT: vmv4r.v v8, v12
1388+
; CHECK-NEXT: ret
1389+
%res = shufflevector <8 x i64> %a, <8 x i64> poison, <8 x i32> <i32 poison, i32 poison, i32 1, i32 0, i32 1, i32 0, i32 1, i32 0>
1390+
ret <8 x i64> %res
1391+
}
1392+
1393+
; FIXME: A locally repeating shuffle needs to use a mask prefix
1394+
define <8 x i32> @shuffle_v8i32_locally_repeating_neg(<8 x i32> %a) {
1395+
; CHECK-LABEL: shuffle_v8i32_locally_repeating_neg:
1396+
; CHECK: # %bb.0:
1397+
; CHECK-NEXT: lui a0, %hi(.LCPI87_0)
1398+
; CHECK-NEXT: addi a0, a0, %lo(.LCPI87_0)
1399+
; CHECK-NEXT: vsetivli zero, 8, e16, m1, ta, ma
1400+
; CHECK-NEXT: vle16.v v12, (a0)
1401+
; CHECK-NEXT: vsetvli a0, zero, e32, m1, ta, ma
1402+
; CHECK-NEXT: vrgatherei16.vv v11, v9, v12
1403+
; CHECK-NEXT: vrgatherei16.vv v10, v8, v12
1404+
; CHECK-NEXT: vmv2r.v v8, v10
1405+
; CHECK-NEXT: ret
1406+
%res = shufflevector <8 x i32> %a, <8 x i32> poison, <8 x i32> <i32 1, i32 0, i32 poison, i32 poison, i32 5, i32 4, i32 6, i32 6>
1407+
ret <8 x i32> %res
1408+
}

0 commit comments

Comments
 (0)