Daniel Dunbar | ffd408a | 2009-03-24 02:24:46 +0000 | [diff] [blame] | 1 | // RUN: clang-cc -triple x86_64-unknown-unknown -emit-llvm -o %t %s && |
Daniel Dunbar | 87c4dc9 | 2009-02-14 02:09:24 +0000 | [diff] [blame] | 2 | // 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 Carlsson | 2402f0d | 2009-02-26 17:38:19 +0000 | [diff] [blame] | 8 | // RUN: grep 'define void @f6(i8 signext %a0, i16 signext %a1, i32 %a2, i64 %a3, i8\* %a4)' %t && |
Daniel Dunbar | 78d7d45 | 2009-03-06 17:50:25 +0000 | [diff] [blame] | 9 | // 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 Dunbar | 9bb2995 | 2009-05-08 22:26:44 +0000 | [diff] [blame] | 12 | // RUN: grep 'define void @f8_2(.0)' %t && |
Daniel Dunbar | 87c4dc9 | 2009-02-14 02:09:24 +0000 | [diff] [blame] | 13 | |
| 14 | char f0(void) { |
| 15 | } |
| 16 | |
| 17 | short f1(void) { |
| 18 | } |
| 19 | |
| 20 | int f2(void) { |
| 21 | } |
| 22 | |
| 23 | float f3(void) { |
| 24 | } |
| 25 | |
| 26 | double f4(void) { |
| 27 | } |
| 28 | |
| 29 | long double f5(void) { |
| 30 | } |
| 31 | |
| 32 | void f6(char a0, short a1, int a2, long long a3, void *a4) { |
| 33 | } |
Anders Carlsson | 2402f0d | 2009-02-26 17:38:19 +0000 | [diff] [blame] | 34 | |
| 35 | typedef enum { A, B, C } E; |
| 36 | |
| 37 | void f7(E a0) { |
Mike Stump | f4da8ec | 2009-02-26 19:00:14 +0000 | [diff] [blame] | 38 | } |
Daniel Dunbar | 78d7d45 | 2009-03-06 17:50:25 +0000 | [diff] [blame] | 39 | |
| 40 | // Test merging/passing of upper eightbyte with X87 class. |
| 41 | union u8 { |
| 42 | long double a; |
| 43 | int b; |
| 44 | }; |
| 45 | union u8 f8_1() {} |
| 46 | void f8_2(union u8 a0) {} |
Daniel Dunbar | 9bb2995 | 2009-05-08 22:26:44 +0000 | [diff] [blame] | 47 | |
| 48 | // RUN: grep 'define i64 @f9()' %t && |
| 49 | struct s9 { int a; int b; int : 0; } f9(void) {} |
| 50 | |
| 51 | // RUN: grep 'define void @f10(i64)' %t && |
| 52 | struct s10 { int a; int b; int : 0; }; |
| 53 | void f10(struct s10 a0) {} |
| 54 | |
Daniel Dunbar | 647e30f | 2009-05-12 15:22:40 +0000 | [diff] [blame] | 55 | // RUN: grep 'define void @f11(.union.anon. noalias sret .agg.result)' %t && |
| 56 | union { long double a; float b; } f11() {} |
| 57 | |
Daniel Dunbar | 9331792 | 2009-05-13 18:54:26 +0000 | [diff] [blame] | 58 | // RUN: grep 'define i64 @f12_0()' %t && |
| 59 | // RUN: grep 'define void @f12_1(i64)' %t && |
| 60 | struct s12 { int a __attribute__((aligned(16))); }; |
| 61 | struct s12 f12_0(void) {} |
| 62 | void f12_1(struct s12 a0) {} |
| 63 | |
Daniel Dunbar | 1f84f59 | 2009-05-22 17:33:44 +0000 | [diff] [blame] | 64 | // 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 | |
| 68 | struct s13_0 { long long f0[3]; }; |
| 69 | struct s13_0 f13(int a, int b, int c, int d, |
| 70 | struct s13_1 { long long f0[2]; } e, int f) {} |
| 71 | |
Daniel Dunbar | 1caef75 | 2009-05-26 16:37:37 +0000 | [diff] [blame] | 72 | // RUN: grep 'define void @f14(.*, i8 signext .X)' %t && |
| 73 | void 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 && |
| 76 | void 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 && |
| 79 | void 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 && |
| 82 | void f17(float a, float b, float c, float d, float e, float f, float g, float h, |
| 83 | long double X) {} |
| 84 | |
Daniel Dunbar | e563bae | 2009-06-05 07:58:54 +0000 | [diff] [blame^] | 85 | // 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 && |
| 89 | void f18(int a, struct f18_s0 { int f0; } f18_arg1) {} |
| 90 | |
Daniel Dunbar | 9bb2995 | 2009-05-08 22:26:44 +0000 | [diff] [blame] | 91 | // RUN: true |