Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / clang / test / CodeGen / lanai-arguments.c
blobbc291faa867f511632d8afe896b7fb4018281998
1 // RUN: %clang_cc1 -triple lanai-unknown-unknown %s -emit-llvm -o - \
2 // RUN: | FileCheck %s
4 // Basic argument/attribute tests for Lanai.
6 // CHECK: define{{.*}} void @f0(i32 inreg noundef %i, i32 inreg noundef %j, i64 inreg noundef %k)
7 void f0(int i, long j, long long k) {}
9 typedef struct {
10 int aa;
11 int bb;
12 } s1;
13 // CHECK: define{{.*}} void @f1(i32 inreg %i.coerce0, i32 inreg %i.coerce1)
14 void f1(s1 i) {}
16 typedef struct {
17 int cc;
18 } s2;
19 // CHECK: define{{.*}} void @f2(ptr noalias sret(%struct.s2) align 4 %agg.result)
20 s2 f2(void) {
21 s2 foo;
22 return foo;
25 typedef struct {
26 int cc;
27 int dd;
28 } s3;
29 // CHECK: define{{.*}} void @f3(ptr noalias sret(%struct.s3) align 4 %agg.result)
30 s3 f3(void) {
31 s3 foo;
32 return foo;
35 // CHECK: define{{.*}} void @f4(i64 inreg noundef %i)
36 void f4(long long i) {}
38 // CHECK: define{{.*}} void @f5(i8 inreg noundef %a, i16 inreg noundef %b)
39 void f5(char a, short b) {}
41 // CHECK: define{{.*}} void @f6(i8 inreg noundef %a, i16 inreg noundef %b)
42 void f6(unsigned char a, unsigned short b) {}
44 enum my_enum {
45 ENUM1,
46 ENUM2,
47 ENUM3,
49 // Enums should be treated as the underlying i32.
50 // CHECK: define{{.*}} void @f7(i32 inreg noundef %a)
51 void f7(enum my_enum a) {}
53 enum my_big_enum {
54 ENUM4 = 0xFFFFFFFFFFFFFFFF,
56 // Big enums should be treated as the underlying i64.
57 // CHECK: define{{.*}} void @f8(i64 inreg noundef %a)
58 void f8(enum my_big_enum a) {}
60 union simple_union {
61 int a;
62 char b;
64 // Unions should be passed inreg.
65 // CHECK: define{{.*}} void @f9(i32 inreg %s.coerce)
66 void f9(union simple_union s) {}
68 typedef struct {
69 int b4 : 4;
70 int b3 : 3;
71 int b8 : 8;
72 } bitfield1;
73 // Bitfields should be passed inreg.
74 // CHECK: define{{.*}} void @f10(i32 inreg %bf1.coerce)
75 void f10(bitfield1 bf1) {}