1 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
2 ; RUN: opt < %s -instcombine -S | FileCheck %s
4 declare <2 x i64> @llvm.x86.pclmulqdq(<2 x i64>, <2 x i64>, i8)
5 declare <4 x i64> @llvm.x86.pclmulqdq.256(<4 x i64>, <4 x i64>, i8)
6 declare <8 x i64> @llvm.x86.pclmulqdq.512(<8 x i64>, <8 x i64>, i8)
8 define <2 x i64> @test_demanded_elts_pclmulqdq_0(<2 x i64> %a0, <2 x i64> %a1) {
9 ; CHECK-LABEL: @test_demanded_elts_pclmulqdq_0(
10 ; CHECK-NEXT: [[TMP1:%.*]] = call <2 x i64> @llvm.x86.pclmulqdq(<2 x i64> [[A0:%.*]], <2 x i64> [[A1:%.*]], i8 0)
11 ; CHECK-NEXT: ret <2 x i64> [[TMP1]]
13 %1 = insertelement <2 x i64> %a0, i64 1, i64 1
14 %2 = insertelement <2 x i64> %a1, i64 1, i64 1
15 %3 = call <2 x i64> @llvm.x86.pclmulqdq(<2 x i64> %1, <2 x i64> %2, i8 0)
19 define <2 x i64> @test_demanded_elts_pclmulqdq_1(<2 x i64> %a0, <2 x i64> %a1) {
20 ; CHECK-LABEL: @test_demanded_elts_pclmulqdq_1(
21 ; CHECK-NEXT: [[TMP1:%.*]] = call <2 x i64> @llvm.x86.pclmulqdq(<2 x i64> <i64 undef, i64 1>, <2 x i64> [[A1:%.*]], i8 1)
22 ; CHECK-NEXT: ret <2 x i64> [[TMP1]]
24 %1 = insertelement <2 x i64> %a0, i64 1, i64 1
25 %2 = insertelement <2 x i64> %a1, i64 1, i64 1
26 %3 = call <2 x i64> @llvm.x86.pclmulqdq(<2 x i64> %1, <2 x i64> %2, i8 1)
30 define <2 x i64> @test_demanded_elts_pclmulqdq_16(<2 x i64> %a0, <2 x i64> %a1) {
31 ; CHECK-LABEL: @test_demanded_elts_pclmulqdq_16(
32 ; CHECK-NEXT: [[TMP1:%.*]] = call <2 x i64> @llvm.x86.pclmulqdq(<2 x i64> [[A0:%.*]], <2 x i64> <i64 undef, i64 1>, i8 16)
33 ; CHECK-NEXT: ret <2 x i64> [[TMP1]]
35 %1 = insertelement <2 x i64> %a0, i64 1, i64 1
36 %2 = insertelement <2 x i64> %a1, i64 1, i64 1
37 %3 = call <2 x i64> @llvm.x86.pclmulqdq(<2 x i64> %1, <2 x i64> %2, i8 16)
41 define <2 x i64> @test_demanded_elts_pclmulqdq_17(<2 x i64> %a0, <2 x i64> %a1) {
42 ; CHECK-LABEL: @test_demanded_elts_pclmulqdq_17(
43 ; CHECK-NEXT: [[TMP1:%.*]] = call <2 x i64> @llvm.x86.pclmulqdq(<2 x i64> <i64 undef, i64 1>, <2 x i64> <i64 undef, i64 1>, i8 17)
44 ; CHECK-NEXT: ret <2 x i64> [[TMP1]]
46 %1 = insertelement <2 x i64> %a0, i64 1, i64 1
47 %2 = insertelement <2 x i64> %a1, i64 1, i64 1
48 %3 = call <2 x i64> @llvm.x86.pclmulqdq(<2 x i64> %1, <2 x i64> %2, i8 17)
52 define <2 x i64> @test_demanded_elts_pclmulqdq_undef_0() {
53 ; CHECK-LABEL: @test_demanded_elts_pclmulqdq_undef_0(
54 ; CHECK-NEXT: ret <2 x i64> zeroinitializer
56 %1 = call <2 x i64> @llvm.x86.pclmulqdq(<2 x i64> <i64 undef, i64 1>, <2 x i64> <i64 undef, i64 1>, i8 0)
60 define <2 x i64> @test_demanded_elts_pclmulqdq_undef_1() {
61 ; CHECK-LABEL: @test_demanded_elts_pclmulqdq_undef_1(
62 ; CHECK-NEXT: ret <2 x i64> zeroinitializer
64 %1 = call <2 x i64> @llvm.x86.pclmulqdq(<2 x i64> <i64 1, i64 undef>, <2 x i64> <i64 undef, i64 1>, i8 1)
68 define <2 x i64> @test_demanded_elts_pclmulqdq_undef_16() {
69 ; CHECK-LABEL: @test_demanded_elts_pclmulqdq_undef_16(
70 ; CHECK-NEXT: ret <2 x i64> zeroinitializer
72 %1 = call <2 x i64> @llvm.x86.pclmulqdq(<2 x i64> <i64 undef, i64 1>, <2 x i64> <i64 1, i64 undef>, i8 16)
76 define <2 x i64> @test_demanded_elts_pclmulqdq_undef_17() {
77 ; CHECK-LABEL: @test_demanded_elts_pclmulqdq_undef_17(
78 ; CHECK-NEXT: ret <2 x i64> zeroinitializer
80 %1 = call <2 x i64> @llvm.x86.pclmulqdq(<2 x i64> <i64 1, i64 undef>, <2 x i64> <i64 1, i64 undef>, i8 17)
84 define <4 x i64> @test_demanded_elts_pclmulqdq_256_0(<4 x i64> %a0, <4 x i64> %a1) {
85 ; CHECK-LABEL: @test_demanded_elts_pclmulqdq_256_0(
86 ; CHECK-NEXT: [[RES:%.*]] = call <4 x i64> @llvm.x86.pclmulqdq.256(<4 x i64> [[A0:%.*]], <4 x i64> [[A1:%.*]], i8 0)
87 ; CHECK-NEXT: ret <4 x i64> [[RES]]
89 %1 = insertelement <4 x i64> %a0, i64 1, i64 1
90 %2 = insertelement <4 x i64> %a1, i64 1, i64 1
91 %3 = insertelement <4 x i64> %1, i64 1, i64 3
92 %4 = insertelement <4 x i64> %2, i64 1, i64 3
93 %res = call <4 x i64> @llvm.x86.pclmulqdq.256(<4 x i64> %3, <4 x i64> %4, i8 0)
97 define <4 x i64> @test_demanded_elts_pclmulqdq_256_1(<4 x i64> %a0, <4 x i64> %a1) {
98 ; CHECK-LABEL: @test_demanded_elts_pclmulqdq_256_1(
99 ; CHECK-NEXT: [[RES:%.*]] = call <4 x i64> @llvm.x86.pclmulqdq.256(<4 x i64> <i64 undef, i64 1, i64 undef, i64 1>, <4 x i64> [[A1:%.*]], i8 1)
100 ; CHECK-NEXT: ret <4 x i64> [[RES]]
102 %1 = insertelement <4 x i64> %a0, i64 1, i64 1
103 %2 = insertelement <4 x i64> %a1, i64 1, i64 1
104 %3 = insertelement <4 x i64> %1, i64 1, i64 3
105 %4 = insertelement <4 x i64> %2, i64 1, i64 3
106 %res = call <4 x i64> @llvm.x86.pclmulqdq.256(<4 x i64> %3, <4 x i64> %4, i8 1)
110 define <4 x i64> @test_demanded_elts_pclmulqdq_256_16(<4 x i64> %a0, <4 x i64> %a1) {
111 ; CHECK-LABEL: @test_demanded_elts_pclmulqdq_256_16(
112 ; CHECK-NEXT: [[RES:%.*]] = call <4 x i64> @llvm.x86.pclmulqdq.256(<4 x i64> [[A0:%.*]], <4 x i64> <i64 undef, i64 1, i64 undef, i64 1>, i8 16)
113 ; CHECK-NEXT: ret <4 x i64> [[RES]]
115 %1 = insertelement <4 x i64> %a0, i64 1, i64 1
116 %2 = insertelement <4 x i64> %a1, i64 1, i64 1
117 %3 = insertelement <4 x i64> %1, i64 1, i64 3
118 %4 = insertelement <4 x i64> %2, i64 1, i64 3
119 %res = call <4 x i64> @llvm.x86.pclmulqdq.256(<4 x i64> %3, <4 x i64> %4, i8 16)
123 define <4 x i64> @test_demanded_elts_pclmulqdq_256_17(<4 x i64> %a0, <4 x i64> %a1) {
124 ; CHECK-LABEL: @test_demanded_elts_pclmulqdq_256_17(
125 ; CHECK-NEXT: [[RES:%.*]] = call <4 x i64> @llvm.x86.pclmulqdq.256(<4 x i64> <i64 undef, i64 1, i64 undef, i64 1>, <4 x i64> <i64 undef, i64 1, i64 undef, i64 1>, i8 17)
126 ; CHECK-NEXT: ret <4 x i64> [[RES]]
128 %1 = insertelement <4 x i64> %a0, i64 1, i64 1
129 %2 = insertelement <4 x i64> %a1, i64 1, i64 1
130 %3 = insertelement <4 x i64> %1, i64 1, i64 3
131 %4 = insertelement <4 x i64> %2, i64 1, i64 3
132 %res = call <4 x i64> @llvm.x86.pclmulqdq.256(<4 x i64> %3, <4 x i64> %4, i8 17)
136 define <4 x i64> @test_demanded_elts_pclmulqdq_256_undef_0() {
137 ; CHECK-LABEL: @test_demanded_elts_pclmulqdq_256_undef_0(
138 ; CHECK-NEXT: ret <4 x i64> zeroinitializer
140 %1 = call <4 x i64> @llvm.x86.pclmulqdq.256(<4 x i64> <i64 undef, i64 1, i64 undef, i64 1>, <4 x i64> <i64 undef, i64 1, i64 undef, i64 1>, i8 0)
144 define <4 x i64> @test_demanded_elts_pclmulqdq_256_undef_1() {
145 ; CHECK-LABEL: @test_demanded_elts_pclmulqdq_256_undef_1(
146 ; CHECK-NEXT: ret <4 x i64> zeroinitializer
148 %1 = call <4 x i64> @llvm.x86.pclmulqdq.256(<4 x i64> <i64 1, i64 undef, i64 1, i64 undef>, <4 x i64> <i64 undef, i64 1, i64 undef, i64 1>, i8 1)
152 define <4 x i64> @test_demanded_elts_pclmulqdq_256_undef_16() {
153 ; CHECK-LABEL: @test_demanded_elts_pclmulqdq_256_undef_16(
154 ; CHECK-NEXT: ret <4 x i64> zeroinitializer
156 %1 = call <4 x i64> @llvm.x86.pclmulqdq.256(<4 x i64> <i64 undef, i64 1, i64 undef, i64 1>, <4 x i64> <i64 1, i64 undef, i64 1, i64 undef>, i8 16)
160 define <4 x i64> @test_demanded_elts_pclmulqdq_256_undef_17() {
161 ; CHECK-LABEL: @test_demanded_elts_pclmulqdq_256_undef_17(
162 ; CHECK-NEXT: ret <4 x i64> zeroinitializer
164 %1 = call <4 x i64> @llvm.x86.pclmulqdq.256(<4 x i64> <i64 1, i64 undef, i64 1, i64 undef>, <4 x i64> <i64 1, i64 undef, i64 1, i64 undef>, i8 17)
168 define <8 x i64> @test_demanded_elts_pclmulqdq_512_0(<8 x i64> %a0, <8 x i64> %a1) {
169 ; CHECK-LABEL: @test_demanded_elts_pclmulqdq_512_0(
170 ; CHECK-NEXT: [[RES:%.*]] = call <8 x i64> @llvm.x86.pclmulqdq.512(<8 x i64> [[A0:%.*]], <8 x i64> [[A1:%.*]], i8 0)
171 ; CHECK-NEXT: ret <8 x i64> [[RES]]
173 %1 = insertelement <8 x i64> %a0, i64 1, i64 1
174 %2 = insertelement <8 x i64> %a1, i64 1, i64 1
175 %3 = insertelement <8 x i64> %1, i64 1, i64 3
176 %4 = insertelement <8 x i64> %2, i64 1, i64 3
177 %5 = insertelement <8 x i64> %3, i64 1, i64 5
178 %6 = insertelement <8 x i64> %4, i64 1, i64 5
179 %7 = insertelement <8 x i64> %5, i64 1, i64 7
180 %8 = insertelement <8 x i64> %6, i64 1, i64 7
181 %res = call <8 x i64> @llvm.x86.pclmulqdq.512(<8 x i64> %7, <8 x i64> %8, i8 0)
185 define <8 x i64> @test_demanded_elts_pclmulqdq_512_1(<8 x i64> %a0, <8 x i64> %a1) {
186 ; CHECK-LABEL: @test_demanded_elts_pclmulqdq_512_1(
187 ; CHECK-NEXT: [[RES:%.*]] = call <8 x i64> @llvm.x86.pclmulqdq.512(<8 x i64> <i64 undef, i64 1, i64 undef, i64 1, i64 undef, i64 1, i64 undef, i64 1>, <8 x i64> [[A1:%.*]], i8 1)
188 ; CHECK-NEXT: ret <8 x i64> [[RES]]
190 %1 = insertelement <8 x i64> %a0, i64 1, i64 1
191 %2 = insertelement <8 x i64> %a1, i64 1, i64 1
192 %3 = insertelement <8 x i64> %1, i64 1, i64 3
193 %4 = insertelement <8 x i64> %2, i64 1, i64 3
194 %5 = insertelement <8 x i64> %3, i64 1, i64 5
195 %6 = insertelement <8 x i64> %4, i64 1, i64 5
196 %7 = insertelement <8 x i64> %5, i64 1, i64 7
197 %8 = insertelement <8 x i64> %6, i64 1, i64 7
198 %res = call <8 x i64> @llvm.x86.pclmulqdq.512(<8 x i64> %7, <8 x i64> %8, i8 1)
202 define <8 x i64> @test_demanded_elts_pclmulqdq_512_16(<8 x i64> %a0, <8 x i64> %a1) {
203 ; CHECK-LABEL: @test_demanded_elts_pclmulqdq_512_16(
204 ; CHECK-NEXT: [[RES:%.*]] = call <8 x i64> @llvm.x86.pclmulqdq.512(<8 x i64> [[A0:%.*]], <8 x i64> <i64 undef, i64 1, i64 undef, i64 1, i64 undef, i64 1, i64 undef, i64 1>, i8 16)
205 ; CHECK-NEXT: ret <8 x i64> [[RES]]
207 %1 = insertelement <8 x i64> %a0, i64 1, i64 1
208 %2 = insertelement <8 x i64> %a1, i64 1, i64 1
209 %3 = insertelement <8 x i64> %1, i64 1, i64 3
210 %4 = insertelement <8 x i64> %2, i64 1, i64 3
211 %5 = insertelement <8 x i64> %3, i64 1, i64 5
212 %6 = insertelement <8 x i64> %4, i64 1, i64 5
213 %7 = insertelement <8 x i64> %5, i64 1, i64 7
214 %8 = insertelement <8 x i64> %6, i64 1, i64 7
215 %res = call <8 x i64> @llvm.x86.pclmulqdq.512(<8 x i64> %7, <8 x i64> %8, i8 16)
219 define <8 x i64> @test_demanded_elts_pclmulqdq_512_17(<8 x i64> %a0, <8 x i64> %a1) {
220 ; CHECK-LABEL: @test_demanded_elts_pclmulqdq_512_17(
221 ; CHECK-NEXT: [[RES:%.*]] = call <8 x i64> @llvm.x86.pclmulqdq.512(<8 x i64> <i64 undef, i64 1, i64 undef, i64 1, i64 undef, i64 1, i64 undef, i64 1>, <8 x i64> <i64 undef, i64 1, i64 undef, i64 1, i64 undef, i64 1, i64 undef, i64 1>, i8 17)
222 ; CHECK-NEXT: ret <8 x i64> [[RES]]
224 %1 = insertelement <8 x i64> %a0, i64 1, i64 1
225 %2 = insertelement <8 x i64> %a1, i64 1, i64 1
226 %3 = insertelement <8 x i64> %1, i64 1, i64 3
227 %4 = insertelement <8 x i64> %2, i64 1, i64 3
228 %5 = insertelement <8 x i64> %3, i64 1, i64 5
229 %6 = insertelement <8 x i64> %4, i64 1, i64 5
230 %7 = insertelement <8 x i64> %5, i64 1, i64 7
231 %8 = insertelement <8 x i64> %6, i64 1, i64 7
232 %res = call <8 x i64> @llvm.x86.pclmulqdq.512(<8 x i64> %7, <8 x i64> %8, i8 17)
236 define <8 x i64> @test_demanded_elts_pclmulqdq_512_undef_0() {
237 ; CHECK-LABEL: @test_demanded_elts_pclmulqdq_512_undef_0(
238 ; CHECK-NEXT: ret <8 x i64> zeroinitializer
240 %1 = call <8 x i64> @llvm.x86.pclmulqdq.512(<8 x i64> <i64 undef, i64 1, i64 undef, i64 1, i64 undef, i64 1, i64 undef, i64 1>, <8 x i64> <i64 undef, i64 1, i64 undef, i64 1, i64 undef, i64 1, i64 undef, i64 1>, i8 0)
244 define <8 x i64> @test_demanded_elts_pclmulqdq_512_undef_1() {
245 ; CHECK-LABEL: @test_demanded_elts_pclmulqdq_512_undef_1(
246 ; CHECK-NEXT: ret <8 x i64> zeroinitializer
248 %1 = call <8 x i64> @llvm.x86.pclmulqdq.512(<8 x i64> <i64 1, i64 undef, i64 1, i64 undef, i64 1, i64 undef, i64 1, i64 undef>, <8 x i64> <i64 undef, i64 1, i64 undef, i64 1, i64 undef, i64 1, i64 undef, i64 1>, i8 1)
252 define <8 x i64> @test_demanded_elts_pclmulqdq_512_undef_16() {
253 ; CHECK-LABEL: @test_demanded_elts_pclmulqdq_512_undef_16(
254 ; CHECK-NEXT: ret <8 x i64> zeroinitializer
256 %1 = call <8 x i64> @llvm.x86.pclmulqdq.512(<8 x i64> <i64 undef, i64 1, i64 undef, i64 1, i64 undef, i64 1, i64 undef, i64 1>, <8 x i64> <i64 1, i64 undef, i64 1, i64 undef, i64 1, i64 undef, i64 1, i64 undef>, i8 16)
260 define <8 x i64> @test_demanded_elts_pclmulqdq_512_undef_17() {
261 ; CHECK-LABEL: @test_demanded_elts_pclmulqdq_512_undef_17(
262 ; CHECK-NEXT: ret <8 x i64> zeroinitializer
264 %1 = call <8 x i64> @llvm.x86.pclmulqdq.512(<8 x i64> <i64 1, i64 undef, i64 1, i64 undef, i64 1, i64 undef, i64 1, i64 undef>, <8 x i64> <i64 1, i64 undef, i64 1, i64 undef, i64 1, i64 undef, i64 1, i64 undef>, i8 17)