1 // NOTE
: Assertions have been autogenerated by utils
/update_cc_test_checks.py
2 // RUN
: %clang_cc1 -cl-std
=CL1.2 -triple amdgcn-amd-amdhsa -disable-llvm-passes -emit-llvm -o - %s | FileCheck %s
4 int printf
(__constant const char
* st
, ...
) __attribute__
((format(printf, 1, 2)));
6 // CHECK-LABEL
: @test_printf_noargs
(
8 // CHECK-NEXT
: [[CALL
:%.
*]] = call i32
(ptr addrspace
(4), ...
) @printf
(ptr addrspace
(4) noundef
@.str
) #[[ATTR4
:[0-
9]+]]
9 // CHECK-NEXT
: ret void
11 __kernel void test_printf_noargs
() {
15 // CHECK-LABEL
: @test_printf_int
(
17 // CHECK-NEXT
: [[I_ADDR
:%.
*]] = alloca i32
, align
4, addrspace
(5)
18 // CHECK-NEXT
: store i32
[[I
:%.
*]], ptr addrspace
(5) [[I_ADDR]], align 4, !tbaa [[TBAA8:![0-9]+]]
19 // CHECK-NEXT: [[TMP0:%.*]] = load i32, ptr addrspace(5) [[I_ADDR]], align
4, !tbaa
[[TBAA8]]
20 // CHECK-NEXT: [[CALL:%.*]] = call i32 (ptr addrspace(4), ...) @printf(ptr addrspace(4) noundef @.str.1, i32 noundef [[TMP0]]) #[[ATTR4]]
21 // CHECK-NEXT: ret void
23 __kernel void test_printf_int(int i) {
27 // CHECK-LABEL: @test_printf_str_int(
29 // CHECK-NEXT: [[I_ADDR:%.*]] = alloca i32, align 4, addrspace(5)
30 // CHECK-NEXT: [[S:%.*]] = alloca [4 x i8], align 1, addrspace(5)
31 // CHECK-NEXT: store i32 [[I:%.*]], ptr addrspace(5) [[I_ADDR]], align 4, !tbaa [[TBAA8]]
32 // CHECK-NEXT
: call void
@llvm.lifetime.start.p5
(i64 4, ptr addrspace
(5) [[S]]) #[[ATTR5:[0-9]+]]
33 // CHECK-NEXT: call void @llvm.memcpy.p5.p4.i64(ptr addrspace(5) align 1 [[S]], ptr addrspace
(4) align
1 @__const.test_printf_str_int.s
, i64
4, i1 false
)
34 // CHECK-NEXT
: [[ARRAYDECAY
:%.
*]] = getelementptr inbounds
[4 x i8
], ptr addrspace
(5) [[S]], i64 0, i64 0
35 // CHECK-NEXT: [[TMP2:%.*]] = load i32, ptr addrspace(5) [[I_ADDR]], align 4, !tbaa [[TBAA8]]
36 // CHECK-NEXT: [[CALL:%.*]] = call i32 (ptr addrspace(4), ...) @printf(ptr addrspace(4) noundef @.str.2, ptr addrspace(5) noundef [[ARRAYDECAY]], i32 noundef [[TMP2]]) #[[ATTR4]]
37 // CHECK-NEXT: call void @llvm.lifetime.end.p5(i64 4, ptr addrspace(5) [[S]]) #[[ATTR5]]
38 // CHECK-NEXT: ret void
40 __kernel void test_printf_str_int(int i) {
42 printf("%s:%d", s, i);