x86_32-arguments-darwin.c revision de92d739ba0ef42a5a7dcfd6e170329549d0716b
1eec5008e77ebfff7fd0723f4a21b88fde5d04b87Eric Christopher// RUN: %clang_cc1 -w -fblocks -triple i386-apple-darwin9 -emit-llvm -o %t %s 2eec5008e77ebfff7fd0723f4a21b88fde5d04b87Eric Christopher// RUN: FileCheck < %t %s 3eec5008e77ebfff7fd0723f4a21b88fde5d04b87Eric Christopher 4eec5008e77ebfff7fd0723f4a21b88fde5d04b87Eric Christopher// CHECK: define signext i8 @f0() 5eec5008e77ebfff7fd0723f4a21b88fde5d04b87Eric Christopherchar f0(void) { 6eec5008e77ebfff7fd0723f4a21b88fde5d04b87Eric Christopher return 0; 7eec5008e77ebfff7fd0723f4a21b88fde5d04b87Eric Christopher} 8eec5008e77ebfff7fd0723f4a21b88fde5d04b87Eric Christopher 9eec5008e77ebfff7fd0723f4a21b88fde5d04b87Eric Christopher// CHECK: define signext i16 @f1() 10eec5008e77ebfff7fd0723f4a21b88fde5d04b87Eric Christophershort f1(void) { 11eec5008e77ebfff7fd0723f4a21b88fde5d04b87Eric Christopher return 0; 12eec5008e77ebfff7fd0723f4a21b88fde5d04b87Eric Christopher} 13eec5008e77ebfff7fd0723f4a21b88fde5d04b87Eric Christopher 14eec5008e77ebfff7fd0723f4a21b88fde5d04b87Eric Christopher// CHECK: define i32 @f2() 15eec5008e77ebfff7fd0723f4a21b88fde5d04b87Eric Christopherint f2(void) { 16eec5008e77ebfff7fd0723f4a21b88fde5d04b87Eric Christopher return 0; 17eec5008e77ebfff7fd0723f4a21b88fde5d04b87Eric Christopher} 183e0c83559397c87e06ef29c41385e7adc34573c2Gordon Henriksen 193e0c83559397c87e06ef29c41385e7adc34573c2Gordon Henriksen// CHECK: define float @f3() 203e0c83559397c87e06ef29c41385e7adc34573c2Gordon Henriksenfloat f3(void) { 213e0c83559397c87e06ef29c41385e7adc34573c2Gordon Henriksen return 0; 22cddc3e03e4ec99c0268c03a126195173e519ed58Pirama Arumuga Nainar} 23eec5008e77ebfff7fd0723f4a21b88fde5d04b87Eric Christopher 243e0c83559397c87e06ef29c41385e7adc34573c2Gordon Henriksen// CHECK: define double @f4() 25473436709959f09ed3ed415de0f17820d9188d09NAKAMURA Takumidouble f4(void) { 26473436709959f09ed3ed415de0f17820d9188d09NAKAMURA Takumi return 0; 27473436709959f09ed3ed415de0f17820d9188d09NAKAMURA Takumi} 28473436709959f09ed3ed415de0f17820d9188d09NAKAMURA Takumi 293e0c83559397c87e06ef29c41385e7adc34573c2Gordon Henriksen// CHECK: define x86_fp80 @f5() 303e0c83559397c87e06ef29c41385e7adc34573c2Gordon Henriksenlong double f5(void) { 313e0c83559397c87e06ef29c41385e7adc34573c2Gordon Henriksen return 0; 323e0c83559397c87e06ef29c41385e7adc34573c2Gordon Henriksen} 336244b518880842f2c15200ee041e06799e4cc779Gregory Szorc 346244b518880842f2c15200ee041e06799e4cc779Gregory Szorc// CHECK: define void @f6(i8 signext %a0, i16 signext %a1, i32 %a2, i64 %a3, i8* %a4) 356244b518880842f2c15200ee041e06799e4cc779Gregory Szorcvoid f6(char a0, short a1, int a2, long long a3, void *a4) {} 366244b518880842f2c15200ee041e06799e4cc779Gregory Szorc 376244b518880842f2c15200ee041e06799e4cc779Gregory Szorc// CHECK: define void @f7(i32 %a0) 386244b518880842f2c15200ee041e06799e4cc779Gregory Szorctypedef enum { A, B, C } e7; 396244b518880842f2c15200ee041e06799e4cc779Gregory Szorcvoid f7(e7 a0) {} 40d686c8e73f74e37ab5f647b65a12051ee6cbad16Chris Lattner 413e0c83559397c87e06ef29c41385e7adc34573c2Gordon Henriksen// CHECK: define i64 @f8_1() 423e0c83559397c87e06ef29c41385e7adc34573c2Gordon Henriksen// CHECK: define void @f8_2(i32 %a0.0, i32 %a0.1) 435160d381669f1367290b802c90074cdf896d5c49Rafael Espindolastruct s8 { 443e0c83559397c87e06ef29c41385e7adc34573c2Gordon Henriksen int a; 45a96751fc8ff1cc9a225ffbba73de53e2b9e1ae35Bob Wilson int b; 46ca3ca138d88139e24a8e60fef982436575a19f38Eric Christopher}; 47ca3ca138d88139e24a8e60fef982436575a19f38Eric Christopherstruct s8 f8_1(void) { while (1) {} } 48baf3eddc7804c7b7e023a2407e5c93735fb08affDaniel Dunbarvoid f8_2(struct s8 a0) {} 49b6219ba3d609d7f65285a41bad86626f7436f00fChris Lattner 50e21c3137e1dfcd9644d3870a0a4528374375271fNAKAMURA Takumi// This should be passed just as s8. 51ff33d833225d392600626f8f7bdfdf5a29482e75Chris Lattner 52a96751fc8ff1cc9a225ffbba73de53e2b9e1ae35Bob Wilson// CHECK: define i64 @f9_1() 53b6219ba3d609d7f65285a41bad86626f7436f00fChris Lattner 54a96751fc8ff1cc9a225ffbba73de53e2b9e1ae35Bob Wilson// FIXME: llvm-gcc expands this, this may have some value for the 551abf2cb59b8d63415780a03329307c0997b2670cEvan Cheng// backend in terms of optimization but doesn't change the ABI. 56e78085a3c03de648a481e9751c3094c517bd7123Evan Cheng// CHECK: define void @f9_2(%struct.s9* byval align 4 %a0) 57439661395fd2a2a832dba01c65bc88718528313cEvan Chengstruct s9 { 58439661395fd2a2a832dba01c65bc88718528313cEvan Cheng int a : 17; 59e21c3137e1dfcd9644d3870a0a4528374375271fNAKAMURA Takumi int b; 6072736d1aa3a731cdbdef2ad7e3a861c5afd7fce7Daniel Dunbar}; 6172736d1aa3a731cdbdef2ad7e3a861c5afd7fce7Daniel Dunbarstruct s9 f9_1(void) { while (1) {} } 628ed9951c3a2c19d8374946c83f51c1b018b8897fAnders Waldenborgvoid f9_2(struct s9 a0) {} 6372736d1aa3a731cdbdef2ad7e3a861c5afd7fce7Daniel Dunbar 6429a776b8242d63cafc3d26e8183fee13273fca2eBill Wendling// Return of small structures and unions 6572736d1aa3a731cdbdef2ad7e3a861c5afd7fce7Daniel Dunbar 6672736d1aa3a731cdbdef2ad7e3a861c5afd7fce7Daniel Dunbar// CHECK: float @f10() 6772736d1aa3a731cdbdef2ad7e3a861c5afd7fce7Daniel Dunbarstruct s10 { 688ed9951c3a2c19d8374946c83f51c1b018b8897fAnders Waldenborg union { }; 6972736d1aa3a731cdbdef2ad7e3a861c5afd7fce7Daniel Dunbar float f; 7029a776b8242d63cafc3d26e8183fee13273fca2eBill Wendling} f10(void) { while (1) {} } 7172736d1aa3a731cdbdef2ad7e3a861c5afd7fce7Daniel Dunbar 7272736d1aa3a731cdbdef2ad7e3a861c5afd7fce7Daniel Dunbar// Small vectors and 1 x {i64,double} are returned in registers 7372736d1aa3a731cdbdef2ad7e3a861c5afd7fce7Daniel Dunbar 748ed9951c3a2c19d8374946c83f51c1b018b8897fAnders Waldenborg// CHECK: i32 @f11() 7572736d1aa3a731cdbdef2ad7e3a861c5afd7fce7Daniel Dunbar// CHECK: void @f12(<2 x i32>* sret %agg.result) 7629a776b8242d63cafc3d26e8183fee13273fca2eBill Wendling// CHECK: i64 @f13() 77e21c3137e1dfcd9644d3870a0a4528374375271fNAKAMURA Takumi// CHECK: i64 @f14() 78baf3eddc7804c7b7e023a2407e5c93735fb08affDaniel Dunbar// CHECK: <2 x i64> @f15() 79baf3eddc7804c7b7e023a2407e5c93735fb08affDaniel Dunbar// CHECK: <2 x i64> @f16() 80baf3eddc7804c7b7e023a2407e5c93735fb08affDaniel Dunbartypedef short T11 __attribute__ ((vector_size (4))); 81bfcd45cfe114311b32b171c529fd387dd8eac55fAnders WaldenborgT11 f11(void) { while (1) {} } 82bfcd45cfe114311b32b171c529fd387dd8eac55fAnders Waldenborgtypedef int T12 __attribute__ ((vector_size (8))); 83bfcd45cfe114311b32b171c529fd387dd8eac55fAnders WaldenborgT12 f12(void) { while (1) {} } 84bfcd45cfe114311b32b171c529fd387dd8eac55fAnders Waldenborgtypedef long long T13 __attribute__ ((vector_size (8))); 85bfcd45cfe114311b32b171c529fd387dd8eac55fAnders WaldenborgT13 f13(void) { while (1) {} } 86baf3eddc7804c7b7e023a2407e5c93735fb08affDaniel Dunbartypedef double T14 __attribute__ ((vector_size (8))); 87a96751fc8ff1cc9a225ffbba73de53e2b9e1ae35Bob WilsonT14 f14(void) { while (1) {} } 88a96751fc8ff1cc9a225ffbba73de53e2b9e1ae35Bob Wilsontypedef long long T15 __attribute__ ((vector_size (16))); 89a96751fc8ff1cc9a225ffbba73de53e2b9e1ae35Bob WilsonT15 f15(void) { while (1) {} } 90bfcd45cfe114311b32b171c529fd387dd8eac55fAnders Waldenborgtypedef double T16 __attribute__ ((vector_size (16))); 91bfcd45cfe114311b32b171c529fd387dd8eac55fAnders WaldenborgT16 f16(void) { while (1) {} } 92bfcd45cfe114311b32b171c529fd387dd8eac55fAnders Waldenborg 93bfcd45cfe114311b32b171c529fd387dd8eac55fAnders Waldenborg// And when the single element in a struct (but not for 64 and 94bfcd45cfe114311b32b171c529fd387dd8eac55fAnders Waldenborg// 128-bits). 9572736d1aa3a731cdbdef2ad7e3a861c5afd7fce7Daniel Dunbar 9672736d1aa3a731cdbdef2ad7e3a861c5afd7fce7Daniel Dunbar// CHECK: i32 @f17() 9772736d1aa3a731cdbdef2ad7e3a861c5afd7fce7Daniel Dunbar// CHECK: void @f18(%{{.*}}* sret %agg.result) 9872736d1aa3a731cdbdef2ad7e3a861c5afd7fce7Daniel Dunbar// CHECK: void @f19(%{{.*}}* sret %agg.result) 99bfcd45cfe114311b32b171c529fd387dd8eac55fAnders Waldenborg// CHECK: void @f20(%{{.*}}* sret %agg.result) 100bfcd45cfe114311b32b171c529fd387dd8eac55fAnders Waldenborg// CHECK: void @f21(%{{.*}}* sret %agg.result) 101bfcd45cfe114311b32b171c529fd387dd8eac55fAnders Waldenborg// CHECK: void @f22(%{{.*}}* sret %agg.result) 102bfcd45cfe114311b32b171c529fd387dd8eac55fAnders Waldenborgstruct { T11 a; } f17(void) { while (1) {} } 103bfcd45cfe114311b32b171c529fd387dd8eac55fAnders Waldenborgstruct { T12 a; } f18(void) { while (1) {} } 104e21c3137e1dfcd9644d3870a0a4528374375271fNAKAMURA Takumistruct { T13 a; } f19(void) { while (1) {} } 10572736d1aa3a731cdbdef2ad7e3a861c5afd7fce7Daniel Dunbarstruct { T14 a; } f20(void) { while (1) {} } 10672736d1aa3a731cdbdef2ad7e3a861c5afd7fce7Daniel Dunbarstruct { T15 a; } f21(void) { while (1) {} } 10772736d1aa3a731cdbdef2ad7e3a861c5afd7fce7Daniel Dunbarstruct { T16 a; } f22(void) { while (1) {} } 108bfcd45cfe114311b32b171c529fd387dd8eac55fAnders Waldenborg 109bfcd45cfe114311b32b171c529fd387dd8eac55fAnders Waldenborg// Single element structures are handled specially 110bfcd45cfe114311b32b171c529fd387dd8eac55fAnders Waldenborg 111bfcd45cfe114311b32b171c529fd387dd8eac55fAnders Waldenborg// CHECK: float @f23() 112bfcd45cfe114311b32b171c529fd387dd8eac55fAnders Waldenborg// CHECK: float @f24() 113e21c3137e1dfcd9644d3870a0a4528374375271fNAKAMURA Takumi// CHECK: float @f25() 11472736d1aa3a731cdbdef2ad7e3a861c5afd7fce7Daniel Dunbarstruct { float a; } f23(void) { while (1) {} } 11572736d1aa3a731cdbdef2ad7e3a861c5afd7fce7Daniel Dunbarstruct { float a[1]; } f24(void) { while (1) {} } 11672736d1aa3a731cdbdef2ad7e3a861c5afd7fce7Daniel Dunbarstruct { struct {} a; struct { float a[1]; } b; } f25(void) { while (1) {} } 117bfcd45cfe114311b32b171c529fd387dd8eac55fAnders Waldenborg 118bfcd45cfe114311b32b171c529fd387dd8eac55fAnders Waldenborg// Small structures are handled recursively 119bfcd45cfe114311b32b171c529fd387dd8eac55fAnders Waldenborg// CHECK: i32 @f26() 120bfcd45cfe114311b32b171c529fd387dd8eac55fAnders Waldenborg// CHECK: void @f27(%struct.s27* sret %agg.result) 121bfcd45cfe114311b32b171c529fd387dd8eac55fAnders Waldenborgstruct s26 { struct { char a, b; } a; struct { char a, b; } b; } f26(void) { while (1) {} } 122e21c3137e1dfcd9644d3870a0a4528374375271fNAKAMURA Takumistruct s27 { struct { char a, b, c; } a; struct { char a; } b; } f27(void) { while (1) {} } 12372736d1aa3a731cdbdef2ad7e3a861c5afd7fce7Daniel Dunbar 12472736d1aa3a731cdbdef2ad7e3a861c5afd7fce7Daniel Dunbar// CHECK: void @f28(%struct.s28* sret %agg.result) 12572736d1aa3a731cdbdef2ad7e3a861c5afd7fce7Daniel Dunbarstruct s28 { int a; int b[]; } f28(void) { while (1) {} } 126bfcd45cfe114311b32b171c529fd387dd8eac55fAnders Waldenborg 127bfcd45cfe114311b32b171c529fd387dd8eac55fAnders Waldenborg// CHECK: define i16 @f29() 128bfcd45cfe114311b32b171c529fd387dd8eac55fAnders Waldenborgstruct s29 { struct { } a[1]; char b; char c; } f29(void) { while (1) {} } 129bfcd45cfe114311b32b171c529fd387dd8eac55fAnders Waldenborg 130bfcd45cfe114311b32b171c529fd387dd8eac55fAnders Waldenborg// CHECK: define i16 @f30() 131bfcd45cfe114311b32b171c529fd387dd8eac55fAnders Waldenborgstruct s30 { char a; char b : 4; } f30(void) { while (1) {} } 132e21c3137e1dfcd9644d3870a0a4528374375271fNAKAMURA Takumi 133a96751fc8ff1cc9a225ffbba73de53e2b9e1ae35Bob Wilson// CHECK: define float @f31() 134e21c3137e1dfcd9644d3870a0a4528374375271fNAKAMURA Takumistruct s31 { char : 0; float b; char : 0; } f31(void) { while (1) {} } 135a96751fc8ff1cc9a225ffbba73de53e2b9e1ae35Bob Wilson 136c799c55a339b69ee6aeb03b29f4ea7b2dcea0c7bChris Lattner// CHECK: define i32 @f32() 137a96751fc8ff1cc9a225ffbba73de53e2b9e1ae35Bob Wilsonstruct s32 { char a; unsigned : 0; } f32(void) { while (1) {} } 138753f3265dafdcfeec07b561ca278524c35477583Eric Christopher 139753f3265dafdcfeec07b561ca278524c35477583Eric Christopher// CHECK: define float @f33() 140753f3265dafdcfeec07b561ca278524c35477583Eric Christopherstruct s33 { float a; long long : 0; } f33(void) { while (1) {} } 141e78085a3c03de648a481e9751c3094c517bd7123Evan Cheng 142a96751fc8ff1cc9a225ffbba73de53e2b9e1ae35Bob Wilson// CHECK: define float @f34() 143a96751fc8ff1cc9a225ffbba73de53e2b9e1ae35Bob Wilsonstruct s34 { struct { int : 0; } a; float b; } f34(void) { while (1) {} } 144a96751fc8ff1cc9a225ffbba73de53e2b9e1ae35Bob Wilson 145a96751fc8ff1cc9a225ffbba73de53e2b9e1ae35Bob Wilson// CHECK: define i16 @f35() 146e21c3137e1dfcd9644d3870a0a4528374375271fNAKAMURA Takumistruct s35 { struct { int : 0; } a; char b; char c; } f35(void) { while (1) {} } 1473e0c83559397c87e06ef29c41385e7adc34573c2Gordon Henriksen 14843b255884a9ea4040c2c62dcbb957159cb7f31daPeter Zotov// CHECK: define i16 @f36() 14943b255884a9ea4040c2c62dcbb957159cb7f31daPeter Zotovstruct s36 { struct { int : 0; } a[2][10]; char b; char c; } f36(void) { while (1) {} } 15043b255884a9ea4040c2c62dcbb957159cb7f31daPeter Zotov 151e669e09d7d4245a88b10a772be3ba97aa5e14923Peter Zotov// CHECK: define float @f37() 152e669e09d7d4245a88b10a772be3ba97aa5e14923Peter Zotovstruct s37 { float c[1][1]; } f37(void) { while (1) {} } 15343b255884a9ea4040c2c62dcbb957159cb7f31daPeter Zotov 15443b255884a9ea4040c2c62dcbb957159cb7f31daPeter Zotov// CHECK: define void @f38(%struct.s38* sret %agg.result) 15543b255884a9ea4040c2c62dcbb957159cb7f31daPeter Zotovstruct s38 { char a[3]; short b; } f38(void) { while (1) {} } 15643b255884a9ea4040c2c62dcbb957159cb7f31daPeter Zotov 15743b255884a9ea4040c2c62dcbb957159cb7f31daPeter Zotov// CHECK: define void @f39(%struct.s39* byval align 16 %x) 15843b255884a9ea4040c2c62dcbb957159cb7f31daPeter Zotovtypedef int v39 __attribute((vector_size(16))); 15943b255884a9ea4040c2c62dcbb957159cb7f31daPeter Zotovstruct s39 { v39 x; }; 16043b255884a9ea4040c2c62dcbb957159cb7f31daPeter Zotovvoid f39(struct s39 x) {} 16143b255884a9ea4040c2c62dcbb957159cb7f31daPeter Zotov 16243b255884a9ea4040c2c62dcbb957159cb7f31daPeter Zotov// <rdar://problem/7247671> 163e669e09d7d4245a88b10a772be3ba97aa5e14923Peter Zotov// CHECK: define i32 @f40() 164e669e09d7d4245a88b10a772be3ba97aa5e14923Peter Zotovenum e40 { ec0 = 0 }; 16543b255884a9ea4040c2c62dcbb957159cb7f31daPeter Zotovenum e40 f40(void) { } 16643b255884a9ea4040c2c62dcbb957159cb7f31daPeter Zotov 16743b255884a9ea4040c2c62dcbb957159cb7f31daPeter Zotov// CHECK: define void ()* @f41() 16843b255884a9ea4040c2c62dcbb957159cb7f31daPeter Zotovtypedef void (^vvbp)(void); 16943b255884a9ea4040c2c62dcbb957159cb7f31daPeter Zotovvvbp f41(void) { } 17043b255884a9ea4040c2c62dcbb957159cb7f31daPeter Zotov 17143b255884a9ea4040c2c62dcbb957159cb7f31daPeter Zotov// CHECK: define i32 @f42() 17243b255884a9ea4040c2c62dcbb957159cb7f31daPeter Zotovstruct s42 { enum e40 f0; } f42(void) { } 17343b255884a9ea4040c2c62dcbb957159cb7f31daPeter Zotov 17443b255884a9ea4040c2c62dcbb957159cb7f31daPeter Zotov// CHECK: define i64 @f43() 175e669e09d7d4245a88b10a772be3ba97aa5e14923Peter Zotovstruct s43 { enum e40 f0; int f1; } f43(void) { } 176e669e09d7d4245a88b10a772be3ba97aa5e14923Peter Zotov 17743b255884a9ea4040c2c62dcbb957159cb7f31daPeter Zotov// CHECK: define i32 @f44() 17843b255884a9ea4040c2c62dcbb957159cb7f31daPeter Zotovstruct s44 { vvbp f0; } f44(void) { } 17943b255884a9ea4040c2c62dcbb957159cb7f31daPeter Zotov 18043b255884a9ea4040c2c62dcbb957159cb7f31daPeter Zotov// CHECK: define i64 @f45() 18143b255884a9ea4040c2c62dcbb957159cb7f31daPeter Zotovstruct s45 { vvbp f0; int f1; } f45(void) { } 18243b255884a9ea4040c2c62dcbb957159cb7f31daPeter Zotov 18343b255884a9ea4040c2c62dcbb957159cb7f31daPeter Zotov// CHECK: define void @f46(i32 %a0) 1843e0c83559397c87e06ef29c41385e7adc34573c2Gordon Henriksenvoid f46(enum e40 a0) { } 1853e0c83559397c87e06ef29c41385e7adc34573c2Gordon Henriksen 1863e0c83559397c87e06ef29c41385e7adc34573c2Gordon Henriksen// CHECK: define void @f47(void ()* %a1) 1873574eca1b02600bac4e625297f4ecf745f4c4f32Micah Villmowvoid f47(vvbp a1) { } 1883e0c83559397c87e06ef29c41385e7adc34573c2Gordon Henriksen 1893e0c83559397c87e06ef29c41385e7adc34573c2Gordon Henriksen// CHECK: define void @f48(i32 %a0.0) 1903e0c83559397c87e06ef29c41385e7adc34573c2Gordon Henriksenstruct s48 { enum e40 f0; }; 1913e0c83559397c87e06ef29c41385e7adc34573c2Gordon Henriksenvoid f48(struct s48 a0) { } 1923e0c83559397c87e06ef29c41385e7adc34573c2Gordon Henriksen 193573a231a3102657faf846e588517d01801154100Peter Zotov// CHECK: define void @f49(i32 %a0.0, i32 %a0.1) 1943e0c83559397c87e06ef29c41385e7adc34573c2Gordon Henriksenstruct s49 { enum e40 f0; int f1; }; 1955160d381669f1367290b802c90074cdf896d5c49Rafael Espindolavoid f49(struct s49 a0) { } 1965160d381669f1367290b802c90074cdf896d5c49Rafael Espindola 1975160d381669f1367290b802c90074cdf896d5c49Rafael Espindola// CHECK: define void @f50(void ()* %a0.0) 198573a231a3102657faf846e588517d01801154100Peter Zotovstruct s50 { vvbp f0; }; 199573a231a3102657faf846e588517d01801154100Peter Zotovvoid f50(struct s50 a0) { } 2005160d381669f1367290b802c90074cdf896d5c49Rafael Espindola 2013e0c83559397c87e06ef29c41385e7adc34573c2Gordon Henriksen// CHECK: define void @f51(void ()* %a0.0, i32 %a0.1) 2023e0c83559397c87e06ef29c41385e7adc34573c2Gordon Henriksenstruct s51 { vvbp f0; int f1; }; 2033574eca1b02600bac4e625297f4ecf745f4c4f32Micah Villmowvoid f51(struct s51 a0) { } 204573a231a3102657faf846e588517d01801154100Peter Zotov 2053e0c83559397c87e06ef29c41385e7adc34573c2Gordon Henriksen// CHECK: define void @f52(%struct.s52* byval align 4) 2063e0c83559397c87e06ef29c41385e7adc34573c2Gordon Henriksenstruct s52 { 2073e0c83559397c87e06ef29c41385e7adc34573c2Gordon Henriksen long double a; 2083574eca1b02600bac4e625297f4ecf745f4c4f32Micah Villmow}; 209573a231a3102657faf846e588517d01801154100Peter Zotovvoid f52(struct s52 x) {} 2103e0c83559397c87e06ef29c41385e7adc34573c2Gordon Henriksen 2113e0c83559397c87e06ef29c41385e7adc34573c2Gordon Henriksen// CHECK: define void @f53(%struct.s53* byval align 4) 2123574eca1b02600bac4e625297f4ecf745f4c4f32Micah Villmowstruct __attribute__((aligned(32))) s53 { 213573a231a3102657faf846e588517d01801154100Peter Zotov int x; 2143e0c83559397c87e06ef29c41385e7adc34573c2Gordon Henriksen int y; 2152c39b15073db81d93bb629303915b7d7e5d088dcMicah Villmow}; 2162c39b15073db81d93bb629303915b7d7e5d088dcMicah Villmowvoid f53(struct s53 x) {} 2172c39b15073db81d93bb629303915b7d7e5d088dcMicah Villmow 218573a231a3102657faf846e588517d01801154100Peter Zotovtypedef unsigned short v2i16 __attribute__((__vector_size__(4))); 2192c39b15073db81d93bb629303915b7d7e5d088dcMicah Villmow 2203e0c83559397c87e06ef29c41385e7adc34573c2Gordon Henriksen// CHECK: define i32 @f54(i32 %arg.coerce) 2213574eca1b02600bac4e625297f4ecf745f4c4f32Micah Villmow// rdar://8359483 222573a231a3102657faf846e588517d01801154100Peter Zotovv2i16 f54(v2i16 arg) { return arg+arg; } 2233e0c83559397c87e06ef29c41385e7adc34573c2Gordon Henriksen 2242c39b15073db81d93bb629303915b7d7e5d088dcMicah Villmow 2252c39b15073db81d93bb629303915b7d7e5d088dcMicah Villmowtypedef int v4i32 __attribute__((__vector_size__(16))); 2262c39b15073db81d93bb629303915b7d7e5d088dcMicah Villmow 227573a231a3102657faf846e588517d01801154100Peter Zotov// CHECK: define <2 x i64> @f55(<4 x i32> %arg) 2282c39b15073db81d93bb629303915b7d7e5d088dcMicah Villmow// PR8029 229f4094e5ed7387b29eda8d9a7865f6b5dfd47ce82Anders Waldenborgv4i32 f55(v4i32 arg) { return arg+arg; } 230f4094e5ed7387b29eda8d9a7865f6b5dfd47ce82Anders Waldenborg 231573a231a3102657faf846e588517d01801154100Peter Zotov// CHECK: define void @f56( 232f4094e5ed7387b29eda8d9a7865f6b5dfd47ce82Anders Waldenborg// CHECK: i8 signext %a0, %struct.s56_0* byval align 4 %a1, 233f4094e5ed7387b29eda8d9a7865f6b5dfd47ce82Anders Waldenborg// CHECK: x86_mmx %a2.coerce, %struct.s56_1* byval align 4, 234f4094e5ed7387b29eda8d9a7865f6b5dfd47ce82Anders Waldenborg// CHECK: i64 %a4.coerce, %struct.s56_2* byval align 4, 235f4094e5ed7387b29eda8d9a7865f6b5dfd47ce82Anders Waldenborg// CHECK: <4 x i32> %a6, %struct.s39* byval align 16 %a7, 236573a231a3102657faf846e588517d01801154100Peter Zotov// CHECK: <2 x double> %a8, %struct.s56_4* byval align 16 %a9, 237573a231a3102657faf846e588517d01801154100Peter Zotov// CHECK: <8 x i32> %a10, %struct.s56_5* byval align 4, 238f4094e5ed7387b29eda8d9a7865f6b5dfd47ce82Anders Waldenborg// CHECK: <4 x double> %a12, %struct.s56_6* byval align 4) 2393e0c83559397c87e06ef29c41385e7adc34573c2Gordon Henriksen 2403574eca1b02600bac4e625297f4ecf745f4c4f32Micah Villmow// CHECK: call void (i32, ...)* @f56_0(i32 1, 241573a231a3102657faf846e588517d01801154100Peter Zotov// CHECK: i32 %{{[^ ]*}}, %struct.s56_0* byval align 4 %{{[^ ]*}}, 2423e0c83559397c87e06ef29c41385e7adc34573c2Gordon Henriksen// CHECK: x86_mmx %{{[^ ]*}}, %struct.s56_1* byval align 4 %{{[^ ]*}}, 2433e0c83559397c87e06ef29c41385e7adc34573c2Gordon Henriksen// CHECK: i64 %{{[^ ]*}}, %struct.s56_2* byval align 4 %{{[^ ]*}}, 2443574eca1b02600bac4e625297f4ecf745f4c4f32Micah Villmow// CHECK: <4 x i32> %{{[^ ]*}}, %struct.s39* byval align 16 %{{[^ ]*}}, 245573a231a3102657faf846e588517d01801154100Peter Zotov// CHECK: <2 x double> %{{[^ ]*}}, %struct.s56_4* byval align 16 %{{[^ ]*}}, 2463e0c83559397c87e06ef29c41385e7adc34573c2Gordon Henriksen// CHECK: <8 x i32> {{[^ ]*}}, %struct.s56_5* byval align 4 %{{[^ ]*}}, 2473e0c83559397c87e06ef29c41385e7adc34573c2Gordon Henriksen// CHECK: <4 x double> {{[^ ]*}}, %struct.s56_6* byval align 4 %{{[^ ]*}}) 2483574eca1b02600bac4e625297f4ecf745f4c4f32Micah Villmow// CHECK: } 249573a231a3102657faf846e588517d01801154100Peter Zotov// 2503e0c83559397c87e06ef29c41385e7adc34573c2Gordon Henriksen// <rdar://problem/7964854> [i386] clang misaligns long double in structures 2513e0c83559397c87e06ef29c41385e7adc34573c2Gordon Henriksen// when passed byval 2523574eca1b02600bac4e625297f4ecf745f4c4f32Micah Villmow// <rdar://problem/8431367> clang misaligns parameters on stack 253573a231a3102657faf846e588517d01801154100Peter Zotovtypedef int __attribute__((vector_size (8))) t56_v2i; 2543e0c83559397c87e06ef29c41385e7adc34573c2Gordon Henriksentypedef double __attribute__((vector_size (8))) t56_v1d; 2553e0c83559397c87e06ef29c41385e7adc34573c2Gordon Henriksentypedef int __attribute__((vector_size (16))) t56_v4i; 2563574eca1b02600bac4e625297f4ecf745f4c4f32Micah Villmowtypedef double __attribute__((vector_size (16))) t56_v2d; 257573a231a3102657faf846e588517d01801154100Peter Zotovtypedef int __attribute__((vector_size (32))) t56_v8i; 2583e0c83559397c87e06ef29c41385e7adc34573c2Gordon Henriksentypedef double __attribute__((vector_size (32))) t56_v4d; 2593e0c83559397c87e06ef29c41385e7adc34573c2Gordon Henriksen 2603574eca1b02600bac4e625297f4ecf745f4c4f32Micah Villmowstruct s56_0 { char a; }; 261573a231a3102657faf846e588517d01801154100Peter Zotovstruct s56_1 { t56_v2i a; }; 2623e0c83559397c87e06ef29c41385e7adc34573c2Gordon Henriksenstruct s56_2 { t56_v1d a; }; 2633e0c83559397c87e06ef29c41385e7adc34573c2Gordon Henriksenstruct s56_3 { t56_v4i a; }; 2643574eca1b02600bac4e625297f4ecf745f4c4f32Micah Villmowstruct s56_4 { t56_v2d a; }; 265573a231a3102657faf846e588517d01801154100Peter Zotovstruct s56_5 { t56_v8i a; }; 2663e0c83559397c87e06ef29c41385e7adc34573c2Gordon Henriksenstruct s56_6 { t56_v4d a; }; 2673e0c83559397c87e06ef29c41385e7adc34573c2Gordon Henriksen 2683e0c83559397c87e06ef29c41385e7adc34573c2Gordon Henriksenvoid f56(char a0, struct s56_0 a1, 2693e0c83559397c87e06ef29c41385e7adc34573c2Gordon Henriksen t56_v2i a2, struct s56_1 a3, 270573a231a3102657faf846e588517d01801154100Peter Zotov t56_v1d a4, struct s56_2 a5, 2713e0c83559397c87e06ef29c41385e7adc34573c2Gordon Henriksen t56_v4i a6, struct s56_3 a7, 2723e0c83559397c87e06ef29c41385e7adc34573c2Gordon Henriksen t56_v2d a8, struct s56_4 a9, 2733e0c83559397c87e06ef29c41385e7adc34573c2Gordon Henriksen t56_v8i a10, struct s56_5 a11, 2743e0c83559397c87e06ef29c41385e7adc34573c2Gordon Henriksen t56_v4d a12, struct s56_6 a13) { 275573a231a3102657faf846e588517d01801154100Peter Zotov extern void f56_0(int x, ...); 276573a231a3102657faf846e588517d01801154100Peter Zotov f56_0(1, a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, 2773e0c83559397c87e06ef29c41385e7adc34573c2Gordon Henriksen a10, a11, a12, a13); 2783e0c83559397c87e06ef29c41385e7adc34573c2Gordon Henriksen} 2793574eca1b02600bac4e625297f4ecf745f4c4f32Micah Villmow