1 ; RUN: llvm-reduce --abort-on-invalid-reduction --delta-passes=opcodes --test FileCheck --test-arg --check-prefix=ALL --test-arg %s --test-arg --input-file %s -o %t
2 ; RUN: FileCheck -check-prefixes=RESULT,ALL %s < %t
4 target datalayout = "A5"
6 declare token @llvm.return.token()
7 declare void @llvm.uses.token(token)
9 ; ALL-LABEL: @call_token(
10 ; RESULT-NEXT: %token = call token @llvm.return.token()
11 ; RESULT-NEXT: call void @llvm.uses.token(token %token)
12 ; RESULT-NEXT: ret void
13 define void @call_token() {
14 %token = call token @llvm.return.token()
15 call void @llvm.uses.token(token %token)
19 ; ALL-LABEL: @call_void_0_size_arg(
20 ; RESULT-NEXT: store volatile {} %arg, ptr addrspace(5) null, align 1
21 ; RESULT-NEXT: ret void
22 define void @call_void_0_size_arg({} %arg) {
23 call void @void_0_size_arg({} %arg)
27 ; ALL-LABEL: @call_return_0_size(
28 ; RESULT-NEXT: %op = load volatile {}, ptr %ptr, align 1
29 ; RESULT-NEXT: ret {} %op
30 define {} @call_return_0_size(ptr %ptr) {
31 %op = call {} @return_0_size(ptr %ptr)
35 ; ALL-LABEL: define void @call_void_no_args(
36 ; RESULT-NEXT: store volatile i32 0, ptr addrspace(5) null, align 4
37 ; RESULT-NEXT: ret void
38 define void @call_void_no_args() {
39 call void @void_no_args()
43 ; ALL-LABEL: @call_store_like_i16(
44 ; RESULT-NEXT: store volatile i16 %val, ptr addrspace(1) %ptr, align 2
45 ; RESULT-NEXT: ret void
46 define void @call_store_like_i16(i16 %val, ptr addrspace(1) %ptr) {
47 call void @store_like_i16(i16 %val, ptr addrspace(1) %ptr)
51 ; ALL-LABEL: @keep_call_store_like_i16(
52 ; ALL-NEXT: call void @store_like_i16(i16 %val, ptr addrspace(1) %ptr)
54 define void @keep_call_store_like_i16(i16 %val, ptr addrspace(1) %ptr) {
55 call void @store_like_i16(i16 %val, ptr addrspace(1) %ptr)
59 ; ALL-LABEL: @call_store_like_i16_swap(
60 ; RESULT-NEXT: store volatile i16 %val, ptr addrspace(1) %ptr
61 ; RESULT-NEXT: ret void
62 define void @call_store_like_i16_swap(ptr addrspace(1) %ptr, i16 %val) {
63 call void @store_like_i16_swap(ptr addrspace(1) %ptr, i16 %val)
67 ; ALL-LABEL: @call_store_like_i16_extra_arg(
68 ; RESULT-NEXT: call void @store_like_i16_extra_arg(i16 %val, ptr addrspace(1) %ptr, i32 %extra)
69 ; RESULT-NEXT: ret void
70 define void @call_store_like_i16_extra_arg(i16 %val, ptr addrspace(1) %ptr, i32 %extra) {
71 call void @store_like_i16_extra_arg(i16 %val, ptr addrspace(1) %ptr, i32 %extra)
75 ; ALL-LABEL: @call_store_like_i16_extra_ptr_arg(
76 ; RESULT-NEXT: call void @store_like_i16_extra_ptr_arg(i16 %val, ptr addrspace(1) %ptr, ptr addrspace(1) %extra)
77 ; RESULT-NEXT: ret void
78 define void @call_store_like_i16_extra_ptr_arg(i16 %val, ptr addrspace(1) %ptr, ptr addrspace(1) %extra) {
79 call void @store_like_i16_extra_ptr_arg(i16 %val, ptr addrspace(1) %ptr, ptr addrspace(1) %extra)
83 ; ALL-LABEL: @call_store_like_ptr_store(
84 ; RESULT-NEXT: store volatile ptr addrspace(1) %ptr, ptr addrspace(3) %ptr.val, align 8
85 ; RESULT-NEXT: ret void
86 define void @call_store_like_ptr_store(ptr addrspace(3) %ptr.val, ptr addrspace(1) %ptr) {
87 call void @store_like_ptr_store(ptr addrspace(3) %ptr.val, ptr addrspace(1) %ptr)
91 ; ALL-LABEL: @call_store_like_ptr_store_swap(
92 ; RESULT-NEXT: store volatile ptr addrspace(3) %ptr.val, ptr addrspace(1) %ptr, align 8
93 ; RESULT-NEXT: ret void
94 define void @call_store_like_ptr_store_swap(ptr addrspace(1) %ptr, ptr addrspace(3) %ptr.val) {
95 call void @store_like_ptr_store_swap(ptr addrspace(1) %ptr, ptr addrspace(3) %ptr.val)
99 ; ALL-LABEL: @call_store_like_ptr_store_different_element_type(
100 ; RESULT-NEXT: store volatile ptr addrspace(1) %ptr, ptr addrspace(3) %ptr.val, align 8
101 ; RESULT-NEXT: ret void
102 define void @call_store_like_ptr_store_different_element_type(ptr addrspace(3) %ptr.val, ptr addrspace(1) %ptr) {
103 call void @store_like_ptr_store_different_element_type(ptr addrspace(3) %ptr.val, ptr addrspace(1) %ptr)
107 ; ALL-LABEL: @call_store_like_ptr_store_different_element_type_swap(
108 ; RESULT-NEXT: store volatile ptr addrspace(3) %ptr.val, ptr addrspace(1) %ptr, align 8
109 ; RESULT-NEXT: ret void
110 define void @call_store_like_ptr_store_different_element_type_swap(ptr addrspace(1) %ptr, ptr addrspace(3) %ptr.val) {
111 call void @store_like_ptr_store_different_element_type_swap(ptr addrspace(1) %ptr, ptr addrspace(3) %ptr.val)
115 ; ALL-LABEL: @call_load_like_i32(
116 ; RESULT-NEXT: %op = load volatile i32, ptr addrspace(1) %ptr, align 4
117 ; RESULT-NEXT: ret i32 %op
118 define i32 @call_load_like_i32(ptr addrspace(1) %ptr) {
119 %op = call i32 @load_like_i32(ptr addrspace(1) %ptr)
123 ; ALL-LABEL: @keep_call_load_like_i32(
124 ; ALL-NEXT: %op = call i32 @load_like_i32(ptr addrspace(1) %ptr)
125 ; ALL-NEXT: ret i32 %op
126 define i32 @keep_call_load_like_i32(ptr addrspace(1) %ptr) {
127 %op = call i32 @load_like_i32(ptr addrspace(1) %ptr)
131 ; ALL-LABEL: @call_load_like_i32_extra_arg(
132 ; RESULT-NEXT: %op = call i32 @load_like_i32_extra_arg(ptr addrspace(1) %ptr, i32 %extra)
133 ; RESULT-NEXT: ret i32 %op
134 define i32 @call_load_like_i32_extra_arg(ptr addrspace(1) %ptr, i32 %extra) {
135 %op = call i32 @load_like_i32_extra_arg(ptr addrspace(1) %ptr, i32 %extra)
139 ; ALL-LABEL: @call_load_like_ptr_mismatch(
140 ; RESULT-NEXT: %op = load volatile i32, ptr addrspace(1) %ptr, align 4
141 ; RESULT-NEXT: ret i32 %op
142 define i32 @call_load_like_ptr_mismatch(ptr addrspace(1) %ptr) {
143 %op = call i32 @load_like_ptr_mismatch(ptr addrspace(1) %ptr)
147 ; ALL-LABEL: @call_load_like_skip_arg(
148 ; RESULT-NEXT: %op = load volatile i32, ptr addrspace(1) %ptr, align 4
149 ; RESULT-NEXT: ret i32 %op
150 define i32 @call_load_like_skip_arg(float, ptr addrspace(1) %ptr) {
151 %op = call i32 @load_like_skip_arg(float poison, ptr addrspace(1) %ptr)
155 ; ALL-LABEL: @call_fp_scalar_noargs(
156 ; RESULT-NEXT: %op = load volatile float, ptr addrspace(5) null, align 4
157 ; RESULT-NEXT: ret float %op
158 define float @call_fp_scalar_noargs() {
159 %op = call nsz float @fp_scalar_noargs()
163 ; ALL-LABEL: @call_fp_vector_noargs(
164 ; RESULT-NEXT: %op = load volatile <2 x half>, ptr addrspace(5) null, align 4
165 ; RESULT-NEXT: ret <2 x half> %op
166 define <2 x half> @call_fp_vector_noargs() {
167 %op = call nsz <2 x half> @fp_vector_noargs()
171 ; ALL-LABEL: @call_unary_fp_scalar(
172 ; RESULT-NEXT: %op = fneg nsz float %a
173 ; RESULT-NEXT: ret float %op
174 define float @call_unary_fp_scalar(float %a) {
175 %op = call nsz float @unary_fp_scalar(float %a)
179 ; ALL-LABEL: @call_unary_fp_vector(
180 ; RESULT-NEXT: %op = fneg nsz <2 x half> %a
181 ; RESULT-NEXT: ret <2 x half> %op
182 define <2 x half> @call_unary_fp_vector(<2 x half> %a) {
183 %op = call nsz <2 x half> @unary_fp_vector(<2 x half> %a)
187 ; ALL-LABEL: @ignore_undef_args_unary_fp(
188 ; RESULT-NEXT: %op = fneg nnan float %a
189 ; RESULT-NEXT: ret float %op
190 define float @ignore_undef_args_unary_fp(float %a) {
191 %op = call nnan float @func_i32_f32_i32(i32 poison, float %a, i32 poison)
195 ; ALL-LABEL: @call_binary_fp_scalar(
196 ; RESULT: %op = fmul afn float %a, %b
197 ; RESULT-NEXT: ret float %op
198 define float @call_binary_fp_scalar(float %a, float %b) {
199 %op = call afn float @binary_fp_scalar(float %a, float %b)
203 ; ALL-LABEL: @call_binary_fp_vector(
204 ; RESULT-NEXT: %op = fmul afn <2 x half> %a, %b
205 ; RESULT-NEXT: ret <2 x half> %op
206 define <2 x half> @call_binary_fp_vector(<2 x half> %a, <2 x half> %b) {
207 %op = call afn <2 x half> @binary_fp_vector(<2 x half> %a, <2 x half> %b)
211 ; ALL-LABEL: @call_ternary_fp_scalar(
212 ; RESULT-NEXT: %op = call afn float @llvm.fma.f32(float %a, float %b, float %c)
213 ; RESULT-NEXT: ret float %op
214 define float @call_ternary_fp_scalar(float %a, float %b, float %c) {
215 %op = call afn float @ternary_fp_scalar(float %a, float %b, float %c)
219 ; ALL-LABEL: @call_ternary_fp_vector(
220 ; RESULT-NEXT: %op = call afn <2 x half> @llvm.fma.v2f16(<2 x half> %a, <2 x half> %b, <2 x half> %c)
221 ; RESULT-NEXT: ret <2 x half> %op
222 define <2 x half> @call_ternary_fp_vector(<2 x half> %a, <2 x half> %b, <2 x half> %c) {
223 %op = call afn <2 x half> @ternary_fp_vector(<2 x half> %a, <2 x half> %b, <2 x half> %c)
227 ; ALL-LABEL: @call_unary_int_scalar(
228 ; RESULT-NEXT: %op = call i32 @llvm.bswap.i32(i32 %a)
229 ; RESULT-NEXT: ret i32 %op
230 define i32 @call_unary_int_scalar(i32 %a) {
231 %op = call i32 @unary_int_scalar(i32 %a)
235 ; ALL-LABEL: @call_unary_int_vector(
236 ; RESULT-NEXT: %op = call <2 x i16> @llvm.bswap.v2i16(<2 x i16> %a)
237 ; RESULT-NEXT: ret <2 x i16> %op
238 define <2 x i16> @call_unary_int_vector(<2 x i16> %a) {
239 %op = call <2 x i16> @unary_int_vector(<2 x i16> %a)
243 ; ALL-LABEL: @call_binary_int_scalar(
244 ; RESULT-NEXT: %op = and i32 %a, %b
245 ; RESULT-NEXT: ret i32 %op
246 define i32 @call_binary_int_scalar(i32 %a, i32 %b) {
247 %op = call i32 @binary_int_scalar(i32 %a, i32 %b)
251 ; ALL-LABEL: @call_binary_int_vector(
252 ; RESULT-NEXT: %op = and <2 x i16> %a, %b
253 ; RESULT-NEXT: ret <2 x i16> %op
254 define <2 x i16> @call_binary_int_vector(<2 x i16> %a, <2 x i16> %b) {
255 %op = call <2 x i16> @binary_int_vector(<2 x i16> %a, <2 x i16> %b)
259 ; ALL-LABEL: @call_ternary_int_scalar(
260 ; RESULT-NEXT: %op = call i32 @llvm.fshl.i32(i32 %a, i32 %b, i32 %c)
261 ; RESULT-NEXT: ret i32 %op
262 define i32 @call_ternary_int_scalar(i32 %a, i32 %b, i32 %c) {
263 %op = call i32 @ternary_int_scalar(i32 %a, i32 %b, i32 %c)
267 ; ALL-LABEL: @call_ternary_int_vector(
268 ; RESULT-NEXT: %op = call <2 x i16> @llvm.fshl.v2i16(<2 x i16> %a, <2 x i16> %b, <2 x i16> %c)
269 ; RESULT-NEXT: ret <2 x i16> %op
270 define <2 x i16> @call_ternary_int_vector(<2 x i16> %a, <2 x i16> %b, <2 x i16> %c) {
271 %op = call <2 x i16> @ternary_int_vector(<2 x i16> %a, <2 x i16> %b, <2 x i16> %c)
275 ; ALL-LABEL: @call_quaternary_int_scalar(
276 ; RESULT-NEXT: %op = call i32 @quaternary_int_scalar(i32 %a, i32 %b, i32 %c, i32 %d)
277 ; RESULT-NEXT: ret i32 %op
278 define i32 @call_quaternary_int_scalar(i32 %a, i32 %b, i32 %c, i32 %d) {
279 %op = call i32 @quaternary_int_scalar(i32 %a, i32 %b, i32 %c, i32 %d)
283 ; ALL-LABEL: @call_quaternary_int_vector(
284 ; RESULT-NEXT: %op = call <2 x i16> @quaternary_int_vector(<2 x i16> %a, <2 x i16> %b, <2 x i16> %c, <2 x i16> %d)
285 ; RESULT-NEXT: ret <2 x i16> %op
286 define <2 x i16> @call_quaternary_int_vector(<2 x i16> %a, <2 x i16> %b, <2 x i16> %c, <2 x i16> %d) {
287 %op = call <2 x i16> @quaternary_int_vector(<2 x i16> %a, <2 x i16> %b, <2 x i16> %c, <2 x i16> %d)
291 declare void @void_0_size_arg({})
292 declare {} @return_0_size(ptr)
293 declare void @void_no_args()
294 declare void @store_like_i16(i16, ptr addrspace(1))
295 declare void @store_like_i16_swap(ptr addrspace(1), i16)
296 declare void @store_like_i16_extra_arg(i16, ptr addrspace(1), i32)
297 declare void @store_like_i16_extra_ptr_arg(i16, ptr addrspace(1), ptr addrspace(1))
298 declare void @store_like_ptr_store(ptr addrspace(3), ptr addrspace(1))
299 declare void @store_like_ptr_store_swap(ptr addrspace(1), ptr addrspace(3))
300 declare void @store_like_ptr_store_different_element_type(ptr addrspace(3), ptr addrspace(1))
301 declare void @store_like_ptr_store_different_element_type_swap(ptr addrspace(1), ptr addrspace(3))
302 declare i32 @load_like_i32(ptr addrspace(1))
304 declare i32 @load_like_i32_extra_arg(ptr addrspace(1), i32)
306 declare i32 @load_like_ptr_mismatch(ptr addrspace(1))
307 declare i32 @load_like_skip_arg(float, ptr addrspace(1))
309 declare float @fp_scalar_noargs()
310 declare i32 @int_scalar_noargs()
312 declare <2 x half> @fp_vector_noargs()
313 declare <2 x i16> @int_vector_noargs()
315 declare float @unary_fp_scalar(float)
316 declare <2 x half> @unary_fp_vector(<2 x half>)
317 declare float @func_i32_f32_i32(i32, float, i32)
319 declare float @binary_fp_scalar(float, float)
320 declare <2 x half> @binary_fp_vector(<2 x half>, <2 x half>)
322 declare float @ternary_fp_scalar(float, float, float)
323 declare <2 x half> @ternary_fp_vector(<2 x half>, <2 x half>, <2 x half>)
325 declare float @quaternary_fp_scalar(float, float, float, float)
326 declare <2 x half> @quaternary_fp_vector(<2 x half>, <2 x half>, <2 x half>, <2 x half>)
328 declare i32 @unary_int_scalar(i32)
329 declare <2 x i16> @unary_int_vector(<2 x i16>)
330 declare i32 @binary_int_scalar(i32, i32)
331 declare <2 x i16> @binary_int_vector(<2 x i16>, <2 x i16>)
332 declare i32 @ternary_int_scalar(i32, i32, i32)
333 declare <2 x i16> @ternary_int_vector(<2 x i16>, <2 x i16>, <2 x i16>)
334 declare i32 @quaternary_int_scalar(i32, i32, i32, i32)
335 declare <2 x i16> @quaternary_int_vector(<2 x i16>, <2 x i16>, <2 x i16>, <2 x i16>)