1 // RUN: %clang_cc1 -no-opaque-pointers -triple aarch64-none-eabi -emit-llvm -o - %s | FileCheck %s --check-prefixes=CHECK,CHECK-AAPCS
2 // RUN: %clang_cc1 -no-opaque-pointers -triple arm64-apple-ios7.0 -target-abi darwinpcs -emit-llvm -o - %s | FileCheck %s --check-prefixes=CHECK,CHECK-DARWIN
3 // RUN: %clang_cc1 -no-opaque-pointers -triple aarch64-linux-gnu -emit-llvm -o - -x c %s | FileCheck %s --check-prefixes=CHECK,CHECK-AAPCS
4 
5 typedef struct {
6   float v[2];
7 } S0;
8 
9 // CHECK: define{{.*}} float @f0([2 x float] %h.coerce)
10 float f0(S0 h) {
11   return h.v[0];
12 }
13 
14 // CHECK: define{{.*}} float @f0_call()
15 // CHECK: %call = call float @f0([2 x float] %1)
16 float f0_call(void) {
17   S0 h = {1.0f, 2.0f};
18   return f0(h);
19 }
20 typedef struct {
21   double v[2];
22 } S1;
23 
24 // CHECK: define{{.*}} double @f1([2 x double] %h.coerce)
25 double f1(S1 h) {
26   return h.v[0];
27 }
28 
29 // CHECK: define{{.*}} double @f1_call()
30 // CHECK: %call = call double @f1([2 x double] %1
31 double f1_call(void) {
32   S1 h = {1.0, 2.0};
33   return f1(h);
34 }
35 typedef struct {
36   __attribute__((__aligned__(16))) double v[2];
37 } S2;
38 
39 // CHECK-AAPCS:  define{{.*}} double @f2([2 x double] alignstack(16) %h.coerce)
40 // CHECK-DARWIN: define{{.*}} double @f2([2 x double] %h.coerce)
41 double f2(S2 h) {
42   return h.v[0];
43 }
44 
45 // CHECK: define{{.*}} double @f2_call()
46 // CHECK-AAPCS:  %call = call double @f2([2 x double] alignstack(16) %1)
47 // CHECK-DARWIN: %call = call double @f2([2 x double] %1
48 double f2_call(void) {
49   S2 h = {1.0, 2.0};
50   return f2(h);
51 }
52 
53 typedef struct {
54   __attribute__((__aligned__(32))) double v[4];
55 } S3;
56 
57 // CHECK-AAPCS:  define{{.*}} double @f3([4 x double] alignstack(16) %h.coerce)
58 // CHECK-DARWIN: define{{.*}} double @f3([4 x double] %h.coerce)
59 double f3(S3 h) {
60   return h.v[0];
61 }
62 
63 // CHECK: define{{.*}} double @f3_call()
64 // CHECK-AAPCS:  %call = call double @f3([4 x double] alignstack(16) %1)
65 // CHECK-DARWIN: %call = call double @f3([4 x double] %1
66 double f3_call(void) {
67   S3 h = {1.0, 2.0};
68   return f3(h);
69 }
70