Daniel Dunbar | a572887 | 2009-12-15 20:14:24 +0000 | [diff] [blame] | 1 | // RUN: %clang_cc1 -triple x86_64-unknown-unknown -emit-llvm -o %t %s |
Daniel Dunbar | 4fcfde4 | 2009-11-08 01:45:36 +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 |
| 8 | // RUN: grep 'define void @f6(i8 signext %a0, i16 signext %a1, i32 %a2, i64 %a3, i8\* %a4)' %t |
| 9 | // RUN: grep 'define void @f7(i32 %a0)' %t |
| 10 | // RUN: grep '.0 = type { i64, double }' %t |
| 11 | // RUN: grep 'define .0 @f8_1()' %t |
| 12 | // RUN: grep 'define void @f8_2(.0)' %t |
Daniel Dunbar | 644f4c3 | 2009-02-14 02:09:24 +0000 | [diff] [blame] | 13 | |
| 14 | char f0(void) { |
Mike Stump | c36541e | 2009-07-21 20:52:43 +0000 | [diff] [blame] | 15 | return 0; |
Daniel Dunbar | 644f4c3 | 2009-02-14 02:09:24 +0000 | [diff] [blame] | 16 | } |
| 17 | |
| 18 | short f1(void) { |
Mike Stump | c36541e | 2009-07-21 20:52:43 +0000 | [diff] [blame] | 19 | return 0; |
Daniel Dunbar | 644f4c3 | 2009-02-14 02:09:24 +0000 | [diff] [blame] | 20 | } |
| 21 | |
| 22 | int f2(void) { |
Mike Stump | c36541e | 2009-07-21 20:52:43 +0000 | [diff] [blame] | 23 | return 0; |
Daniel Dunbar | 644f4c3 | 2009-02-14 02:09:24 +0000 | [diff] [blame] | 24 | } |
| 25 | |
| 26 | float f3(void) { |
Mike Stump | c36541e | 2009-07-21 20:52:43 +0000 | [diff] [blame] | 27 | return 0; |
Daniel Dunbar | 644f4c3 | 2009-02-14 02:09:24 +0000 | [diff] [blame] | 28 | } |
| 29 | |
| 30 | double f4(void) { |
Mike Stump | c36541e | 2009-07-21 20:52:43 +0000 | [diff] [blame] | 31 | return 0; |
Daniel Dunbar | 644f4c3 | 2009-02-14 02:09:24 +0000 | [diff] [blame] | 32 | } |
| 33 | |
| 34 | long double f5(void) { |
Mike Stump | c36541e | 2009-07-21 20:52:43 +0000 | [diff] [blame] | 35 | return 0; |
Daniel Dunbar | 644f4c3 | 2009-02-14 02:09:24 +0000 | [diff] [blame] | 36 | } |
| 37 | |
| 38 | void f6(char a0, short a1, int a2, long long a3, void *a4) { |
| 39 | } |
Anders Carlsson | 730f909 | 2009-02-26 17:38:19 +0000 | [diff] [blame] | 40 | |
| 41 | typedef enum { A, B, C } E; |
| 42 | |
| 43 | void f7(E a0) { |
Mike Stump | 4b87142 | 2009-02-26 19:00:14 +0000 | [diff] [blame] | 44 | } |
Daniel Dunbar | 100f402 | 2009-03-06 17:50:25 +0000 | [diff] [blame] | 45 | |
| 46 | // Test merging/passing of upper eightbyte with X87 class. |
| 47 | union u8 { |
| 48 | long double a; |
| 49 | int b; |
| 50 | }; |
Mike Stump | c36541e | 2009-07-21 20:52:43 +0000 | [diff] [blame] | 51 | union u8 f8_1() { while (1) {} } |
Daniel Dunbar | 100f402 | 2009-03-06 17:50:25 +0000 | [diff] [blame] | 52 | void f8_2(union u8 a0) {} |
Daniel Dunbar | 8236bf1 | 2009-05-08 22:26:44 +0000 | [diff] [blame] | 53 | |
Daniel Dunbar | 4fcfde4 | 2009-11-08 01:45:36 +0000 | [diff] [blame] | 54 | // RUN: grep 'define i64 @f9()' %t |
Mike Stump | c36541e | 2009-07-21 20:52:43 +0000 | [diff] [blame] | 55 | struct s9 { int a; int b; int : 0; } f9(void) { while (1) {} } |
Daniel Dunbar | 8236bf1 | 2009-05-08 22:26:44 +0000 | [diff] [blame] | 56 | |
Daniel Dunbar | 4fcfde4 | 2009-11-08 01:45:36 +0000 | [diff] [blame] | 57 | // RUN: grep 'define void @f10(i64)' %t |
Daniel Dunbar | 8236bf1 | 2009-05-08 22:26:44 +0000 | [diff] [blame] | 58 | struct s10 { int a; int b; int : 0; }; |
| 59 | void f10(struct s10 a0) {} |
| 60 | |
Daniel Dunbar | 4fcfde4 | 2009-11-08 01:45:36 +0000 | [diff] [blame] | 61 | // RUN: grep 'define void @f11(.union.anon. noalias sret .agg.result)' %t |
Mike Stump | c36541e | 2009-07-21 20:52:43 +0000 | [diff] [blame] | 62 | union { long double a; float b; } f11() { while (1) {} } |
Daniel Dunbar | 20e95c5 | 2009-05-12 15:22:40 +0000 | [diff] [blame] | 63 | |
Daniel Dunbar | 4fcfde4 | 2009-11-08 01:45:36 +0000 | [diff] [blame] | 64 | // RUN: grep 'define i64 @f12_0()' %t |
| 65 | // RUN: grep 'define void @f12_1(i64)' %t |
Daniel Dunbar | 7ef455b | 2009-05-13 18:54:26 +0000 | [diff] [blame] | 66 | struct s12 { int a __attribute__((aligned(16))); }; |
Mike Stump | c36541e | 2009-07-21 20:52:43 +0000 | [diff] [blame] | 67 | struct s12 f12_0(void) { while (1) {} } |
Daniel Dunbar | 7ef455b | 2009-05-13 18:54:26 +0000 | [diff] [blame] | 68 | void f12_1(struct s12 a0) {} |
| 69 | |
Daniel Dunbar | 3a5f5c5 | 2009-05-22 17:33:44 +0000 | [diff] [blame] | 70 | // Check that sret parameter is accounted for when checking available integer |
| 71 | // registers. |
Daniel Dunbar | 4fcfde4 | 2009-11-08 01:45:36 +0000 | [diff] [blame] | 72 | // 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 |
Daniel Dunbar | 3a5f5c5 | 2009-05-22 17:33:44 +0000 | [diff] [blame] | 73 | |
| 74 | struct s13_0 { long long f0[3]; }; |
Daniel Dunbar | 55a759b | 2009-08-23 19:28:59 +0000 | [diff] [blame] | 75 | struct s13_1 { long long f0[2]; }; |
Daniel Dunbar | 3a5f5c5 | 2009-05-22 17:33:44 +0000 | [diff] [blame] | 76 | struct s13_0 f13(int a, int b, int c, int d, |
Daniel Dunbar | 55a759b | 2009-08-23 19:28:59 +0000 | [diff] [blame] | 77 | struct s13_1 e, int f) { while (1) {} } |
Daniel Dunbar | 3a5f5c5 | 2009-05-22 17:33:44 +0000 | [diff] [blame] | 78 | |
Daniel Dunbar | 4fcfde4 | 2009-11-08 01:45:36 +0000 | [diff] [blame] | 79 | // RUN: grep 'define void @f14(.*, i8 signext .X)' %t |
Daniel Dunbar | 86e13ee | 2009-05-26 16:37:37 +0000 | [diff] [blame] | 80 | void f14(int a, int b, int c, int d, int e, int f, |
| 81 | char X) {} |
Daniel Dunbar | 4fcfde4 | 2009-11-08 01:45:36 +0000 | [diff] [blame] | 82 | // RUN: grep 'define void @f15(.*, i8\* .X)' %t |
Daniel Dunbar | 86e13ee | 2009-05-26 16:37:37 +0000 | [diff] [blame] | 83 | void f15(int a, int b, int c, int d, int e, int f, |
| 84 | void *X) {} |
Daniel Dunbar | 4fcfde4 | 2009-11-08 01:45:36 +0000 | [diff] [blame] | 85 | // RUN: grep 'define void @f16(.*, float .X)' %t |
Daniel Dunbar | 86e13ee | 2009-05-26 16:37:37 +0000 | [diff] [blame] | 86 | void f16(float a, float b, float c, float d, float e, float f, float g, float h, |
| 87 | float X) {} |
Daniel Dunbar | 4fcfde4 | 2009-11-08 01:45:36 +0000 | [diff] [blame] | 88 | // RUN: grep 'define void @f17(.*, x86_fp80 .X)' %t |
Daniel Dunbar | 86e13ee | 2009-05-26 16:37:37 +0000 | [diff] [blame] | 89 | void f17(float a, float b, float c, float d, float e, float f, float g, float h, |
| 90 | long double X) {} |
| 91 | |
Daniel Dunbar | fdf4986 | 2009-06-05 07:58:54 +0000 | [diff] [blame] | 92 | // Check for valid coercion. |
Daniel Dunbar | 4fcfde4 | 2009-11-08 01:45:36 +0000 | [diff] [blame] | 93 | // RUN: grep '.. = bitcast i64. .* to .struct.f18_s0.' %t |
| 94 | // RUN: grep '.. = load .struct.f18_s0. .., align 1' %t |
| 95 | // RUN: grep 'store .struct.f18_s0 .., .struct.f18_s0. .f18_arg1' %t |
Daniel Dunbar | 55a759b | 2009-08-23 19:28:59 +0000 | [diff] [blame] | 96 | struct f18_s0 { int f0; }; |
| 97 | void f18(int a, struct f18_s0 f18_arg1) { while (1) {} } |
Daniel Dunbar | fdf4986 | 2009-06-05 07:58:54 +0000 | [diff] [blame] | 98 | |