blob: 53353abefb36dfcdc60fb961cd30fca267e0c146 [file] [log] [blame]
Simon Pilgrim74b3bfd2016-04-19 12:56:46 +00001; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
Simon Pilgrim61116dd2015-09-17 20:32:45 +00002; RUN: opt < %s -instcombine -S | FileCheck %s
3
Simon Pilgrim216b1bf2015-10-17 11:40:05 +00004;
5; EXTRQ
6;
7
8define <2 x i64> @test_extrq_call(<2 x i64> %x, <16 x i8> %y) {
Simon Pilgrim74b3bfd2016-04-19 12:56:46 +00009; CHECK-LABEL: @test_extrq_call(
10; CHECK-NEXT: [[TMP1:%.*]] = tail call <2 x i64> @llvm.x86.sse4a.extrq(<2 x i64> %x, <16 x i8> %y) #1
11; CHECK-NEXT: ret <2 x i64> [[TMP1]]
12;
Simon Pilgrim216b1bf2015-10-17 11:40:05 +000013 %1 = tail call <2 x i64> @llvm.x86.sse4a.extrq(<2 x i64> %x, <16 x i8> %y) nounwind
14 ret <2 x i64> %1
15}
16
17define <2 x i64> @test_extrq_zero_arg0(<2 x i64> %x, <16 x i8> %y) {
Simon Pilgrim74b3bfd2016-04-19 12:56:46 +000018; CHECK-LABEL: @test_extrq_zero_arg0(
19; CHECK-NEXT: ret <2 x i64> <i64 0, i64 undef>
20;
Simon Pilgrim216b1bf2015-10-17 11:40:05 +000021 %1 = tail call <2 x i64> @llvm.x86.sse4a.extrq(<2 x i64> zeroinitializer, <16 x i8> %y) nounwind
22 ret <2 x i64> %1
23}
24
25define <2 x i64> @test_extrq_zero_arg1(<2 x i64> %x, <16 x i8> %y) {
Simon Pilgrim74b3bfd2016-04-19 12:56:46 +000026; CHECK-LABEL: @test_extrq_zero_arg1(
27; CHECK-NEXT: ret <2 x i64> %x
28;
Simon Pilgrim216b1bf2015-10-17 11:40:05 +000029 %1 = tail call <2 x i64> @llvm.x86.sse4a.extrq(<2 x i64> %x, <16 x i8> zeroinitializer) nounwind
30 ret <2 x i64> %1
31}
32
33define <2 x i64> @test_extrq_to_extqi(<2 x i64> %x, <16 x i8> %y) {
Simon Pilgrim74b3bfd2016-04-19 12:56:46 +000034; CHECK-LABEL: @test_extrq_to_extqi(
35; CHECK-NEXT: [[TMP1:%.*]] = call <2 x i64> @llvm.x86.sse4a.extrqi(<2 x i64> %x, i8 8, i8 15)
36; CHECK-NEXT: ret <2 x i64> [[TMP1]]
37;
Simon Pilgrim216b1bf2015-10-17 11:40:05 +000038 %1 = tail call <2 x i64> @llvm.x86.sse4a.extrq(<2 x i64> %x, <16 x i8> <i8 8, i8 15, i8 0, i8 0, i8 0, i8 0, i8 0, i8 0, i8 0, i8 0, i8 0, i8 0, i8 0, i8 0, i8 0, i8 0>) nounwind
39 ret <2 x i64> %1
40}
41
42define <2 x i64> @test_extrq_constant(<2 x i64> %x, <16 x i8> %y) {
Simon Pilgrim74b3bfd2016-04-19 12:56:46 +000043; CHECK-LABEL: @test_extrq_constant(
44; CHECK-NEXT: ret <2 x i64> <i64 255, i64 undef>
45;
Simon Pilgrim216b1bf2015-10-17 11:40:05 +000046 %1 = tail call <2 x i64> @llvm.x86.sse4a.extrq(<2 x i64> <i64 -1, i64 55>, <16 x i8> <i8 8, i8 15, i8 0, i8 0, i8 0, i8 0, i8 0, i8 0, i8 0, i8 0, i8 0, i8 0, i8 0, i8 0, i8 0, i8 0>) nounwind
47 ret <2 x i64> %1
48}
49
50define <2 x i64> @test_extrq_constant_undef(<2 x i64> %x, <16 x i8> %y) {
Simon Pilgrim74b3bfd2016-04-19 12:56:46 +000051; CHECK-LABEL: @test_extrq_constant_undef(
52; CHECK-NEXT: ret <2 x i64> <i64 65535, i64 undef>
53;
Simon Pilgrim216b1bf2015-10-17 11:40:05 +000054 %1 = tail call <2 x i64> @llvm.x86.sse4a.extrq(<2 x i64> <i64 -1, i64 undef>, <16 x i8> <i8 16, i8 15, i8 0, i8 0, i8 0, i8 0, i8 0, i8 0, i8 0, i8 0, i8 0, i8 0, i8 0, i8 0, i8 0, i8 0>) nounwind
55 ret <2 x i64> %1
56}
57
58;
59; EXTRQI
60;
61
62define <2 x i64> @test_extrqi_call(<2 x i64> %x) {
Simon Pilgrim74b3bfd2016-04-19 12:56:46 +000063; CHECK-LABEL: @test_extrqi_call(
64; CHECK-NEXT: [[TMP1:%.*]] = tail call <2 x i64> @llvm.x86.sse4a.extrqi(<2 x i64> %x, i8 8, i8 23)
65; CHECK-NEXT: ret <2 x i64> [[TMP1]]
66;
Simon Pilgrim216b1bf2015-10-17 11:40:05 +000067 %1 = tail call <2 x i64> @llvm.x86.sse4a.extrqi(<2 x i64> %x, i8 8, i8 23)
68 ret <2 x i64> %1
69}
70
71define <2 x i64> @test_extrqi_shuffle_1zuu(<2 x i64> %x) {
Simon Pilgrim74b3bfd2016-04-19 12:56:46 +000072; CHECK-LABEL: @test_extrqi_shuffle_1zuu(
73; CHECK-NEXT: [[TMP1:%.*]] = bitcast <2 x i64> %x to <16 x i8>
74; CHECK-NEXT: [[TMP2:%.*]] = shufflevector <16 x i8> [[TMP1]], <16 x i8> <i8 undef, i8 undef, i8 undef, i8 undef, i8 0, i8 0, i8 0, i8 0, i8 undef, i8 undef, i8 undef, i8 undef, i8 undef, i8 undef, i8 undef, i8 undef>, <16 x i32> <i32 4, i32 5, i32 6, i32 7, i32 20, i32 21, i32 22, i32 23, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef>
75; CHECK-NEXT: [[TMP3:%.*]] = bitcast <16 x i8> [[TMP2]] to <2 x i64>
76; CHECK-NEXT: ret <2 x i64> [[TMP3]]
77;
Simon Pilgrim216b1bf2015-10-17 11:40:05 +000078 %1 = tail call <2 x i64> @llvm.x86.sse4a.extrqi(<2 x i64> %x, i8 32, i8 32)
79 ret <2 x i64> %1
80}
81
82define <2 x i64> @test_extrqi_shuffle_2zzzzzzzuuuuuuuu(<2 x i64> %x) {
Simon Pilgrim74b3bfd2016-04-19 12:56:46 +000083; CHECK-LABEL: @test_extrqi_shuffle_2zzzzzzzuuuuuuuu(
84; CHECK-NEXT: [[TMP1:%.*]] = bitcast <2 x i64> %x to <16 x i8>
85; CHECK-NEXT: [[TMP2:%.*]] = shufflevector <16 x i8> [[TMP1]], <16 x i8> <i8 undef, i8 0, i8 0, i8 0, i8 0, i8 0, i8 0, i8 0, i8 undef, i8 undef, i8 undef, i8 undef, i8 undef, i8 undef, i8 undef, i8 undef>, <16 x i32> <i32 2, i32 17, i32 18, i32 19, i32 20, i32 21, i32 22, i32 23, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef>
86; CHECK-NEXT: [[TMP3:%.*]] = bitcast <16 x i8> [[TMP2]] to <2 x i64>
87; CHECK-NEXT: ret <2 x i64> [[TMP3]]
88;
Simon Pilgrim216b1bf2015-10-17 11:40:05 +000089 %1 = tail call <2 x i64> @llvm.x86.sse4a.extrqi(<2 x i64> %x, i8 8, i8 16)
90 ret <2 x i64> %1
91}
92
93define <2 x i64> @test_extrqi_undef(<2 x i64> %x) {
Simon Pilgrim74b3bfd2016-04-19 12:56:46 +000094; CHECK-LABEL: @test_extrqi_undef(
95; CHECK-NEXT: ret <2 x i64> undef
96;
Simon Pilgrim216b1bf2015-10-17 11:40:05 +000097 %1 = tail call <2 x i64> @llvm.x86.sse4a.extrqi(<2 x i64> zeroinitializer, i8 32, i8 33)
98 ret <2 x i64> %1
99}
100
101define <2 x i64> @test_extrqi_zero(<2 x i64> %x) {
Simon Pilgrim74b3bfd2016-04-19 12:56:46 +0000102; CHECK-LABEL: @test_extrqi_zero(
103; CHECK-NEXT: ret <2 x i64> <i64 0, i64 undef>
104;
Simon Pilgrim216b1bf2015-10-17 11:40:05 +0000105 %1 = tail call <2 x i64> @llvm.x86.sse4a.extrqi(<2 x i64> zeroinitializer, i8 3, i8 18)
106 ret <2 x i64> %1
107}
108
109define <2 x i64> @test_extrqi_constant(<2 x i64> %x) {
Simon Pilgrim74b3bfd2016-04-19 12:56:46 +0000110; CHECK-LABEL: @test_extrqi_constant(
111; CHECK-NEXT: ret <2 x i64> <i64 7, i64 undef>
112;
Simon Pilgrim216b1bf2015-10-17 11:40:05 +0000113 %1 = tail call <2 x i64> @llvm.x86.sse4a.extrqi(<2 x i64> <i64 -1, i64 55>, i8 3, i8 18)
114 ret <2 x i64> %1
115}
116
117define <2 x i64> @test_extrqi_constant_undef(<2 x i64> %x) {
Simon Pilgrim74b3bfd2016-04-19 12:56:46 +0000118; CHECK-LABEL: @test_extrqi_constant_undef(
119; CHECK-NEXT: ret <2 x i64> <i64 15, i64 undef>
120;
Simon Pilgrim216b1bf2015-10-17 11:40:05 +0000121 %1 = tail call <2 x i64> @llvm.x86.sse4a.extrqi(<2 x i64> <i64 -1, i64 undef>, i8 4, i8 18)
122 ret <2 x i64> %1
123}
124
125;
126; INSERTQ
127;
128
129define <2 x i64> @test_insertq_call(<2 x i64> %x, <2 x i64> %y) {
Simon Pilgrim74b3bfd2016-04-19 12:56:46 +0000130; CHECK-LABEL: @test_insertq_call(
131; CHECK-NEXT: [[TMP1:%.*]] = tail call <2 x i64> @llvm.x86.sse4a.insertq(<2 x i64> %x, <2 x i64> %y) #1
132; CHECK-NEXT: ret <2 x i64> [[TMP1]]
133;
Simon Pilgrim216b1bf2015-10-17 11:40:05 +0000134 %1 = tail call <2 x i64> @llvm.x86.sse4a.insertq(<2 x i64> %x, <2 x i64> %y) nounwind
135 ret <2 x i64> %1
136}
137
138define <2 x i64> @test_insertq_to_insertqi(<2 x i64> %x, <2 x i64> %y) {
Simon Pilgrim74b3bfd2016-04-19 12:56:46 +0000139; CHECK-LABEL: @test_insertq_to_insertqi(
140; CHECK-NEXT: [[TMP1:%.*]] = call <2 x i64> @llvm.x86.sse4a.insertqi(<2 x i64> %x, <2 x i64> <i64 8, i64 undef>, i8 18, i8 2)
141; CHECK-NEXT: ret <2 x i64> [[TMP1]]
142;
Simon Pilgrim216b1bf2015-10-17 11:40:05 +0000143 %1 = tail call <2 x i64> @llvm.x86.sse4a.insertq(<2 x i64> %x, <2 x i64> <i64 8, i64 658>) nounwind
144 ret <2 x i64> %1
145}
146
147define <2 x i64> @test_insertq_constant(<2 x i64> %x, <2 x i64> %y) {
Simon Pilgrim74b3bfd2016-04-19 12:56:46 +0000148; CHECK-LABEL: @test_insertq_constant(
149; CHECK-NEXT: ret <2 x i64> <i64 32, i64 undef>
150;
Simon Pilgrim216b1bf2015-10-17 11:40:05 +0000151 %1 = tail call <2 x i64> @llvm.x86.sse4a.insertq(<2 x i64> <i64 0, i64 0>, <2 x i64> <i64 8, i64 658>) nounwind
152 ret <2 x i64> %1
153}
154
155define <2 x i64> @test_insertq_constant_undef(<2 x i64> %x, <2 x i64> %y) {
Simon Pilgrim74b3bfd2016-04-19 12:56:46 +0000156; CHECK-LABEL: @test_insertq_constant_undef(
157; CHECK-NEXT: ret <2 x i64> <i64 33, i64 undef>
158;
Simon Pilgrim216b1bf2015-10-17 11:40:05 +0000159 %1 = tail call <2 x i64> @llvm.x86.sse4a.insertq(<2 x i64> <i64 1, i64 undef>, <2 x i64> <i64 8, i64 658>) nounwind
160 ret <2 x i64> %1
161}
162
163;
164; INSERTQI
165;
166
167define <16 x i8> @test_insertqi_shuffle_04uu(<16 x i8> %v, <16 x i8> %i) {
Simon Pilgrim74b3bfd2016-04-19 12:56:46 +0000168; CHECK-LABEL: @test_insertqi_shuffle_04uu(
169; CHECK-NEXT: [[TMP1:%.*]] = shufflevector <16 x i8> %v, <16 x i8> %i, <16 x i32> <i32 0, i32 1, i32 2, i32 3, i32 16, i32 17, i32 18, i32 19, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef>
170; CHECK-NEXT: ret <16 x i8> [[TMP1]]
171;
Simon Pilgrim216b1bf2015-10-17 11:40:05 +0000172 %1 = bitcast <16 x i8> %v to <2 x i64>
173 %2 = bitcast <16 x i8> %i to <2 x i64>
174 %3 = tail call <2 x i64> @llvm.x86.sse4a.insertqi(<2 x i64> %1, <2 x i64> %2, i8 32, i8 32)
175 %4 = bitcast <2 x i64> %3 to <16 x i8>
176 ret <16 x i8> %4
177}
178
179define <16 x i8> @test_insertqi_shuffle_8123uuuu(<16 x i8> %v, <16 x i8> %i) {
Simon Pilgrim74b3bfd2016-04-19 12:56:46 +0000180; CHECK-LABEL: @test_insertqi_shuffle_8123uuuu(
181; CHECK-NEXT: [[TMP1:%.*]] = shufflevector <16 x i8> %v, <16 x i8> %i, <16 x i32> <i32 16, i32 17, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef>
182; CHECK-NEXT: ret <16 x i8> [[TMP1]]
183;
Simon Pilgrim216b1bf2015-10-17 11:40:05 +0000184 %1 = bitcast <16 x i8> %v to <2 x i64>
185 %2 = bitcast <16 x i8> %i to <2 x i64>
186 %3 = tail call <2 x i64> @llvm.x86.sse4a.insertqi(<2 x i64> %1, <2 x i64> %2, i8 16, i8 0)
187 %4 = bitcast <2 x i64> %3 to <16 x i8>
188 ret <16 x i8> %4
189}
190
191define <2 x i64> @test_insertqi_constant(<2 x i64> %v, <2 x i64> %i) {
Simon Pilgrim74b3bfd2016-04-19 12:56:46 +0000192; CHECK-LABEL: @test_insertqi_constant(
193; CHECK-NEXT: ret <2 x i64> <i64 -131055, i64 undef>
194;
Simon Pilgrim216b1bf2015-10-17 11:40:05 +0000195 %1 = tail call <2 x i64> @llvm.x86.sse4a.insertqi(<2 x i64> <i64 -1, i64 -1>, <2 x i64> <i64 8, i64 0>, i8 16, i8 1)
196 ret <2 x i64> %1
197}
198
Simon Pilgrim61116dd2015-09-17 20:32:45 +0000199; The result of this insert is the second arg, since the top 64 bits of
200; the result are undefined, and we copy the bottom 64 bits from the
201; second arg
Simon Pilgrim61116dd2015-09-17 20:32:45 +0000202define <2 x i64> @testInsert64Bits(<2 x i64> %v, <2 x i64> %i) {
Simon Pilgrim74b3bfd2016-04-19 12:56:46 +0000203; CHECK-LABEL: @testInsert64Bits(
204; CHECK-NEXT: ret <2 x i64> %i
205;
Simon Pilgrim61116dd2015-09-17 20:32:45 +0000206 %1 = tail call <2 x i64> @llvm.x86.sse4a.insertqi(<2 x i64> %v, <2 x i64> %i, i8 64, i8 0)
207 ret <2 x i64> %1
208}
209
Simon Pilgrim61116dd2015-09-17 20:32:45 +0000210define <2 x i64> @testZeroLength(<2 x i64> %v, <2 x i64> %i) {
Simon Pilgrim74b3bfd2016-04-19 12:56:46 +0000211; CHECK-LABEL: @testZeroLength(
212; CHECK-NEXT: ret <2 x i64> %i
213;
Simon Pilgrim61116dd2015-09-17 20:32:45 +0000214 %1 = tail call <2 x i64> @llvm.x86.sse4a.insertqi(<2 x i64> %v, <2 x i64> %i, i8 0, i8 0)
215 ret <2 x i64> %1
216}
217
Simon Pilgrim61116dd2015-09-17 20:32:45 +0000218define <2 x i64> @testUndefinedInsertq_1(<2 x i64> %v, <2 x i64> %i) {
Simon Pilgrim74b3bfd2016-04-19 12:56:46 +0000219; CHECK-LABEL: @testUndefinedInsertq_1(
220; CHECK-NEXT: ret <2 x i64> undef
221;
Simon Pilgrim61116dd2015-09-17 20:32:45 +0000222 %1 = tail call <2 x i64> @llvm.x86.sse4a.insertqi(<2 x i64> %v, <2 x i64> %i, i8 0, i8 16)
223 ret <2 x i64> %1
224}
225
Simon Pilgrim61116dd2015-09-17 20:32:45 +0000226define <2 x i64> @testUndefinedInsertq_2(<2 x i64> %v, <2 x i64> %i) {
Simon Pilgrim74b3bfd2016-04-19 12:56:46 +0000227; CHECK-LABEL: @testUndefinedInsertq_2(
228; CHECK-NEXT: ret <2 x i64> undef
229;
Simon Pilgrim61116dd2015-09-17 20:32:45 +0000230 %1 = tail call <2 x i64> @llvm.x86.sse4a.insertqi(<2 x i64> %v, <2 x i64> %i, i8 48, i8 32)
231 ret <2 x i64> %1
232}
233
Simon Pilgrim61116dd2015-09-17 20:32:45 +0000234define <2 x i64> @testUndefinedInsertq_3(<2 x i64> %v, <2 x i64> %i) {
Simon Pilgrim74b3bfd2016-04-19 12:56:46 +0000235; CHECK-LABEL: @testUndefinedInsertq_3(
236; CHECK-NEXT: ret <2 x i64> undef
237;
Simon Pilgrim61116dd2015-09-17 20:32:45 +0000238 %1 = tail call <2 x i64> @llvm.x86.sse4a.insertqi(<2 x i64> %v, <2 x i64> %i, i8 64, i8 16)
239 ret <2 x i64> %1
240}
241
242;
243; Vector Demanded Bits
244;
245
Simon Pilgrim216b1bf2015-10-17 11:40:05 +0000246define <2 x i64> @test_extrq_arg0(<2 x i64> %x, <16 x i8> %y) {
Simon Pilgrim74b3bfd2016-04-19 12:56:46 +0000247; CHECK-LABEL: @test_extrq_arg0(
248; CHECK-NEXT: [[TMP1:%.*]] = tail call <2 x i64> @llvm.x86.sse4a.extrq(<2 x i64> %x, <16 x i8> %y) #1
249; CHECK-NEXT: ret <2 x i64> [[TMP1]]
250;
Simon Pilgrim61116dd2015-09-17 20:32:45 +0000251 %1 = shufflevector <2 x i64> %x, <2 x i64> undef, <2 x i32> <i32 0, i32 0>
252 %2 = tail call <2 x i64> @llvm.x86.sse4a.extrq(<2 x i64> %1, <16 x i8> %y) nounwind
253 ret <2 x i64> %2
254}
255
Simon Pilgrim216b1bf2015-10-17 11:40:05 +0000256define <2 x i64> @test_extrq_arg1(<2 x i64> %x, <16 x i8> %y) {
Simon Pilgrim74b3bfd2016-04-19 12:56:46 +0000257; CHECK-LABEL: @test_extrq_arg1(
258; CHECK-NEXT: [[TMP1:%.*]] = tail call <2 x i64> @llvm.x86.sse4a.extrq(<2 x i64> %x, <16 x i8> %y) #1
259; CHECK-NEXT: ret <2 x i64> [[TMP1]]
260;
Simon Pilgrim61116dd2015-09-17 20:32:45 +0000261 %1 = shufflevector <16 x i8> %y, <16 x i8> undef, <16 x i32> <i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0>
262 %2 = tail call <2 x i64> @llvm.x86.sse4a.extrq(<2 x i64> %x, <16 x i8> %1) nounwind
263 ret <2 x i64> %2
264}
265
Simon Pilgrim216b1bf2015-10-17 11:40:05 +0000266define <2 x i64> @test_extrq_args01(<2 x i64> %x, <16 x i8> %y) {
Simon Pilgrim74b3bfd2016-04-19 12:56:46 +0000267; CHECK-LABEL: @test_extrq_args01(
268; CHECK-NEXT: [[TMP1:%.*]] = tail call <2 x i64> @llvm.x86.sse4a.extrq(<2 x i64> %x, <16 x i8> %y) #1
269; CHECK-NEXT: ret <2 x i64> [[TMP1]]
270;
Simon Pilgrim61116dd2015-09-17 20:32:45 +0000271 %1 = shufflevector <2 x i64> %x, <2 x i64> undef, <2 x i32> <i32 0, i32 0>
272 %2 = shufflevector <16 x i8> %y, <16 x i8> undef, <16 x i32> <i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0>
273 %3 = tail call <2 x i64> @llvm.x86.sse4a.extrq(<2 x i64> %1, <16 x i8> %2) nounwind
274 ret <2 x i64> %3
275}
276
Simon Pilgrim216b1bf2015-10-17 11:40:05 +0000277define <2 x i64> @test_extrq_ret(<2 x i64> %x, <16 x i8> %y) {
Simon Pilgrim74b3bfd2016-04-19 12:56:46 +0000278; CHECK-LABEL: @test_extrq_ret(
279; CHECK-NEXT: ret <2 x i64> undef
280;
Simon Pilgrim61116dd2015-09-17 20:32:45 +0000281 %1 = tail call <2 x i64> @llvm.x86.sse4a.extrq(<2 x i64> %x, <16 x i8> %y) nounwind
282 %2 = shufflevector <2 x i64> %1, <2 x i64> undef, <2 x i32> <i32 1, i32 1>
283 ret <2 x i64> %2
284}
285
Simon Pilgrim216b1bf2015-10-17 11:40:05 +0000286define <2 x i64> @test_extrqi_arg0(<2 x i64> %x) {
Simon Pilgrim74b3bfd2016-04-19 12:56:46 +0000287; CHECK-LABEL: @test_extrqi_arg0(
288; CHECK-NEXT: [[TMP1:%.*]] = tail call <2 x i64> @llvm.x86.sse4a.extrqi(<2 x i64> %x, i8 3, i8 2)
289; CHECK-NEXT: ret <2 x i64> [[TMP1]]
290;
Simon Pilgrim61116dd2015-09-17 20:32:45 +0000291 %1 = shufflevector <2 x i64> %x, <2 x i64> undef, <2 x i32> <i32 0, i32 0>
292 %2 = tail call <2 x i64> @llvm.x86.sse4a.extrqi(<2 x i64> %1, i8 3, i8 2)
293 ret <2 x i64> %2
294}
295
Simon Pilgrim216b1bf2015-10-17 11:40:05 +0000296define <2 x i64> @test_extrqi_ret(<2 x i64> %x) {
Simon Pilgrim74b3bfd2016-04-19 12:56:46 +0000297; CHECK-LABEL: @test_extrqi_ret(
298; CHECK-NEXT: ret <2 x i64> undef
299;
Simon Pilgrim61116dd2015-09-17 20:32:45 +0000300 %1 = tail call <2 x i64> @llvm.x86.sse4a.extrqi(<2 x i64> %x, i8 3, i8 2) nounwind
301 %2 = shufflevector <2 x i64> %1, <2 x i64> undef, <2 x i32> <i32 1, i32 1>
302 ret <2 x i64> %2
303}
304
Simon Pilgrim216b1bf2015-10-17 11:40:05 +0000305define <2 x i64> @test_insertq_arg0(<2 x i64> %x, <2 x i64> %y) {
Simon Pilgrim74b3bfd2016-04-19 12:56:46 +0000306; CHECK-LABEL: @test_insertq_arg0(
307; CHECK-NEXT: [[TMP1:%.*]] = tail call <2 x i64> @llvm.x86.sse4a.insertq(<2 x i64> %x, <2 x i64> %y) #1
308; CHECK-NEXT: ret <2 x i64> [[TMP1]]
309;
Simon Pilgrim61116dd2015-09-17 20:32:45 +0000310 %1 = shufflevector <2 x i64> %x, <2 x i64> undef, <2 x i32> <i32 0, i32 0>
311 %2 = tail call <2 x i64> @llvm.x86.sse4a.insertq(<2 x i64> %1, <2 x i64> %y) nounwind
312 ret <2 x i64> %2
313}
314
Simon Pilgrim216b1bf2015-10-17 11:40:05 +0000315define <2 x i64> @test_insertq_ret(<2 x i64> %x, <2 x i64> %y) {
Simon Pilgrim74b3bfd2016-04-19 12:56:46 +0000316; CHECK-LABEL: @test_insertq_ret(
317; CHECK-NEXT: ret <2 x i64> undef
318;
Simon Pilgrim61116dd2015-09-17 20:32:45 +0000319 %1 = tail call <2 x i64> @llvm.x86.sse4a.insertq(<2 x i64> %x, <2 x i64> %y) nounwind
320 %2 = shufflevector <2 x i64> %1, <2 x i64> undef, <2 x i32> <i32 1, i32 1>
321 ret <2 x i64> %2
322}
323
Simon Pilgrim216b1bf2015-10-17 11:40:05 +0000324define <2 x i64> @test_insertqi_arg0(<2 x i64> %x, <2 x i64> %y) {
Simon Pilgrim74b3bfd2016-04-19 12:56:46 +0000325; CHECK-LABEL: @test_insertqi_arg0(
326; CHECK-NEXT: [[TMP1:%.*]] = tail call <2 x i64> @llvm.x86.sse4a.insertqi(<2 x i64> %x, <2 x i64> %y, i8 3, i8 2) #1
327; CHECK-NEXT: ret <2 x i64> [[TMP1]]
328;
Simon Pilgrim61116dd2015-09-17 20:32:45 +0000329 %1 = shufflevector <2 x i64> %x, <2 x i64> undef, <2 x i32> <i32 0, i32 0>
330 %2 = tail call <2 x i64> @llvm.x86.sse4a.insertqi(<2 x i64> %1, <2 x i64> %y, i8 3, i8 2) nounwind
331 ret <2 x i64> %2
332}
333
Simon Pilgrim216b1bf2015-10-17 11:40:05 +0000334define <2 x i64> @test_insertqi_arg1(<2 x i64> %x, <2 x i64> %y) {
Simon Pilgrim74b3bfd2016-04-19 12:56:46 +0000335; CHECK-LABEL: @test_insertqi_arg1(
336; CHECK-NEXT: [[TMP1:%.*]] = tail call <2 x i64> @llvm.x86.sse4a.insertqi(<2 x i64> %x, <2 x i64> %y, i8 3, i8 2) #1
337; CHECK-NEXT: ret <2 x i64> [[TMP1]]
338;
Simon Pilgrim61116dd2015-09-17 20:32:45 +0000339 %1 = shufflevector <2 x i64> %y, <2 x i64> undef, <2 x i32> <i32 0, i32 0>
340 %2 = tail call <2 x i64> @llvm.x86.sse4a.insertqi(<2 x i64> %x, <2 x i64> %1, i8 3, i8 2) nounwind
341 ret <2 x i64> %2
342}
343
Simon Pilgrim216b1bf2015-10-17 11:40:05 +0000344define <2 x i64> @test_insertqi_args01(<2 x i64> %x, <2 x i64> %y) {
Simon Pilgrim74b3bfd2016-04-19 12:56:46 +0000345; CHECK-LABEL: @test_insertqi_args01(
346; CHECK-NEXT: [[TMP1:%.*]] = tail call <2 x i64> @llvm.x86.sse4a.insertqi(<2 x i64> %x, <2 x i64> %y, i8 3, i8 2) #1
347; CHECK-NEXT: ret <2 x i64> [[TMP1]]
348;
Simon Pilgrim61116dd2015-09-17 20:32:45 +0000349 %1 = shufflevector <2 x i64> %x, <2 x i64> undef, <2 x i32> <i32 0, i32 0>
350 %2 = shufflevector <2 x i64> %y, <2 x i64> undef, <2 x i32> <i32 0, i32 0>
351 %3 = tail call <2 x i64> @llvm.x86.sse4a.insertqi(<2 x i64> %1, <2 x i64> %2, i8 3, i8 2) nounwind
352 ret <2 x i64> %3
353}
354
Simon Pilgrim216b1bf2015-10-17 11:40:05 +0000355define <2 x i64> @test_insertqi_ret(<2 x i64> %x, <2 x i64> %y) {
Simon Pilgrim74b3bfd2016-04-19 12:56:46 +0000356; CHECK-LABEL: @test_insertqi_ret(
357; CHECK-NEXT: ret <2 x i64> undef
358;
Simon Pilgrim61116dd2015-09-17 20:32:45 +0000359 %1 = tail call <2 x i64> @llvm.x86.sse4a.insertqi(<2 x i64> %x, <2 x i64> %y, i8 3, i8 2) nounwind
360 %2 = shufflevector <2 x i64> %1, <2 x i64> undef, <2 x i32> <i32 1, i32 1>
361 ret <2 x i64> %2
362}
363
364; CHECK: declare <2 x i64> @llvm.x86.sse4a.extrq
365declare <2 x i64> @llvm.x86.sse4a.extrq(<2 x i64>, <16 x i8>) nounwind
366
367; CHECK: declare <2 x i64> @llvm.x86.sse4a.extrqi
368declare <2 x i64> @llvm.x86.sse4a.extrqi(<2 x i64>, i8, i8) nounwind
369
370; CHECK: declare <2 x i64> @llvm.x86.sse4a.insertq
371declare <2 x i64> @llvm.x86.sse4a.insertq(<2 x i64>, <2 x i64>) nounwind
372
373; CHECK: declare <2 x i64> @llvm.x86.sse4a.insertqi
374declare <2 x i64> @llvm.x86.sse4a.insertqi(<2 x i64>, <2 x i64>, i8, i8) nounwind