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