[flang] Don't needlessly instantiate distinct UNSIGNED cases for FINDLOC (#120471)
[llvm-project.git] / clang / test / CodeGen / variadic-nvptx.c
blob4c9776342c03e36e6cc3fd04dae066eab535a912
1 // NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py UTC_ARGS: --version 5
2 // RUN: %clang_cc1 -triple nvptx64-nvidia-cuda -emit-llvm -o - %s | FileCheck %s
4 extern void varargs_simple(int, ...);
6 // CHECK-LABEL: define dso_local void @foo(
7 // CHECK-SAME: ) #[[ATTR0:[0-9]+]] {
8 // CHECK-NEXT: [[ENTRY:.*:]]
9 // CHECK-NEXT: [[C:%.*]] = alloca i8, align 1
10 // CHECK-NEXT: [[S:%.*]] = alloca i16, align 2
11 // CHECK-NEXT: [[I:%.*]] = alloca i32, align 4
12 // CHECK-NEXT: [[L:%.*]] = alloca i64, align 8
13 // CHECK-NEXT: [[F:%.*]] = alloca float, align 4
14 // CHECK-NEXT: [[D:%.*]] = alloca double, align 8
15 // CHECK-NEXT: [[A:%.*]] = alloca [[STRUCT_ANON:%.*]], align 4
16 // CHECK-NEXT: [[V:%.*]] = alloca <4 x i32>, align 16
17 // CHECK-NEXT: [[T:%.*]] = alloca [[STRUCT_ANON_0:%.*]], align 1
18 // CHECK-NEXT: store i8 1, ptr [[C]], align 1
19 // CHECK-NEXT: store i16 1, ptr [[S]], align 2
20 // CHECK-NEXT: store i32 1, ptr [[I]], align 4
21 // CHECK-NEXT: store i64 1, ptr [[L]], align 8
22 // CHECK-NEXT: store float 1.000000e+00, ptr [[F]], align 4
23 // CHECK-NEXT: store double 1.000000e+00, ptr [[D]], align 8
24 // CHECK-NEXT: [[TMP0:%.*]] = load i8, ptr [[C]], align 1
25 // CHECK-NEXT: [[CONV:%.*]] = sext i8 [[TMP0]] to i32
26 // CHECK-NEXT: [[TMP1:%.*]] = load i16, ptr [[S]], align 2
27 // CHECK-NEXT: [[CONV1:%.*]] = sext i16 [[TMP1]] to i32
28 // CHECK-NEXT: [[TMP2:%.*]] = load i32, ptr [[I]], align 4
29 // CHECK-NEXT: [[TMP3:%.*]] = load i64, ptr [[L]], align 8
30 // CHECK-NEXT: [[TMP4:%.*]] = load float, ptr [[F]], align 4
31 // CHECK-NEXT: [[CONV2:%.*]] = fpext float [[TMP4]] to double
32 // CHECK-NEXT: [[TMP5:%.*]] = load double, ptr [[D]], align 8
33 // CHECK-NEXT: call void (i32, ...) @varargs_simple(i32 noundef 0, i32 noundef [[CONV]], i32 noundef [[CONV1]], i32 noundef [[TMP2]], i64 noundef [[TMP3]], double noundef [[CONV2]], double noundef [[TMP5]]) #[[ATTR3:[0-9]+]]
34 // CHECK-NEXT: call void @llvm.memcpy.p0.p0.i64(ptr align 4 [[A]], ptr align 4 @__const.foo.a, i64 12, i1 false)
35 // CHECK-NEXT: [[TMP6:%.*]] = getelementptr inbounds nuw [[STRUCT_ANON]], ptr [[A]], i32 0, i32 0
36 // CHECK-NEXT: [[TMP7:%.*]] = load i32, ptr [[TMP6]], align 4
37 // CHECK-NEXT: [[TMP8:%.*]] = getelementptr inbounds nuw [[STRUCT_ANON]], ptr [[A]], i32 0, i32 1
38 // CHECK-NEXT: [[TMP9:%.*]] = load i8, ptr [[TMP8]], align 4
39 // CHECK-NEXT: [[TMP10:%.*]] = getelementptr inbounds nuw [[STRUCT_ANON]], ptr [[A]], i32 0, i32 2
40 // CHECK-NEXT: [[TMP11:%.*]] = load i32, ptr [[TMP10]], align 4
41 // CHECK-NEXT: call void (i32, ...) @varargs_simple(i32 noundef 0, i32 [[TMP7]], i8 [[TMP9]], i32 [[TMP11]]) #[[ATTR3]]
42 // CHECK-NEXT: store <4 x i32> splat (i32 1), ptr [[V]], align 16
43 // CHECK-NEXT: [[TMP12:%.*]] = load <4 x i32>, ptr [[V]], align 16
44 // CHECK-NEXT: call void (i32, ...) @varargs_simple(i32 noundef 0, <4 x i32> noundef [[TMP12]]) #[[ATTR3]]
45 // CHECK-NEXT: [[TMP13:%.*]] = getelementptr inbounds nuw [[STRUCT_ANON_0]], ptr [[T]], i32 0, i32 0
46 // CHECK-NEXT: [[TMP14:%.*]] = load i8, ptr [[TMP13]], align 1
47 // CHECK-NEXT: [[TMP15:%.*]] = getelementptr inbounds nuw [[STRUCT_ANON_0]], ptr [[T]], i32 0, i32 1
48 // CHECK-NEXT: [[TMP16:%.*]] = load i8, ptr [[TMP15]], align 1
49 // CHECK-NEXT: [[TMP17:%.*]] = getelementptr inbounds nuw [[STRUCT_ANON_0]], ptr [[T]], i32 0, i32 0
50 // CHECK-NEXT: [[TMP18:%.*]] = load i8, ptr [[TMP17]], align 1
51 // CHECK-NEXT: [[TMP19:%.*]] = getelementptr inbounds nuw [[STRUCT_ANON_0]], ptr [[T]], i32 0, i32 1
52 // CHECK-NEXT: [[TMP20:%.*]] = load i8, ptr [[TMP19]], align 1
53 // CHECK-NEXT: [[TMP21:%.*]] = getelementptr inbounds nuw [[STRUCT_ANON_0]], ptr [[T]], i32 0, i32 0
54 // CHECK-NEXT: [[TMP22:%.*]] = load i8, ptr [[TMP21]], align 1
55 // CHECK-NEXT: [[TMP23:%.*]] = getelementptr inbounds nuw [[STRUCT_ANON_0]], ptr [[T]], i32 0, i32 1
56 // CHECK-NEXT: [[TMP24:%.*]] = load i8, ptr [[TMP23]], align 1
57 // CHECK-NEXT: call void (i32, ...) @varargs_simple(i32 noundef 0, i8 [[TMP14]], i8 [[TMP16]], i8 [[TMP18]], i8 [[TMP20]], i32 noundef 0, i8 [[TMP22]], i8 [[TMP24]]) #[[ATTR3]]
58 // CHECK-NEXT: ret void
60 void foo() {
61 char c = '\x1';
62 short s = 1;
63 int i = 1;
64 long l = 1;
65 float f = 1.f;
66 double d = 1.;
67 varargs_simple(0, c, s, i, l, f, d);
69 struct {int x; char c; int y;} a = {1, '\x1', 1};
70 varargs_simple(0, a);
72 typedef int __attribute__((ext_vector_type(4))) int4;
73 int4 v = {1, 1, 1, 1};
74 varargs_simple(0, v);
76 struct {char c, d;} t;
77 varargs_simple(0, t, t, 0, t);
80 typedef struct {long x; long y;} S;
81 extern void varargs_complex(S, S, ...);
83 // CHECK-LABEL: define dso_local void @bar(
84 // CHECK-SAME: ) #[[ATTR0]] {
85 // CHECK-NEXT: [[ENTRY:.*:]]
86 // CHECK-NEXT: [[S:%.*]] = alloca [[STRUCT_S:%.*]], align 8
87 // CHECK-NEXT: call void @llvm.memcpy.p0.p0.i64(ptr align 8 [[S]], ptr align 8 @__const.bar.s, i64 16, i1 false)
88 // CHECK-NEXT: call void (ptr, ptr, ...) @varargs_complex(ptr noundef byval([[STRUCT_S]]) align 8 [[S]], ptr noundef byval([[STRUCT_S]]) align 8 [[S]], i32 noundef 1, i64 noundef 1, double noundef 1.000000e+00) #[[ATTR3]]
89 // CHECK-NEXT: ret void
91 void bar() {
92 S s = {1l, 1l};
93 varargs_complex(s, s, 1, 1l, 1.0);