blob: 0b68afdb4edddb778ea0fd0a95aadede24198d6b [file] [log] [blame]
Daniel Dunbarffd408a2009-03-24 02:24:46 +00001// RUN: clang-cc -triple x86_64-unknown-unknown -emit-llvm -o %t %s &&
Daniel Dunbar87c4dc92009-02-14 02:09:24 +00002// RUN: grep 'define signext i8 @f0()' %t &&
3// RUN: grep 'define signext i16 @f1()' %t &&
4// RUN: grep 'define i32 @f2()' %t &&
5// RUN: grep 'define float @f3()' %t &&
6// RUN: grep 'define double @f4()' %t &&
7// RUN: grep 'define x86_fp80 @f5()' %t &&
Anders Carlsson2402f0d2009-02-26 17:38:19 +00008// RUN: grep 'define void @f6(i8 signext %a0, i16 signext %a1, i32 %a2, i64 %a3, i8\* %a4)' %t &&
Daniel Dunbar78d7d452009-03-06 17:50:25 +00009// RUN: grep 'define void @f7(i32 %a0)' %t &&
10// RUN: grep 'type { i64, double }.*type .0' %t &&
11// RUN: grep 'define .0 @f8_1()' %t &&
Daniel Dunbar9bb29952009-05-08 22:26:44 +000012// RUN: grep 'define void @f8_2(.0)' %t &&
Daniel Dunbar87c4dc92009-02-14 02:09:24 +000013
14char f0(void) {
15}
16
17short f1(void) {
18}
19
20int f2(void) {
21}
22
23float f3(void) {
24}
25
26double f4(void) {
27}
28
29long double f5(void) {
30}
31
32void f6(char a0, short a1, int a2, long long a3, void *a4) {
33}
Anders Carlsson2402f0d2009-02-26 17:38:19 +000034
35typedef enum { A, B, C } E;
36
37void f7(E a0) {
Mike Stumpf4da8ec2009-02-26 19:00:14 +000038}
Daniel Dunbar78d7d452009-03-06 17:50:25 +000039
40// Test merging/passing of upper eightbyte with X87 class.
41union u8 {
42 long double a;
43 int b;
44};
45union u8 f8_1() {}
46void f8_2(union u8 a0) {}
Daniel Dunbar9bb29952009-05-08 22:26:44 +000047
48// RUN: grep 'define i64 @f9()' %t &&
49struct s9 { int a; int b; int : 0; } f9(void) {}
50
51// RUN: grep 'define void @f10(i64)' %t &&
52struct s10 { int a; int b; int : 0; };
53void f10(struct s10 a0) {}
54
Daniel Dunbar647e30f2009-05-12 15:22:40 +000055// RUN: grep 'define void @f11(.union.anon. noalias sret .agg.result)' %t &&
56union { long double a; float b; } f11() {}
57
Daniel Dunbar93317922009-05-13 18:54:26 +000058// RUN: grep 'define i64 @f12_0()' %t &&
59// RUN: grep 'define void @f12_1(i64)' %t &&
60struct s12 { int a __attribute__((aligned(16))); };
61struct s12 f12_0(void) {}
62void f12_1(struct s12 a0) {}
63
Daniel Dunbar1f84f592009-05-22 17:33:44 +000064// Check that sret parameter is accounted for when checking available integer
65// registers.
66// RUN: grep 'define void @f13(.struct.s13_0. noalias sret .agg.result, i32 .a, i32 .b, i32 .c, i32 .d, .struct.s13_1. byval .e, i32 .f)' %t &&
67
68struct s13_0 { long long f0[3]; };
69struct s13_0 f13(int a, int b, int c, int d,
70 struct s13_1 { long long f0[2]; } e, int f) {}
71
Daniel Dunbar1caef752009-05-26 16:37:37 +000072// RUN: grep 'define void @f14(.*, i8 signext .X)' %t &&
73void f14(int a, int b, int c, int d, int e, int f,
74 char X) {}
75// RUN: grep 'define void @f15(.*, i8\* .X)' %t &&
76void f15(int a, int b, int c, int d, int e, int f,
77 void *X) {}
78// RUN: grep 'define void @f16(.*, float .X)' %t &&
79void f16(float a, float b, float c, float d, float e, float f, float g, float h,
80 float X) {}
81// RUN: grep 'define void @f17(.*, x86_fp80 .X)' %t &&
82void f17(float a, float b, float c, float d, float e, float f, float g, float h,
83 long double X) {}
84
Daniel Dunbare563bae2009-06-05 07:58:54 +000085// Check for valid coercion.
86// RUN: grep '.1 = bitcast i64. .tmp to .struct.f18_s0.' %t &&
87// RUN: grep '.2 = load .struct.f18_s0. .1, align 1' %t &&
88// RUN: grep 'store .struct.f18_s0 .2, .struct.f18_s0. .f18_arg1' %t &&
89void f18(int a, struct f18_s0 { int f0; } f18_arg1) {}
90
Daniel Dunbar9bb29952009-05-08 22:26:44 +000091// RUN: true