1 # RUN: llc -mtriple=x86_64-linux-gnu -mattr=+avx -run-pass=instruction-select -verify-machineinstrs %s -o - | FileCheck %s --check-prefix=ALL --check-prefix=AVX
2 # RUN: llc -mtriple=x86_64-linux-gnu -mattr=+avx512f,+avx512vl -run-pass=instruction-select -verify-machineinstrs %s -o - | FileCheck %s --check-prefix=ALL --check-prefix=AVX512VL
4 define void @test_insert_128_idx0() {
8 define void @test_insert_128_idx0_undef() {
12 define void @test_insert_128_idx1() {
16 define void @test_insert_128_idx1_undef() {
22 name: test_insert_128_idx0
23 # ALL-LABEL: name: test_insert_128_idx0
28 - { id: 0, class: vecr }
29 - { id: 1, class: vecr }
30 - { id: 2, class: vecr }
31 # AVX: %0:vr256 = COPY $ymm0
32 # AVX-NEXT: %1:vr128 = COPY $xmm1
33 # AVX-NEXT: %2:vr256 = VINSERTF128rr %0, %1, 0
34 # AVX-NEXT: $ymm0 = COPY %2
35 # AVX-NEXT: RET 0, implicit $ymm0
37 # AVX512VL: %0:vr256x = COPY $ymm0
38 # AVX512VL-NEXT: %1:vr128x = COPY $xmm1
39 # AVX512VL-NEXT: %2:vr256x = VINSERTF32x4Z256rr %0, %1, 0
40 # AVX512VL-NEXT: $ymm0 = COPY %2
41 # AVX512VL-NEXT: RET 0, implicit $ymm0
46 %0(<8 x s32>) = COPY $ymm0
47 %1(<4 x s32>) = COPY $xmm1
48 %2(<8 x s32>) = G_INSERT %0(<8 x s32>), %1(<4 x s32>), 0
49 $ymm0 = COPY %2(<8 x s32>)
54 name: test_insert_128_idx0_undef
55 # ALL-LABEL: name: test_insert_128_idx0_undef
60 - { id: 0, class: vecr }
61 - { id: 1, class: vecr }
62 - { id: 2, class: vecr }
63 # AVX: %1:vr128 = COPY $xmm1
64 # AVX-NEXT: undef %2.sub_xmm:vr256 = COPY %1
65 # AVX-NEXT: $ymm0 = COPY %2
66 # AVX-NEXT: RET 0, implicit $ymm0
68 # AVX512VL: %1:vr128x = COPY $xmm1
69 # AVX512VL-NEXT: undef %2.sub_xmm:vr256x = COPY %1
70 # AVX512VL-NEXT: $ymm0 = COPY %2
71 # AVX512VL-NEXT: RET 0, implicit $ymm0
76 %0(<8 x s32>) = IMPLICIT_DEF
77 %1(<4 x s32>) = COPY $xmm1
78 %2(<8 x s32>) = G_INSERT %0(<8 x s32>), %1(<4 x s32>), 0
79 $ymm0 = COPY %2(<8 x s32>)
84 name: test_insert_128_idx1
85 # ALL-LABEL: name: test_insert_128_idx1
90 - { id: 0, class: vecr }
91 - { id: 1, class: vecr }
92 - { id: 2, class: vecr }
93 # AVX: %0:vr256 = COPY $ymm0
94 # AVX-NEXT: %1:vr128 = COPY $xmm1
95 # AVX-NEXT: %2:vr256 = VINSERTF128rr %0, %1, 1
96 # AVX-NEXT: $ymm0 = COPY %2
97 # AVX-NEXT: RET 0, implicit $ymm0
99 # AVX512VL: %0:vr256x = COPY $ymm0
100 # AVX512VL-NEXT: %1:vr128x = COPY $xmm1
101 # AVX512VL-NEXT: %2:vr256x = VINSERTF32x4Z256rr %0, %1, 1
102 # AVX512VL-NEXT: $ymm0 = COPY %2
103 # AVX512VL-NEXT: RET 0, implicit $ymm0
106 liveins: $ymm0, $ymm1
108 %0(<8 x s32>) = COPY $ymm0
109 %1(<4 x s32>) = COPY $xmm1
110 %2(<8 x s32>) = G_INSERT %0(<8 x s32>), %1(<4 x s32>), 128
111 $ymm0 = COPY %2(<8 x s32>)
112 RET 0, implicit $ymm0
115 name: test_insert_128_idx1_undef
116 # ALL-LABEL: name: test_insert_128_idx1_undef
119 regBankSelected: true
121 - { id: 0, class: vecr }
122 - { id: 1, class: vecr }
123 - { id: 2, class: vecr }
124 # AVX: %0:vr256 = IMPLICIT_DEF
125 # AVX-NEXT: %1:vr128 = COPY $xmm1
126 # AVX-NEXT: %2:vr256 = VINSERTF128rr %0, %1, 1
127 # AVX-NEXT: $ymm0 = COPY %2
128 # AVX-NEXT: RET 0, implicit $ymm0
130 # AVX512VL: %0:vr256x = IMPLICIT_DEF
131 # AVX512VL-NEXT: %1:vr128x = COPY $xmm1
132 # AVX512VL-NEXT: %2:vr256x = VINSERTF32x4Z256rr %0, %1, 1
133 # AVX512VL-NEXT: $ymm0 = COPY %2
134 # AVX512VL-NEXT: RET 0, implicit $ymm0
137 liveins: $ymm0, $ymm1
139 %0(<8 x s32>) = IMPLICIT_DEF
140 %1(<4 x s32>) = COPY $xmm1
141 %2(<8 x s32>) = G_INSERT %0(<8 x s32>), %1(<4 x s32>), 128
142 $ymm0 = COPY %2(<8 x s32>)
143 RET 0, implicit $ymm0