Eli Friedman | c3e0fb4 | 2011-07-08 23:31:17 +0000 | [diff] [blame] | 1 | // RUN: %clang_cc1 -w -fblocks -triple i386-apple-darwin9 -target-cpu yonah -emit-llvm -o - %s | FileCheck %s |
Daniel Dunbar | e06a75f | 2009-03-11 22:05:26 +0000 | [diff] [blame] | 2 | |
Daniel Dunbar | d0ef54c | 2010-04-21 19:34:17 +0000 | [diff] [blame] | 3 | // CHECK: define signext i8 @f0() |
Daniel Dunbar | e06a75f | 2009-03-11 22:05:26 +0000 | [diff] [blame] | 4 | char f0(void) { |
Mike Stump | c36541e | 2009-07-21 20:52:43 +0000 | [diff] [blame] | 5 | return 0; |
Daniel Dunbar | e06a75f | 2009-03-11 22:05:26 +0000 | [diff] [blame] | 6 | } |
| 7 | |
Daniel Dunbar | d0ef54c | 2010-04-21 19:34:17 +0000 | [diff] [blame] | 8 | // CHECK: define signext i16 @f1() |
Daniel Dunbar | e06a75f | 2009-03-11 22:05:26 +0000 | [diff] [blame] | 9 | short f1(void) { |
Mike Stump | c36541e | 2009-07-21 20:52:43 +0000 | [diff] [blame] | 10 | return 0; |
Daniel Dunbar | e06a75f | 2009-03-11 22:05:26 +0000 | [diff] [blame] | 11 | } |
| 12 | |
Daniel Dunbar | d0ef54c | 2010-04-21 19:34:17 +0000 | [diff] [blame] | 13 | // CHECK: define i32 @f2() |
Daniel Dunbar | e06a75f | 2009-03-11 22:05:26 +0000 | [diff] [blame] | 14 | int f2(void) { |
Mike Stump | c36541e | 2009-07-21 20:52:43 +0000 | [diff] [blame] | 15 | return 0; |
Daniel Dunbar | e06a75f | 2009-03-11 22:05:26 +0000 | [diff] [blame] | 16 | } |
| 17 | |
Daniel Dunbar | d0ef54c | 2010-04-21 19:34:17 +0000 | [diff] [blame] | 18 | // CHECK: define float @f3() |
Daniel Dunbar | e06a75f | 2009-03-11 22:05:26 +0000 | [diff] [blame] | 19 | float f3(void) { |
Mike Stump | c36541e | 2009-07-21 20:52:43 +0000 | [diff] [blame] | 20 | return 0; |
Daniel Dunbar | e06a75f | 2009-03-11 22:05:26 +0000 | [diff] [blame] | 21 | } |
| 22 | |
Daniel Dunbar | d0ef54c | 2010-04-21 19:34:17 +0000 | [diff] [blame] | 23 | // CHECK: define double @f4() |
Daniel Dunbar | e06a75f | 2009-03-11 22:05:26 +0000 | [diff] [blame] | 24 | double f4(void) { |
Mike Stump | c36541e | 2009-07-21 20:52:43 +0000 | [diff] [blame] | 25 | return 0; |
Daniel Dunbar | e06a75f | 2009-03-11 22:05:26 +0000 | [diff] [blame] | 26 | } |
| 27 | |
Daniel Dunbar | d0ef54c | 2010-04-21 19:34:17 +0000 | [diff] [blame] | 28 | // CHECK: define x86_fp80 @f5() |
Daniel Dunbar | e06a75f | 2009-03-11 22:05:26 +0000 | [diff] [blame] | 29 | long double f5(void) { |
Mike Stump | c36541e | 2009-07-21 20:52:43 +0000 | [diff] [blame] | 30 | return 0; |
Daniel Dunbar | e06a75f | 2009-03-11 22:05:26 +0000 | [diff] [blame] | 31 | } |
| 32 | |
Daniel Dunbar | d0ef54c | 2010-04-21 19:34:17 +0000 | [diff] [blame] | 33 | // CHECK: define void @f6(i8 signext %a0, i16 signext %a1, i32 %a2, i64 %a3, i8* %a4) |
Mike Stump | c36541e | 2009-07-21 20:52:43 +0000 | [diff] [blame] | 34 | void f6(char a0, short a1, int a2, long long a3, void *a4) {} |
Daniel Dunbar | e06a75f | 2009-03-11 22:05:26 +0000 | [diff] [blame] | 35 | |
Daniel Dunbar | d0ef54c | 2010-04-21 19:34:17 +0000 | [diff] [blame] | 36 | // CHECK: define void @f7(i32 %a0) |
| 37 | typedef enum { A, B, C } e7; |
| 38 | void f7(e7 a0) {} |
Daniel Dunbar | e06a75f | 2009-03-11 22:05:26 +0000 | [diff] [blame] | 39 | |
Daniel Dunbar | d0ef54c | 2010-04-21 19:34:17 +0000 | [diff] [blame] | 40 | // CHECK: define i64 @f8_1() |
| 41 | // CHECK: define void @f8_2(i32 %a0.0, i32 %a0.1) |
Daniel Dunbar | e06a75f | 2009-03-11 22:05:26 +0000 | [diff] [blame] | 42 | struct s8 { |
| 43 | int a; |
| 44 | int b; |
| 45 | }; |
Mike Stump | c36541e | 2009-07-21 20:52:43 +0000 | [diff] [blame] | 46 | struct s8 f8_1(void) { while (1) {} } |
| 47 | void f8_2(struct s8 a0) {} |
Daniel Dunbar | e06a75f | 2009-03-11 22:05:26 +0000 | [diff] [blame] | 48 | |
| 49 | // This should be passed just as s8. |
| 50 | |
Daniel Dunbar | d0ef54c | 2010-04-21 19:34:17 +0000 | [diff] [blame] | 51 | // CHECK: define i64 @f9_1() |
Daniel Dunbar | cf6bde3 | 2009-04-01 07:45:00 +0000 | [diff] [blame] | 52 | |
Daniel Dunbar | eedd292 | 2009-05-08 20:55:49 +0000 | [diff] [blame] | 53 | // FIXME: llvm-gcc expands this, this may have some value for the |
| 54 | // backend in terms of optimization but doesn't change the ABI. |
Chris Lattner | de92d73 | 2011-05-22 23:35:00 +0000 | [diff] [blame] | 55 | // CHECK: define void @f9_2(%struct.s9* byval align 4 %a0) |
Daniel Dunbar | e06a75f | 2009-03-11 22:05:26 +0000 | [diff] [blame] | 56 | struct s9 { |
| 57 | int a : 17; |
| 58 | int b; |
| 59 | }; |
Mike Stump | c36541e | 2009-07-21 20:52:43 +0000 | [diff] [blame] | 60 | struct s9 f9_1(void) { while (1) {} } |
| 61 | void f9_2(struct s9 a0) {} |
Daniel Dunbar | e06a75f | 2009-03-11 22:05:26 +0000 | [diff] [blame] | 62 | |
Daniel Dunbar | dfc6b80 | 2009-04-01 07:08:38 +0000 | [diff] [blame] | 63 | // Return of small structures and unions |
Daniel Dunbar | 5bde6f4 | 2009-03-31 19:01:39 +0000 | [diff] [blame] | 64 | |
Daniel Dunbar | d0ef54c | 2010-04-21 19:34:17 +0000 | [diff] [blame] | 65 | // CHECK: float @f10() |
Daniel Dunbar | 5bde6f4 | 2009-03-31 19:01:39 +0000 | [diff] [blame] | 66 | struct s10 { |
| 67 | union { }; |
| 68 | float f; |
Mike Stump | c36541e | 2009-07-21 20:52:43 +0000 | [diff] [blame] | 69 | } f10(void) { while (1) {} } |
Daniel Dunbar | 5bde6f4 | 2009-03-31 19:01:39 +0000 | [diff] [blame] | 70 | |
Daniel Dunbar | dfc6b80 | 2009-04-01 07:08:38 +0000 | [diff] [blame] | 71 | // Small vectors and 1 x {i64,double} are returned in registers |
Daniel Dunbar | 5bde6f4 | 2009-03-31 19:01:39 +0000 | [diff] [blame] | 72 | |
Daniel Dunbar | d0ef54c | 2010-04-21 19:34:17 +0000 | [diff] [blame] | 73 | // CHECK: i32 @f11() |
| 74 | // CHECK: void @f12(<2 x i32>* sret %agg.result) |
| 75 | // CHECK: i64 @f13() |
| 76 | // CHECK: i64 @f14() |
| 77 | // CHECK: <2 x i64> @f15() |
| 78 | // CHECK: <2 x i64> @f16() |
Daniel Dunbar | 3604316 | 2009-04-01 06:13:08 +0000 | [diff] [blame] | 79 | typedef short T11 __attribute__ ((vector_size (4))); |
Mike Stump | c36541e | 2009-07-21 20:52:43 +0000 | [diff] [blame] | 80 | T11 f11(void) { while (1) {} } |
Daniel Dunbar | 3604316 | 2009-04-01 06:13:08 +0000 | [diff] [blame] | 81 | typedef int T12 __attribute__ ((vector_size (8))); |
Mike Stump | c36541e | 2009-07-21 20:52:43 +0000 | [diff] [blame] | 82 | T12 f12(void) { while (1) {} } |
Daniel Dunbar | 3604316 | 2009-04-01 06:13:08 +0000 | [diff] [blame] | 83 | typedef long long T13 __attribute__ ((vector_size (8))); |
Mike Stump | c36541e | 2009-07-21 20:52:43 +0000 | [diff] [blame] | 84 | T13 f13(void) { while (1) {} } |
Daniel Dunbar | 3604316 | 2009-04-01 06:13:08 +0000 | [diff] [blame] | 85 | typedef double T14 __attribute__ ((vector_size (8))); |
Mike Stump | c36541e | 2009-07-21 20:52:43 +0000 | [diff] [blame] | 86 | T14 f14(void) { while (1) {} } |
Daniel Dunbar | dfc6b80 | 2009-04-01 07:08:38 +0000 | [diff] [blame] | 87 | typedef long long T15 __attribute__ ((vector_size (16))); |
Mike Stump | c36541e | 2009-07-21 20:52:43 +0000 | [diff] [blame] | 88 | T15 f15(void) { while (1) {} } |
Daniel Dunbar | dfc6b80 | 2009-04-01 07:08:38 +0000 | [diff] [blame] | 89 | typedef double T16 __attribute__ ((vector_size (16))); |
Mike Stump | c36541e | 2009-07-21 20:52:43 +0000 | [diff] [blame] | 90 | T16 f16(void) { while (1) {} } |
Daniel Dunbar | dfc6b80 | 2009-04-01 07:08:38 +0000 | [diff] [blame] | 91 | |
| 92 | // And when the single element in a struct (but not for 64 and |
| 93 | // 128-bits). |
| 94 | |
Daniel Dunbar | d0ef54c | 2010-04-21 19:34:17 +0000 | [diff] [blame] | 95 | // CHECK: i32 @f17() |
Daniel Dunbar | 93ae947 | 2010-09-16 20:42:00 +0000 | [diff] [blame] | 96 | // CHECK: void @f18(%{{.*}}* sret %agg.result) |
| 97 | // CHECK: void @f19(%{{.*}}* sret %agg.result) |
| 98 | // CHECK: void @f20(%{{.*}}* sret %agg.result) |
| 99 | // CHECK: void @f21(%{{.*}}* sret %agg.result) |
| 100 | // CHECK: void @f22(%{{.*}}* sret %agg.result) |
Mike Stump | c36541e | 2009-07-21 20:52:43 +0000 | [diff] [blame] | 101 | struct { T11 a; } f17(void) { while (1) {} } |
| 102 | struct { T12 a; } f18(void) { while (1) {} } |
| 103 | struct { T13 a; } f19(void) { while (1) {} } |
| 104 | struct { T14 a; } f20(void) { while (1) {} } |
| 105 | struct { T15 a; } f21(void) { while (1) {} } |
| 106 | struct { T16 a; } f22(void) { while (1) {} } |
Daniel Dunbar | dfc6b80 | 2009-04-01 07:08:38 +0000 | [diff] [blame] | 107 | |
| 108 | // Single element structures are handled specially |
| 109 | |
Daniel Dunbar | d0ef54c | 2010-04-21 19:34:17 +0000 | [diff] [blame] | 110 | // CHECK: float @f23() |
| 111 | // CHECK: float @f24() |
| 112 | // CHECK: float @f25() |
Mike Stump | c36541e | 2009-07-21 20:52:43 +0000 | [diff] [blame] | 113 | struct { float a; } f23(void) { while (1) {} } |
| 114 | struct { float a[1]; } f24(void) { while (1) {} } |
| 115 | struct { struct {} a; struct { float a[1]; } b; } f25(void) { while (1) {} } |
Daniel Dunbar | 3604316 | 2009-04-01 06:13:08 +0000 | [diff] [blame] | 116 | |
Daniel Dunbar | cf6bde3 | 2009-04-01 07:45:00 +0000 | [diff] [blame] | 117 | // Small structures are handled recursively |
Daniel Dunbar | d0ef54c | 2010-04-21 19:34:17 +0000 | [diff] [blame] | 118 | // CHECK: i32 @f26() |
| 119 | // CHECK: void @f27(%struct.s27* sret %agg.result) |
Mike Stump | c36541e | 2009-07-21 20:52:43 +0000 | [diff] [blame] | 120 | struct s26 { struct { char a, b; } a; struct { char a, b; } b; } f26(void) { while (1) {} } |
| 121 | struct s27 { struct { char a, b, c; } a; struct { char a; } b; } f27(void) { while (1) {} } |
Daniel Dunbar | cf6bde3 | 2009-04-01 07:45:00 +0000 | [diff] [blame] | 122 | |
Daniel Dunbar | d0ef54c | 2010-04-21 19:34:17 +0000 | [diff] [blame] | 123 | // CHECK: void @f28(%struct.s28* sret %agg.result) |
Mike Stump | c36541e | 2009-07-21 20:52:43 +0000 | [diff] [blame] | 124 | struct s28 { int a; int b[]; } f28(void) { while (1) {} } |
Daniel Dunbar | f7fff32 | 2009-05-08 20:21:04 +0000 | [diff] [blame] | 125 | |
Daniel Dunbar | d0ef54c | 2010-04-21 19:34:17 +0000 | [diff] [blame] | 126 | // CHECK: define i16 @f29() |
Mike Stump | c36541e | 2009-07-21 20:52:43 +0000 | [diff] [blame] | 127 | struct s29 { struct { } a[1]; char b; char c; } f29(void) { while (1) {} } |
Daniel Dunbar | 8e03444 | 2009-04-27 18:31:32 +0000 | [diff] [blame] | 128 | |
Daniel Dunbar | d0ef54c | 2010-04-21 19:34:17 +0000 | [diff] [blame] | 129 | // CHECK: define i16 @f30() |
Mike Stump | c36541e | 2009-07-21 20:52:43 +0000 | [diff] [blame] | 130 | struct s30 { char a; char b : 4; } f30(void) { while (1) {} } |
Daniel Dunbar | eedd292 | 2009-05-08 20:55:49 +0000 | [diff] [blame] | 131 | |
Daniel Dunbar | d0ef54c | 2010-04-21 19:34:17 +0000 | [diff] [blame] | 132 | // CHECK: define float @f31() |
Mike Stump | c36541e | 2009-07-21 20:52:43 +0000 | [diff] [blame] | 133 | struct s31 { char : 0; float b; char : 0; } f31(void) { while (1) {} } |
Daniel Dunbar | fcab2ca | 2009-05-08 21:04:47 +0000 | [diff] [blame] | 134 | |
Daniel Dunbar | d0ef54c | 2010-04-21 19:34:17 +0000 | [diff] [blame] | 135 | // CHECK: define i32 @f32() |
Mike Stump | c36541e | 2009-07-21 20:52:43 +0000 | [diff] [blame] | 136 | struct s32 { char a; unsigned : 0; } f32(void) { while (1) {} } |
Daniel Dunbar | 2e00116 | 2009-05-08 21:30:11 +0000 | [diff] [blame] | 137 | |
Daniel Dunbar | d0ef54c | 2010-04-21 19:34:17 +0000 | [diff] [blame] | 138 | // CHECK: define float @f33() |
Mike Stump | c36541e | 2009-07-21 20:52:43 +0000 | [diff] [blame] | 139 | struct s33 { float a; long long : 0; } f33(void) { while (1) {} } |
Daniel Dunbar | 2e00116 | 2009-05-08 21:30:11 +0000 | [diff] [blame] | 140 | |
Daniel Dunbar | d0ef54c | 2010-04-21 19:34:17 +0000 | [diff] [blame] | 141 | // CHECK: define float @f34() |
Mike Stump | c36541e | 2009-07-21 20:52:43 +0000 | [diff] [blame] | 142 | struct s34 { struct { int : 0; } a; float b; } f34(void) { while (1) {} } |
Daniel Dunbar | 573b907 | 2009-05-11 18:58:49 +0000 | [diff] [blame] | 143 | |
Daniel Dunbar | d0ef54c | 2010-04-21 19:34:17 +0000 | [diff] [blame] | 144 | // CHECK: define i16 @f35() |
Mike Stump | c36541e | 2009-07-21 20:52:43 +0000 | [diff] [blame] | 145 | struct s35 { struct { int : 0; } a; char b; char c; } f35(void) { while (1) {} } |
Daniel Dunbar | 573b907 | 2009-05-11 18:58:49 +0000 | [diff] [blame] | 146 | |
Daniel Dunbar | d0ef54c | 2010-04-21 19:34:17 +0000 | [diff] [blame] | 147 | // CHECK: define i16 @f36() |
Mike Stump | c36541e | 2009-07-21 20:52:43 +0000 | [diff] [blame] | 148 | struct s36 { struct { int : 0; } a[2][10]; char b; char c; } f36(void) { while (1) {} } |
Daniel Dunbar | cc401dc | 2009-05-11 23:01:34 +0000 | [diff] [blame] | 149 | |
Daniel Dunbar | d0ef54c | 2010-04-21 19:34:17 +0000 | [diff] [blame] | 150 | // CHECK: define float @f37() |
Mike Stump | c36541e | 2009-07-21 20:52:43 +0000 | [diff] [blame] | 151 | struct s37 { float c[1][1]; } f37(void) { while (1) {} } |
Daniel Dunbar | cc401dc | 2009-05-11 23:01:34 +0000 | [diff] [blame] | 152 | |
Daniel Dunbar | d0ef54c | 2010-04-21 19:34:17 +0000 | [diff] [blame] | 153 | // CHECK: define void @f38(%struct.s38* sret %agg.result) |
Mike Stump | c36541e | 2009-07-21 20:52:43 +0000 | [diff] [blame] | 154 | struct s38 { char a[3]; short b; } f38(void) { while (1) {} } |
Daniel Dunbar | 836a064 | 2009-05-12 17:00:20 +0000 | [diff] [blame] | 155 | |
Daniel Dunbar | d0ef54c | 2010-04-21 19:34:17 +0000 | [diff] [blame] | 156 | // CHECK: define void @f39(%struct.s39* byval align 16 %x) |
Eli Friedman | a1e6de9 | 2009-06-13 21:37:10 +0000 | [diff] [blame] | 157 | typedef int v39 __attribute((vector_size(16))); |
| 158 | struct s39 { v39 x; }; |
| 159 | void f39(struct s39 x) {} |
| 160 | |
Daniel Dunbar | 55e59e1 | 2009-09-24 05:12:36 +0000 | [diff] [blame] | 161 | // <rdar://problem/7247671> |
Daniel Dunbar | d0ef54c | 2010-04-21 19:34:17 +0000 | [diff] [blame] | 162 | // CHECK: define i32 @f40() |
Daniel Dunbar | 55e59e1 | 2009-09-24 05:12:36 +0000 | [diff] [blame] | 163 | enum e40 { ec0 = 0 }; |
| 164 | enum e40 f40(void) { } |
| 165 | |
Daniel Dunbar | d0ef54c | 2010-04-21 19:34:17 +0000 | [diff] [blame] | 166 | // CHECK: define void ()* @f41() |
Daniel Dunbar | 55e59e1 | 2009-09-24 05:12:36 +0000 | [diff] [blame] | 167 | typedef void (^vvbp)(void); |
| 168 | vvbp f41(void) { } |
| 169 | |
Daniel Dunbar | d0ef54c | 2010-04-21 19:34:17 +0000 | [diff] [blame] | 170 | // CHECK: define i32 @f42() |
Daniel Dunbar | 55e59e1 | 2009-09-24 05:12:36 +0000 | [diff] [blame] | 171 | struct s42 { enum e40 f0; } f42(void) { } |
| 172 | |
Daniel Dunbar | d0ef54c | 2010-04-21 19:34:17 +0000 | [diff] [blame] | 173 | // CHECK: define i64 @f43() |
Daniel Dunbar | 55e59e1 | 2009-09-24 05:12:36 +0000 | [diff] [blame] | 174 | struct s43 { enum e40 f0; int f1; } f43(void) { } |
| 175 | |
Daniel Dunbar | d0ef54c | 2010-04-21 19:34:17 +0000 | [diff] [blame] | 176 | // CHECK: define i32 @f44() |
Daniel Dunbar | 55e59e1 | 2009-09-24 05:12:36 +0000 | [diff] [blame] | 177 | struct s44 { vvbp f0; } f44(void) { } |
| 178 | |
Daniel Dunbar | d0ef54c | 2010-04-21 19:34:17 +0000 | [diff] [blame] | 179 | // CHECK: define i64 @f45() |
Daniel Dunbar | 55e59e1 | 2009-09-24 05:12:36 +0000 | [diff] [blame] | 180 | struct s45 { vvbp f0; int f1; } f45(void) { } |
| 181 | |
Daniel Dunbar | d0ef54c | 2010-04-21 19:34:17 +0000 | [diff] [blame] | 182 | // CHECK: define void @f46(i32 %a0) |
Daniel Dunbar | 55e59e1 | 2009-09-24 05:12:36 +0000 | [diff] [blame] | 183 | void f46(enum e40 a0) { } |
| 184 | |
Daniel Dunbar | d0ef54c | 2010-04-21 19:34:17 +0000 | [diff] [blame] | 185 | // CHECK: define void @f47(void ()* %a1) |
Daniel Dunbar | 55e59e1 | 2009-09-24 05:12:36 +0000 | [diff] [blame] | 186 | void f47(vvbp a1) { } |
| 187 | |
Daniel Dunbar | d0ef54c | 2010-04-21 19:34:17 +0000 | [diff] [blame] | 188 | // CHECK: define void @f48(i32 %a0.0) |
Daniel Dunbar | 55e59e1 | 2009-09-24 05:12:36 +0000 | [diff] [blame] | 189 | struct s48 { enum e40 f0; }; |
| 190 | void f48(struct s48 a0) { } |
| 191 | |
Daniel Dunbar | d0ef54c | 2010-04-21 19:34:17 +0000 | [diff] [blame] | 192 | // CHECK: define void @f49(i32 %a0.0, i32 %a0.1) |
Daniel Dunbar | 55e59e1 | 2009-09-24 05:12:36 +0000 | [diff] [blame] | 193 | struct s49 { enum e40 f0; int f1; }; |
| 194 | void f49(struct s49 a0) { } |
| 195 | |
Daniel Dunbar | d0ef54c | 2010-04-21 19:34:17 +0000 | [diff] [blame] | 196 | // CHECK: define void @f50(void ()* %a0.0) |
Daniel Dunbar | 55e59e1 | 2009-09-24 05:12:36 +0000 | [diff] [blame] | 197 | struct s50 { vvbp f0; }; |
| 198 | void f50(struct s50 a0) { } |
| 199 | |
Daniel Dunbar | d0ef54c | 2010-04-21 19:34:17 +0000 | [diff] [blame] | 200 | // CHECK: define void @f51(void ()* %a0.0, i32 %a0.1) |
Daniel Dunbar | 55e59e1 | 2009-09-24 05:12:36 +0000 | [diff] [blame] | 201 | struct s51 { vvbp f0; int f1; }; |
| 202 | void f51(struct s51 a0) { } |
| 203 | |
Daniel Dunbar | e59d858 | 2010-09-16 20:42:06 +0000 | [diff] [blame] | 204 | // CHECK: define void @f52(%struct.s52* byval align 4) |
Daniel Dunbar | 46c54fb | 2010-04-21 19:49:55 +0000 | [diff] [blame] | 205 | struct s52 { |
| 206 | long double a; |
| 207 | }; |
| 208 | void f52(struct s52 x) {} |
| 209 | |
Daniel Dunbar | e59d858 | 2010-09-16 20:42:06 +0000 | [diff] [blame] | 210 | // CHECK: define void @f53(%struct.s53* byval align 4) |
Daniel Dunbar | 46c54fb | 2010-04-21 19:49:55 +0000 | [diff] [blame] | 211 | struct __attribute__((aligned(32))) s53 { |
| 212 | int x; |
| 213 | int y; |
| 214 | }; |
| 215 | void f53(struct s53 x) {} |
Chris Lattner | bbae8b4 | 2010-08-26 20:05:13 +0000 | [diff] [blame] | 216 | |
| 217 | typedef unsigned short v2i16 __attribute__((__vector_size__(4))); |
| 218 | |
| 219 | // CHECK: define i32 @f54(i32 %arg.coerce) |
Chris Lattner | 2e29a99 | 2010-08-26 20:05:48 +0000 | [diff] [blame] | 220 | // rdar://8359483 |
Chris Lattner | bbae8b4 | 2010-08-26 20:05:13 +0000 | [diff] [blame] | 221 | v2i16 f54(v2i16 arg) { return arg+arg; } |
| 222 | |
Chris Lattner | 4599f34 | 2010-08-30 22:03:23 +0000 | [diff] [blame] | 223 | |
| 224 | typedef int v4i32 __attribute__((__vector_size__(16))); |
| 225 | |
| 226 | // CHECK: define <2 x i64> @f55(<4 x i32> %arg) |
| 227 | // PR8029 |
| 228 | v4i32 f55(v4i32 arg) { return arg+arg; } |
| 229 | |
Daniel Dunbar | 93ae947 | 2010-09-16 20:42:00 +0000 | [diff] [blame] | 230 | // CHECK: define void @f56( |
Chris Lattner | de92d73 | 2011-05-22 23:35:00 +0000 | [diff] [blame] | 231 | // CHECK: i8 signext %a0, %struct.s56_0* byval align 4 %a1, |
Bill Wendling | bb465d7 | 2010-10-18 03:41:31 +0000 | [diff] [blame] | 232 | // CHECK: x86_mmx %a2.coerce, %struct.s56_1* byval align 4, |
Daniel Dunbar | e59d858 | 2010-09-16 20:42:06 +0000 | [diff] [blame] | 233 | // CHECK: i64 %a4.coerce, %struct.s56_2* byval align 4, |
Chris Lattner | 9cbe4f0 | 2011-07-09 17:41:47 +0000 | [diff] [blame] | 234 | // CHECK: <4 x i32> %a6, %struct.s56_3* byval align 16 %a7, |
Daniel Dunbar | 93ae947 | 2010-09-16 20:42:00 +0000 | [diff] [blame] | 235 | // CHECK: <2 x double> %a8, %struct.s56_4* byval align 16 %a9, |
Daniel Dunbar | e59d858 | 2010-09-16 20:42:06 +0000 | [diff] [blame] | 236 | // CHECK: <8 x i32> %a10, %struct.s56_5* byval align 4, |
| 237 | // CHECK: <4 x double> %a12, %struct.s56_6* byval align 4) |
Daniel Dunbar | 93ae947 | 2010-09-16 20:42:00 +0000 | [diff] [blame] | 238 | |
| 239 | // CHECK: call void (i32, ...)* @f56_0(i32 1, |
Chris Lattner | de92d73 | 2011-05-22 23:35:00 +0000 | [diff] [blame] | 240 | // CHECK: i32 %{{[^ ]*}}, %struct.s56_0* byval align 4 %{{[^ ]*}}, |
Bill Wendling | bb465d7 | 2010-10-18 03:41:31 +0000 | [diff] [blame] | 241 | // CHECK: x86_mmx %{{[^ ]*}}, %struct.s56_1* byval align 4 %{{[^ ]*}}, |
Daniel Dunbar | e59d858 | 2010-09-16 20:42:06 +0000 | [diff] [blame] | 242 | // CHECK: i64 %{{[^ ]*}}, %struct.s56_2* byval align 4 %{{[^ ]*}}, |
Chris Lattner | 9cbe4f0 | 2011-07-09 17:41:47 +0000 | [diff] [blame] | 243 | // CHECK: <4 x i32> %{{[^ ]*}}, %struct.s56_3* byval align 16 %{{[^ ]*}}, |
Daniel Dunbar | 93ae947 | 2010-09-16 20:42:00 +0000 | [diff] [blame] | 244 | // CHECK: <2 x double> %{{[^ ]*}}, %struct.s56_4* byval align 16 %{{[^ ]*}}, |
Daniel Dunbar | e59d858 | 2010-09-16 20:42:06 +0000 | [diff] [blame] | 245 | // CHECK: <8 x i32> {{[^ ]*}}, %struct.s56_5* byval align 4 %{{[^ ]*}}, |
| 246 | // CHECK: <4 x double> {{[^ ]*}}, %struct.s56_6* byval align 4 %{{[^ ]*}}) |
Daniel Dunbar | 93ae947 | 2010-09-16 20:42:00 +0000 | [diff] [blame] | 247 | // CHECK: } |
| 248 | // |
| 249 | // <rdar://problem/7964854> [i386] clang misaligns long double in structures |
| 250 | // when passed byval |
| 251 | // <rdar://problem/8431367> clang misaligns parameters on stack |
| 252 | typedef int __attribute__((vector_size (8))) t56_v2i; |
| 253 | typedef double __attribute__((vector_size (8))) t56_v1d; |
| 254 | typedef int __attribute__((vector_size (16))) t56_v4i; |
| 255 | typedef double __attribute__((vector_size (16))) t56_v2d; |
| 256 | typedef int __attribute__((vector_size (32))) t56_v8i; |
| 257 | typedef double __attribute__((vector_size (32))) t56_v4d; |
| 258 | |
| 259 | struct s56_0 { char a; }; |
| 260 | struct s56_1 { t56_v2i a; }; |
| 261 | struct s56_2 { t56_v1d a; }; |
| 262 | struct s56_3 { t56_v4i a; }; |
| 263 | struct s56_4 { t56_v2d a; }; |
| 264 | struct s56_5 { t56_v8i a; }; |
| 265 | struct s56_6 { t56_v4d a; }; |
| 266 | |
| 267 | void f56(char a0, struct s56_0 a1, |
| 268 | t56_v2i a2, struct s56_1 a3, |
| 269 | t56_v1d a4, struct s56_2 a5, |
| 270 | t56_v4i a6, struct s56_3 a7, |
| 271 | t56_v2d a8, struct s56_4 a9, |
| 272 | t56_v8i a10, struct s56_5 a11, |
| 273 | t56_v4d a12, struct s56_6 a13) { |
| 274 | extern void f56_0(int x, ...); |
| 275 | f56_0(1, a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, |
| 276 | a10, a11, a12, a13); |
| 277 | } |