Skip to content

[test][AArch64] Adjust vector insertion lit tests #143101

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 11, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
69 changes: 67 additions & 2 deletions llvm/test/CodeGen/AArch64/arm64-vector-insertion.ll
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,35 @@ define <16 x i8> @test_insert_v16i8_insert_2_undef_base(i8 %a) {
%v.6 = insertelement <16 x i8> %v.4, i8 %a, i32 6
%v.7 = insertelement <16 x i8> %v.6, i8 %a, i32 7
%v.8 = insertelement <16 x i8> %v.7, i8 %a, i32 8
%v.10 = insertelement <16 x i8> %v.8, i8 %a, i32 10
%v.11 = insertelement <16 x i8> %v.10, i8 %a, i32 11
%v.12 = insertelement <16 x i8> %v.11, i8 %a, i32 12
%v.13 = insertelement <16 x i8> %v.12, i8 %a, i32 13
%v.14 = insertelement <16 x i8> %v.13, i8 %a, i32 14
%v.15 = insertelement <16 x i8> %v.14, i8 %a, i32 15
ret <16 x i8> %v.15
}

; Similar to above, but we leave element 8 as undef. One interesting part with
; this test case is that %a may be poison, so simply inserting %a also at
; index 8 would make the result vector more poisonous.
define <16 x i8> @test_insert_v16i8_insert_2_undef_base_skip8(i32 %a0) {
; CHECK-LABEL: test_insert_v16i8_insert_2_undef_base_skip8:
; CHECK: // %bb.0:
; CHECK-NEXT: lsr w8, w0, #5
; CHECK-NEXT: dup.16b v0, w8
; CHECK-NEXT: mov.b v0[5], wzr
; CHECK-NEXT: mov.b v0[9], wzr
; CHECK-NEXT: ret
%a1 = lshr exact i32 %a0, 5
%a = trunc i32 %a1 to i8
%v.0 = insertelement <16 x i8> <i8 undef, i8 undef, i8 undef, i8 undef, i8 undef, i8 0, i8 undef, i8 undef, i8 undef, i8 0, i8 undef, i8 undef, i8 undef, i8 undef, i8 undef, i8 undef> , i8 %a, i32 0
%v.1 = insertelement <16 x i8> %v.0, i8 %a, i32 1
%v.2 = insertelement <16 x i8> %v.1, i8 %a, i32 2
%v.3 = insertelement <16 x i8> %v.2, i8 %a, i32 3
%v.4 = insertelement <16 x i8> %v.3, i8 %a, i32 4
%v.6 = insertelement <16 x i8> %v.4, i8 %a, i32 6
%v.7 = insertelement <16 x i8> %v.6, i8 %a, i32 7
%v.10 = insertelement <16 x i8> %v.7, i8 %a, i32 10
%v.11 = insertelement <16 x i8> %v.10, i8 %a, i32 11
%v.12 = insertelement <16 x i8> %v.11, i8 %a, i32 12
Expand All @@ -75,8 +104,8 @@ define <16 x i8> @test_insert_v16i8_insert_2_undef_base(i8 %a) {
ret <16 x i8> %v.15
}

define <16 x i8> @test_insert_v16i8_insert_2_undef_base_different_valeus(i8 %a, i8 %b) {
; CHECK-LABEL: test_insert_v16i8_insert_2_undef_base_different_valeus:
define <16 x i8> @test_insert_v16i8_insert_2_undef_base_different_values(i8 %a, i8 %b) {
; CHECK-LABEL: test_insert_v16i8_insert_2_undef_base_different_values:
; CHECK: // %bb.0:
; CHECK-NEXT: dup.16b v0, w0
; CHECK-NEXT: mov.b v0[2], w1
Expand All @@ -94,6 +123,42 @@ define <16 x i8> @test_insert_v16i8_insert_2_undef_base_different_valeus(i8 %a,
%v.6 = insertelement <16 x i8> %v.4, i8 %a, i32 6
%v.7 = insertelement <16 x i8> %v.6, i8 %b, i32 7
%v.8 = insertelement <16 x i8> %v.7, i8 %a, i32 8
%v.10 = insertelement <16 x i8> %v.8, i8 %a, i32 10
%v.11 = insertelement <16 x i8> %v.10, i8 %a, i32 11
%v.12 = insertelement <16 x i8> %v.11, i8 %b, i32 12
%v.13 = insertelement <16 x i8> %v.12, i8 %a, i32 13
%v.14 = insertelement <16 x i8> %v.13, i8 %a, i32 14
%v.15 = insertelement <16 x i8> %v.14, i8 %b, i32 15
ret <16 x i8> %v.15
}

; Similar to above, but we leave element 8 as undef. One interesting part with
; this test case is that %a and %b may be poison, so simply inserting %a or %b
; at index 8 would make the result vector more poisonous.
define <16 x i8> @test_insert_v16i8_insert_2_undef_base_different_values_skip8(i32 %a0, i32 %b0) {
; CHECK-LABEL: test_insert_v16i8_insert_2_undef_base_different_values_skip8:
; CHECK: // %bb.0:
; CHECK-NEXT: lsr w8, w0, #5
; CHECK-NEXT: dup.16b v0, w8
; CHECK-NEXT: lsr w8, w1, #5
; CHECK-NEXT: mov.b v0[2], w8
; CHECK-NEXT: mov.b v0[5], wzr
; CHECK-NEXT: mov.b v0[7], w8
; CHECK-NEXT: mov.b v0[9], wzr
; CHECK-NEXT: mov.b v0[12], w8
; CHECK-NEXT: mov.b v0[15], w8
; CHECK-NEXT: ret
%a1 = lshr exact i32 %a0, 5
%a = trunc i32 %a1 to i8
%b1 = lshr exact i32 %b0, 5
%b = trunc i32 %b1 to i8
%v.0 = insertelement <16 x i8> <i8 undef, i8 undef, i8 undef, i8 undef, i8 undef, i8 0, i8 undef, i8 undef, i8 undef, i8 0, i8 undef, i8 undef, i8 undef, i8 undef, i8 undef, i8 undef> , i8 %a, i32 0
%v.1 = insertelement <16 x i8> %v.0, i8 %a, i32 1
%v.2 = insertelement <16 x i8> %v.1, i8 %b, i32 2
%v.3 = insertelement <16 x i8> %v.2, i8 %a, i32 3
%v.4 = insertelement <16 x i8> %v.3, i8 %a, i32 4
%v.6 = insertelement <16 x i8> %v.4, i8 %a, i32 6
%v.7 = insertelement <16 x i8> %v.6, i8 %b, i32 7
%v.10 = insertelement <16 x i8> %v.7, i8 %a, i32 10
%v.11 = insertelement <16 x i8> %v.10, i8 %a, i32 11
%v.12 = insertelement <16 x i8> %v.11, i8 %b, i32 12
Expand Down
Loading