John McCall | 12f2352 | 2016-04-04 18:33:08 +0000 | [diff] [blame] | 1 | // RUN: %clang_cc1 -triple armv7-apple-darwin9 -emit-llvm -o - %s | FileCheck %s |
Arnold Schwaighofer | b715eb4 | 2016-10-14 21:55:56 +0000 | [diff] [blame] | 2 | // RUN: %clang_cc1 -triple armv7s-apple-ios9 -emit-llvm -o - %s | FileCheck %s |
| 3 | // RUN: %clang_cc1 -triple armv7k-apple-ios9 -emit-llvm -o - %s | FileCheck %s |
John McCall | 12f2352 | 2016-04-04 18:33:08 +0000 | [diff] [blame] | 4 | |
| 5 | #define SWIFTCALL __attribute__((swiftcall)) |
| 6 | #define OUT __attribute__((swift_indirect_result)) |
| 7 | #define ERROR __attribute__((swift_error_result)) |
| 8 | #define CONTEXT __attribute__((swift_context)) |
| 9 | |
| 10 | /*****************************************************************************/ |
| 11 | /****************************** PARAMETER ABIS *******************************/ |
| 12 | /*****************************************************************************/ |
| 13 | |
| 14 | SWIFTCALL void indirect_result_1(OUT int *arg0, OUT float *arg1) {} |
| 15 | // CHECK-LABEL: define {{.*}} void @indirect_result_1(i32* noalias sret align 4 dereferenceable(4){{.*}}, float* noalias align 4 dereferenceable(4){{.*}}) |
| 16 | |
| 17 | // TODO: maybe this shouldn't suppress sret. |
| 18 | SWIFTCALL int indirect_result_2(OUT int *arg0, OUT float *arg1) { __builtin_unreachable(); } |
| 19 | // CHECK-LABEL: define {{.*}} i32 @indirect_result_2(i32* noalias align 4 dereferenceable(4){{.*}}, float* noalias align 4 dereferenceable(4){{.*}}) |
| 20 | |
| 21 | typedef struct { char array[1024]; } struct_reallybig; |
| 22 | SWIFTCALL struct_reallybig indirect_result_3(OUT int *arg0, OUT float *arg1) { __builtin_unreachable(); } |
| 23 | // CHECK-LABEL: define {{.*}} void @indirect_result_3({{.*}}* noalias sret {{.*}}, i32* noalias align 4 dereferenceable(4){{.*}}, float* noalias align 4 dereferenceable(4){{.*}}) |
| 24 | |
| 25 | SWIFTCALL void context_1(CONTEXT void *self) {} |
| 26 | // CHECK-LABEL: define {{.*}} void @context_1(i8* swiftself |
| 27 | |
| 28 | SWIFTCALL void context_2(void *arg0, CONTEXT void *self) {} |
| 29 | // CHECK-LABEL: define {{.*}} void @context_2(i8*{{.*}}, i8* swiftself |
| 30 | |
| 31 | SWIFTCALL void context_error_1(CONTEXT int *self, ERROR float **error) {} |
| 32 | // CHECK-LABEL: define {{.*}} void @context_error_1(i32* swiftself{{.*}}, float** swifterror) |
| 33 | // CHECK: [[TEMP:%.*]] = alloca float*, align 4 |
| 34 | // CHECK: [[T0:%.*]] = load float*, float** [[ERRORARG:%.*]], align 4 |
| 35 | // CHECK: store float* [[T0]], float** [[TEMP]], align 4 |
| 36 | // CHECK: [[T0:%.*]] = load float*, float** [[TEMP]], align 4 |
| 37 | // CHECK: store float* [[T0]], float** [[ERRORARG]], align 4 |
| 38 | void test_context_error_1() { |
| 39 | int x; |
| 40 | float *error; |
| 41 | context_error_1(&x, &error); |
| 42 | } |
| 43 | // CHECK-LABEL: define void @test_context_error_1() |
| 44 | // CHECK: [[X:%.*]] = alloca i32, align 4 |
| 45 | // CHECK: [[ERROR:%.*]] = alloca float*, align 4 |
| 46 | // CHECK: [[TEMP:%.*]] = alloca swifterror float*, align 4 |
| 47 | // CHECK: [[T0:%.*]] = load float*, float** [[ERROR]], align 4 |
| 48 | // CHECK: store float* [[T0]], float** [[TEMP]], align 4 |
Manman Ren | 29be7e1 | 2016-04-05 23:27:51 +0000 | [diff] [blame] | 49 | // CHECK: call [[SWIFTCC:swiftcc]] void @context_error_1(i32* swiftself [[X]], float** swifterror [[TEMP]]) |
John McCall | 12f2352 | 2016-04-04 18:33:08 +0000 | [diff] [blame] | 50 | // CHECK: [[T0:%.*]] = load float*, float** [[TEMP]], align 4 |
| 51 | // CHECK: store float* [[T0]], float** [[ERROR]], align 4 |
| 52 | |
| 53 | SWIFTCALL void context_error_2(short s, CONTEXT int *self, ERROR float **error) {} |
| 54 | // CHECK-LABEL: define {{.*}} void @context_error_2(i16{{.*}}, i32* swiftself{{.*}}, float** swifterror) |
| 55 | |
| 56 | /*****************************************************************************/ |
| 57 | /********************************** LOWERING *********************************/ |
| 58 | /*****************************************************************************/ |
| 59 | |
| 60 | typedef float float4 __attribute__((ext_vector_type(4))); |
| 61 | typedef float float8 __attribute__((ext_vector_type(8))); |
| 62 | typedef double double2 __attribute__((ext_vector_type(2))); |
| 63 | typedef double double4 __attribute__((ext_vector_type(4))); |
John McCall | 8cde42c | 2016-04-04 20:39:50 +0000 | [diff] [blame] | 64 | typedef int int3 __attribute__((ext_vector_type(3))); |
John McCall | 12f2352 | 2016-04-04 18:33:08 +0000 | [diff] [blame] | 65 | typedef int int4 __attribute__((ext_vector_type(4))); |
| 66 | typedef int int5 __attribute__((ext_vector_type(5))); |
| 67 | typedef int int8 __attribute__((ext_vector_type(8))); |
Arnold Schwaighofer | b715eb4 | 2016-10-14 21:55:56 +0000 | [diff] [blame] | 68 | typedef char char16 __attribute__((ext_vector_type(16))); |
| 69 | typedef short short8 __attribute__((ext_vector_type(8))); |
| 70 | typedef long long long2 __attribute__((ext_vector_type(2))); |
John McCall | 12f2352 | 2016-04-04 18:33:08 +0000 | [diff] [blame] | 71 | |
| 72 | #define TEST(TYPE) \ |
| 73 | SWIFTCALL TYPE return_##TYPE(void) { \ |
| 74 | TYPE result = {}; \ |
| 75 | return result; \ |
| 76 | } \ |
| 77 | SWIFTCALL void take_##TYPE(TYPE v) { \ |
| 78 | } \ |
| 79 | void test_##TYPE() { \ |
| 80 | take_##TYPE(return_##TYPE()); \ |
| 81 | } |
| 82 | |
| 83 | /*****************************************************************************/ |
| 84 | /*********************************** STRUCTS *********************************/ |
| 85 | /*****************************************************************************/ |
| 86 | |
| 87 | typedef struct { |
| 88 | } struct_empty; |
| 89 | TEST(struct_empty); |
| 90 | // CHECK-LABEL: define {{.*}} @return_struct_empty() |
| 91 | // CHECK: ret void |
| 92 | // CHECK-LABEL: define {{.*}} @take_struct_empty() |
| 93 | // CHECK: ret void |
| 94 | |
| 95 | typedef struct { |
| 96 | int x; |
| 97 | char c0; |
| 98 | char c1; |
| 99 | float f0; |
| 100 | float f1; |
| 101 | } struct_1; |
| 102 | TEST(struct_1); |
| 103 | // CHECK-LABEL: define {{.*}} @return_struct_1() |
| 104 | // CHECK: [[RET:%.*]] = alloca [[REC:%.*]], align 4 |
| 105 | // CHECK: [[VAR:%.*]] = alloca [[REC]], align 4 |
| 106 | // CHECK: @llvm.memset |
| 107 | // CHECK: @llvm.memcpy |
| 108 | // CHECK: [[CAST_TMP:%.*]] = bitcast [[REC]]* [[RET]] to [[AGG:{ i32, i16, \[2 x i8\], float, float }]]* |
| 109 | // CHECK: [[T0:%.*]] = getelementptr inbounds [[AGG]], [[AGG]]* [[CAST_TMP]], i32 0, i32 0 |
| 110 | // CHECK: [[FIRST:%.*]] = load i32, i32* [[T0]], align 4 |
| 111 | // CHECK: [[T0:%.*]] = getelementptr inbounds [[AGG]], [[AGG]]* [[CAST_TMP]], i32 0, i32 1 |
| 112 | // CHECK: [[SECOND:%.*]] = load i16, i16* [[T0]], align 4 |
| 113 | // CHECK: [[T0:%.*]] = getelementptr inbounds [[AGG]], [[AGG]]* [[CAST_TMP]], i32 0, i32 3 |
| 114 | // CHECK: [[THIRD:%.*]] = load float, float* [[T0]], align |
| 115 | // CHECK: [[T0:%.*]] = getelementptr inbounds [[AGG]], [[AGG]]* [[CAST_TMP]], i32 0, i32 4 |
| 116 | // CHECK: [[FOURTH:%.*]] = load float, float* [[T0]], align |
| 117 | // CHECK: [[T0:%.*]] = insertvalue [[UAGG:{ i32, i16, float, float }]] undef, i32 [[FIRST]], 0 |
| 118 | // CHECK: [[T1:%.*]] = insertvalue [[UAGG]] [[T0]], i16 [[SECOND]], 1 |
| 119 | // CHECK: [[T2:%.*]] = insertvalue [[UAGG]] [[T1]], float [[THIRD]], 2 |
| 120 | // CHECK: [[T3:%.*]] = insertvalue [[UAGG]] [[T2]], float [[FOURTH]], 3 |
| 121 | // CHECK: ret [[UAGG]] [[T3]] |
| 122 | // CHECK-LABEL: define {{.*}} @take_struct_1(i32, i16, float, float) |
| 123 | // CHECK: [[V:%.*]] = alloca [[REC]], align 4 |
| 124 | // CHECK: [[CAST_TMP:%.*]] = bitcast [[REC]]* [[V]] to [[AGG]]* |
| 125 | // CHECK: [[T0:%.*]] = getelementptr inbounds [[AGG]], [[AGG]]* [[CAST_TMP]], i32 0, i32 0 |
| 126 | // CHECK: store i32 %0, i32* [[T0]], align 4 |
| 127 | // CHECK: [[T0:%.*]] = getelementptr inbounds [[AGG]], [[AGG]]* [[CAST_TMP]], i32 0, i32 1 |
| 128 | // CHECK: store i16 %1, i16* [[T0]], align 4 |
| 129 | // CHECK: [[T0:%.*]] = getelementptr inbounds [[AGG]], [[AGG]]* [[CAST_TMP]], i32 0, i32 3 |
| 130 | // CHECK: store float %2, float* [[T0]], align 4 |
| 131 | // CHECK: [[T0:%.*]] = getelementptr inbounds [[AGG]], [[AGG]]* [[CAST_TMP]], i32 0, i32 4 |
| 132 | // CHECK: store float %3, float* [[T0]], align 4 |
| 133 | // CHECK: ret void |
| 134 | // CHECK-LABEL: define void @test_struct_1() |
| 135 | // CHECK: [[TMP:%.*]] = alloca [[REC]], align 4 |
| 136 | // CHECK: [[CALL:%.*]] = call [[SWIFTCC]] [[UAGG]] @return_struct_1() |
| 137 | // CHECK: [[CAST_TMP:%.*]] = bitcast [[REC]]* [[TMP]] to [[AGG]]* |
| 138 | // CHECK: [[T0:%.*]] = getelementptr inbounds [[AGG]], [[AGG]]* [[CAST_TMP]], i32 0, i32 0 |
| 139 | // CHECK: [[T1:%.*]] = extractvalue [[UAGG]] [[CALL]], 0 |
| 140 | // CHECK: store i32 [[T1]], i32* [[T0]], align 4 |
| 141 | // CHECK: [[T0:%.*]] = getelementptr inbounds [[AGG]], [[AGG]]* [[CAST_TMP]], i32 0, i32 1 |
| 142 | // CHECK: [[T1:%.*]] = extractvalue [[UAGG]] [[CALL]], 1 |
| 143 | // CHECK: store i16 [[T1]], i16* [[T0]], align 4 |
| 144 | // CHECK: [[T0:%.*]] = getelementptr inbounds [[AGG]], [[AGG]]* [[CAST_TMP]], i32 0, i32 3 |
| 145 | // CHECK: [[T1:%.*]] = extractvalue [[UAGG]] [[CALL]], 2 |
| 146 | // CHECK: store float [[T1]], float* [[T0]], align 4 |
| 147 | // CHECK: [[T0:%.*]] = getelementptr inbounds [[AGG]], [[AGG]]* [[CAST_TMP]], i32 0, i32 4 |
| 148 | // CHECK: [[T1:%.*]] = extractvalue [[UAGG]] [[CALL]], 3 |
| 149 | // CHECK: store float [[T1]], float* [[T0]], align 4 |
| 150 | // CHECK: [[CAST_TMP:%.*]] = bitcast [[REC]]* [[TMP]] to [[AGG]]* |
| 151 | // CHECK: [[T0:%.*]] = getelementptr inbounds [[AGG]], [[AGG]]* [[CAST_TMP]], i32 0, i32 0 |
| 152 | // CHECK: [[FIRST:%.*]] = load i32, i32* [[T0]], align 4 |
| 153 | // CHECK: [[T0:%.*]] = getelementptr inbounds [[AGG]], [[AGG]]* [[CAST_TMP]], i32 0, i32 1 |
| 154 | // CHECK: [[SECOND:%.*]] = load i16, i16* [[T0]], align 4 |
| 155 | // CHECK: [[T0:%.*]] = getelementptr inbounds [[AGG]], [[AGG]]* [[CAST_TMP]], i32 0, i32 3 |
| 156 | // CHECK: [[THIRD:%.*]] = load float, float* [[T0]], align 4 |
| 157 | // CHECK: [[T0:%.*]] = getelementptr inbounds [[AGG]], [[AGG]]* [[CAST_TMP]], i32 0, i32 4 |
| 158 | // CHECK: [[FOURTH:%.*]] = load float, float* [[T0]], align 4 |
| 159 | // CHECK: call [[SWIFTCC]] void @take_struct_1(i32 [[FIRST]], i16 [[SECOND]], float [[THIRD]], float [[FOURTH]]) |
| 160 | // CHECK: ret void |
| 161 | |
| 162 | typedef struct { |
| 163 | int x; |
| 164 | char c0; |
| 165 | __attribute__((aligned(2))) char c1; |
| 166 | float f0; |
| 167 | float f1; |
| 168 | } struct_2; |
| 169 | TEST(struct_2); |
| 170 | // CHECK-LABEL: define {{.*}} @return_struct_2() |
| 171 | // CHECK: [[RET:%.*]] = alloca [[REC:%.*]], align 4 |
| 172 | // CHECK: [[VAR:%.*]] = alloca [[REC]], align 4 |
| 173 | // CHECK: @llvm.memcpy |
| 174 | // CHECK: @llvm.memcpy |
| 175 | // CHECK: [[CAST_TMP:%.*]] = bitcast [[REC]]* [[RET]] to [[AGG:{ i32, i32, float, float }]]* |
| 176 | // CHECK: [[T0:%.*]] = getelementptr inbounds [[AGG]], [[AGG]]* [[CAST_TMP]], i32 0, i32 0 |
| 177 | // CHECK: [[FIRST:%.*]] = load i32, i32* [[T0]], align 4 |
| 178 | // CHECK: [[T0:%.*]] = getelementptr inbounds [[AGG]], [[AGG]]* [[CAST_TMP]], i32 0, i32 1 |
| 179 | // CHECK: [[SECOND:%.*]] = load i32, i32* [[T0]], align 4 |
| 180 | // CHECK: [[T0:%.*]] = getelementptr inbounds [[AGG]], [[AGG]]* [[CAST_TMP]], i32 0, i32 2 |
| 181 | // CHECK: [[THIRD:%.*]] = load float, float* [[T0]], align |
| 182 | // CHECK: [[T0:%.*]] = getelementptr inbounds [[AGG]], [[AGG]]* [[CAST_TMP]], i32 0, i32 3 |
| 183 | // CHECK: [[FOURTH:%.*]] = load float, float* [[T0]], align |
| 184 | // CHECK: [[T0:%.*]] = insertvalue [[UAGG:{ i32, i32, float, float }]] undef, i32 [[FIRST]], 0 |
| 185 | // CHECK: [[T1:%.*]] = insertvalue [[UAGG]] [[T0]], i32 [[SECOND]], 1 |
| 186 | // CHECK: [[T2:%.*]] = insertvalue [[UAGG]] [[T1]], float [[THIRD]], 2 |
| 187 | // CHECK: [[T3:%.*]] = insertvalue [[UAGG]] [[T2]], float [[FOURTH]], 3 |
| 188 | // CHECK: ret [[UAGG]] [[T3]] |
| 189 | // CHECK-LABEL: define {{.*}} @take_struct_2(i32, i32, float, float) |
| 190 | // CHECK: [[V:%.*]] = alloca [[REC]], align 4 |
| 191 | // CHECK: [[CAST_TMP:%.*]] = bitcast [[REC]]* [[V]] to [[AGG]]* |
| 192 | // CHECK: [[T0:%.*]] = getelementptr inbounds [[AGG]], [[AGG]]* [[CAST_TMP]], i32 0, i32 0 |
| 193 | // CHECK: store i32 %0, i32* [[T0]], align 4 |
| 194 | // CHECK: [[T0:%.*]] = getelementptr inbounds [[AGG]], [[AGG]]* [[CAST_TMP]], i32 0, i32 1 |
| 195 | // CHECK: store i32 %1, i32* [[T0]], align 4 |
| 196 | // CHECK: [[T0:%.*]] = getelementptr inbounds [[AGG]], [[AGG]]* [[CAST_TMP]], i32 0, i32 2 |
| 197 | // CHECK: store float %2, float* [[T0]], align 4 |
| 198 | // CHECK: [[T0:%.*]] = getelementptr inbounds [[AGG]], [[AGG]]* [[CAST_TMP]], i32 0, i32 3 |
| 199 | // CHECK: store float %3, float* [[T0]], align 4 |
| 200 | // CHECK: ret void |
| 201 | // CHECK-LABEL: define void @test_struct_2() |
| 202 | // CHECK: [[TMP:%.*]] = alloca [[REC]], align 4 |
| 203 | // CHECK: [[CALL:%.*]] = call [[SWIFTCC]] [[UAGG]] @return_struct_2() |
| 204 | // CHECK: [[CAST_TMP:%.*]] = bitcast [[REC]]* [[TMP]] to [[AGG]]* |
| 205 | // CHECK: [[T0:%.*]] = getelementptr inbounds [[AGG]], [[AGG]]* [[CAST_TMP]], i32 0, i32 0 |
| 206 | // CHECK: [[T1:%.*]] = extractvalue [[UAGG]] [[CALL]], 0 |
| 207 | // CHECK: store i32 [[T1]], i32* [[T0]], align 4 |
| 208 | // CHECK: [[T0:%.*]] = getelementptr inbounds [[AGG]], [[AGG]]* [[CAST_TMP]], i32 0, i32 1 |
| 209 | // CHECK: [[T1:%.*]] = extractvalue [[UAGG]] [[CALL]], 1 |
| 210 | // CHECK: store i32 [[T1]], i32* [[T0]], align 4 |
| 211 | // CHECK: [[T0:%.*]] = getelementptr inbounds [[AGG]], [[AGG]]* [[CAST_TMP]], i32 0, i32 2 |
| 212 | // CHECK: [[T1:%.*]] = extractvalue [[UAGG]] [[CALL]], 2 |
| 213 | // CHECK: store float [[T1]], float* [[T0]], align 4 |
| 214 | // CHECK: [[T0:%.*]] = getelementptr inbounds [[AGG]], [[AGG]]* [[CAST_TMP]], i32 0, i32 3 |
| 215 | // CHECK: [[T1:%.*]] = extractvalue [[UAGG]] [[CALL]], 3 |
| 216 | // CHECK: store float [[T1]], float* [[T0]], align 4 |
| 217 | // CHECK: [[CAST_TMP:%.*]] = bitcast [[REC]]* [[TMP]] to [[AGG]]* |
| 218 | // CHECK: [[T0:%.*]] = getelementptr inbounds [[AGG]], [[AGG]]* [[CAST_TMP]], i32 0, i32 0 |
| 219 | // CHECK: [[FIRST:%.*]] = load i32, i32* [[T0]], align 4 |
| 220 | // CHECK: [[T0:%.*]] = getelementptr inbounds [[AGG]], [[AGG]]* [[CAST_TMP]], i32 0, i32 1 |
| 221 | // CHECK: [[SECOND:%.*]] = load i32, i32* [[T0]], align 4 |
| 222 | // CHECK: [[T0:%.*]] = getelementptr inbounds [[AGG]], [[AGG]]* [[CAST_TMP]], i32 0, i32 2 |
| 223 | // CHECK: [[THIRD:%.*]] = load float, float* [[T0]], align 4 |
| 224 | // CHECK: [[T0:%.*]] = getelementptr inbounds [[AGG]], [[AGG]]* [[CAST_TMP]], i32 0, i32 3 |
| 225 | // CHECK: [[FOURTH:%.*]] = load float, float* [[T0]], align 4 |
| 226 | // CHECK: call [[SWIFTCC]] void @take_struct_2(i32 [[FIRST]], i32 [[SECOND]], float [[THIRD]], float [[FOURTH]]) |
| 227 | // CHECK: ret void |
| 228 | |
| 229 | // There's no way to put a field randomly in the middle of an otherwise |
| 230 | // empty storage unit in C, so that case has to be tested in C++, which |
| 231 | // can use empty structs to introduce arbitrary padding. (In C, they end up |
| 232 | // with size 0 and so don't affect layout.) |
| 233 | |
| 234 | // Misaligned data rule. |
| 235 | typedef struct { |
| 236 | char c0; |
| 237 | __attribute__((packed)) float f; |
| 238 | } struct_misaligned_1; |
| 239 | TEST(struct_misaligned_1) |
| 240 | // CHECK-LABEL: define {{.*}} @return_struct_misaligned_1() |
| 241 | // CHECK: [[RET:%.*]] = alloca [[REC:%.*]], align |
| 242 | // CHECK: [[VAR:%.*]] = alloca [[REC]], align |
| 243 | // CHECK: @llvm.memset |
| 244 | // CHECK: @llvm.memcpy |
| 245 | // CHECK: [[CAST_TMP:%.*]] = bitcast [[REC]]* [[RET]] to [[AGG:{ i32, i8 }]]* |
| 246 | // CHECK: [[T0:%.*]] = getelementptr inbounds [[AGG]], [[AGG]]* [[CAST_TMP]], i32 0, i32 0 |
| 247 | // CHECK: [[FIRST:%.*]] = load i32, i32* [[T0]], align |
| 248 | // CHECK: [[T0:%.*]] = getelementptr inbounds [[AGG]], [[AGG]]* [[CAST_TMP]], i32 0, i32 1 |
| 249 | // CHECK: [[SECOND:%.*]] = load i8, i8* [[T0]], align |
| 250 | // CHECK: [[T0:%.*]] = insertvalue [[UAGG:{ i32, i8 }]] undef, i32 [[FIRST]], 0 |
| 251 | // CHECK: [[T1:%.*]] = insertvalue [[UAGG]] [[T0]], i8 [[SECOND]], 1 |
| 252 | // CHECK: ret [[UAGG]] [[T1]] |
| 253 | // CHECK-LABEL: define {{.*}} @take_struct_misaligned_1(i32, i8) |
| 254 | // CHECK: [[V:%.*]] = alloca [[REC]], align |
| 255 | // CHECK: [[CAST_TMP:%.*]] = bitcast [[REC]]* [[V]] to [[AGG]]* |
| 256 | // CHECK: [[T0:%.*]] = getelementptr inbounds [[AGG]], [[AGG]]* [[CAST_TMP]], i32 0, i32 0 |
| 257 | // CHECK: store i32 %0, i32* [[T0]], align |
| 258 | // CHECK: [[T0:%.*]] = getelementptr inbounds [[AGG]], [[AGG]]* [[CAST_TMP]], i32 0, i32 1 |
| 259 | // CHECK: store i8 %1, i8* [[T0]], align |
| 260 | // CHECK: ret void |
| 261 | |
| 262 | // Too many scalars. |
| 263 | typedef struct { |
| 264 | int x[5]; |
| 265 | } struct_big_1; |
| 266 | TEST(struct_big_1) |
| 267 | |
| 268 | // CHECK-LABEL: define {{.*}} void @return_struct_big_1({{.*}} noalias sret |
| 269 | |
| 270 | // Should not be byval. |
| 271 | // CHECK-LABEL: define {{.*}} void @take_struct_big_1({{.*}}*{{( %.*)?}}) |
| 272 | |
| 273 | /*****************************************************************************/ |
| 274 | /********************************* TYPE MERGING ******************************/ |
| 275 | /*****************************************************************************/ |
| 276 | |
| 277 | typedef union { |
| 278 | float f; |
| 279 | double d; |
| 280 | } union_het_fp; |
| 281 | TEST(union_het_fp) |
| 282 | // CHECK-LABEL: define {{.*}} @return_union_het_fp() |
Arnold Schwaighofer | b715eb4 | 2016-10-14 21:55:56 +0000 | [diff] [blame] | 283 | // CHECK: [[RET:%.*]] = alloca [[REC:%.*]], align {{(4|8)}} |
| 284 | // CHECK: [[VAR:%.*]] = alloca [[REC]], align {{(4|8)}} |
John McCall | 12f2352 | 2016-04-04 18:33:08 +0000 | [diff] [blame] | 285 | // CHECK: @llvm.memcpy |
| 286 | // CHECK: @llvm.memcpy |
| 287 | // CHECK: [[CAST_TMP:%.*]] = bitcast [[REC]]* [[RET]] to [[AGG:{ i32, i32 }]]* |
| 288 | // CHECK: [[T0:%.*]] = getelementptr inbounds [[AGG]], [[AGG]]* [[CAST_TMP]], i32 0, i32 0 |
Arnold Schwaighofer | b715eb4 | 2016-10-14 21:55:56 +0000 | [diff] [blame] | 289 | // CHECK: [[FIRST:%.*]] = load i32, i32* [[T0]], align {{(4|8)}} |
John McCall | 12f2352 | 2016-04-04 18:33:08 +0000 | [diff] [blame] | 290 | // CHECK: [[T0:%.*]] = getelementptr inbounds [[AGG]], [[AGG]]* [[CAST_TMP]], i32 0, i32 1 |
Arnold Schwaighofer | b715eb4 | 2016-10-14 21:55:56 +0000 | [diff] [blame] | 291 | // CHECK: [[SECOND:%.*]] = load i32, i32* [[T0]], align {{(4|8)}} |
John McCall | 12f2352 | 2016-04-04 18:33:08 +0000 | [diff] [blame] | 292 | // CHECK: [[T0:%.*]] = insertvalue [[UAGG:{ i32, i32 }]] undef, i32 [[FIRST]], 0 |
| 293 | // CHECK: [[T1:%.*]] = insertvalue [[UAGG]] [[T0]], i32 [[SECOND]], 1 |
| 294 | // CHECK: ret [[UAGG]] [[T1]] |
| 295 | // CHECK-LABEL: define {{.*}} @take_union_het_fp(i32, i32) |
Arnold Schwaighofer | b715eb4 | 2016-10-14 21:55:56 +0000 | [diff] [blame] | 296 | // CHECK: [[V:%.*]] = alloca [[REC]], align {{(4|8)}} |
John McCall | 12f2352 | 2016-04-04 18:33:08 +0000 | [diff] [blame] | 297 | // CHECK: [[CAST_TMP:%.*]] = bitcast [[REC]]* [[V]] to [[AGG]]* |
| 298 | // CHECK: [[T0:%.*]] = getelementptr inbounds [[AGG]], [[AGG]]* [[CAST_TMP]], i32 0, i32 0 |
Arnold Schwaighofer | b715eb4 | 2016-10-14 21:55:56 +0000 | [diff] [blame] | 299 | // CHECK: store i32 %0, i32* [[T0]], align {{(4|8)}} |
John McCall | 12f2352 | 2016-04-04 18:33:08 +0000 | [diff] [blame] | 300 | // CHECK: [[T0:%.*]] = getelementptr inbounds [[AGG]], [[AGG]]* [[CAST_TMP]], i32 0, i32 1 |
Arnold Schwaighofer | b715eb4 | 2016-10-14 21:55:56 +0000 | [diff] [blame] | 301 | // CHECK: store i32 %1, i32* [[T0]], align {{(4|8)}} |
John McCall | 12f2352 | 2016-04-04 18:33:08 +0000 | [diff] [blame] | 302 | // CHECK: ret void |
| 303 | // CHECK-LABEL: define void @test_union_het_fp() |
Arnold Schwaighofer | b715eb4 | 2016-10-14 21:55:56 +0000 | [diff] [blame] | 304 | // CHECK: [[TMP:%.*]] = alloca [[REC]], align {{(4|8)}} |
John McCall | 12f2352 | 2016-04-04 18:33:08 +0000 | [diff] [blame] | 305 | // CHECK: [[CALL:%.*]] = call [[SWIFTCC]] [[UAGG]] @return_union_het_fp() |
| 306 | // CHECK: [[CAST_TMP:%.*]] = bitcast [[REC]]* [[TMP]] to [[AGG]]* |
| 307 | // CHECK: [[T0:%.*]] = getelementptr inbounds [[AGG]], [[AGG]]* [[CAST_TMP]], i32 0, i32 0 |
| 308 | // CHECK: [[T1:%.*]] = extractvalue [[UAGG]] [[CALL]], 0 |
Arnold Schwaighofer | b715eb4 | 2016-10-14 21:55:56 +0000 | [diff] [blame] | 309 | // CHECK: store i32 [[T1]], i32* [[T0]], align {{(4|8)}} |
John McCall | 12f2352 | 2016-04-04 18:33:08 +0000 | [diff] [blame] | 310 | // CHECK: [[T0:%.*]] = getelementptr inbounds [[AGG]], [[AGG]]* [[CAST_TMP]], i32 0, i32 1 |
| 311 | // CHECK: [[T1:%.*]] = extractvalue [[UAGG]] [[CALL]], 1 |
Arnold Schwaighofer | b715eb4 | 2016-10-14 21:55:56 +0000 | [diff] [blame] | 312 | // CHECK: store i32 [[T1]], i32* [[T0]], align {{(4|8)}} |
John McCall | 12f2352 | 2016-04-04 18:33:08 +0000 | [diff] [blame] | 313 | // CHECK: [[CAST_TMP:%.*]] = bitcast [[REC]]* [[TMP]] to [[AGG]]* |
| 314 | // CHECK: [[T0:%.*]] = getelementptr inbounds [[AGG]], [[AGG]]* [[CAST_TMP]], i32 0, i32 0 |
Arnold Schwaighofer | b715eb4 | 2016-10-14 21:55:56 +0000 | [diff] [blame] | 315 | // CHECK: [[FIRST:%.*]] = load i32, i32* [[T0]], align {{(4|8)}} |
John McCall | 12f2352 | 2016-04-04 18:33:08 +0000 | [diff] [blame] | 316 | // CHECK: [[T0:%.*]] = getelementptr inbounds [[AGG]], [[AGG]]* [[CAST_TMP]], i32 0, i32 1 |
Arnold Schwaighofer | b715eb4 | 2016-10-14 21:55:56 +0000 | [diff] [blame] | 317 | // CHECK: [[SECOND:%.*]] = load i32, i32* [[T0]], align {{(4|8)}} |
John McCall | 12f2352 | 2016-04-04 18:33:08 +0000 | [diff] [blame] | 318 | // CHECK: call [[SWIFTCC]] void @take_union_het_fp(i32 [[FIRST]], i32 [[SECOND]]) |
| 319 | // CHECK: ret void |
| 320 | |
| 321 | |
| 322 | typedef union { |
| 323 | float f1; |
| 324 | float f2; |
| 325 | } union_hom_fp; |
| 326 | TEST(union_hom_fp) |
| 327 | // CHECK-LABEL: define void @test_union_hom_fp() |
| 328 | // CHECK: [[TMP:%.*]] = alloca [[REC:%.*]], align 4 |
| 329 | // CHECK: [[CALL:%.*]] = call [[SWIFTCC]] float @return_union_hom_fp() |
| 330 | // CHECK: [[CAST_TMP:%.*]] = bitcast [[REC]]* [[TMP]] to [[AGG:{ float }]]* |
| 331 | // CHECK: [[T0:%.*]] = getelementptr inbounds [[AGG]], [[AGG]]* [[CAST_TMP]], i32 0, i32 0 |
| 332 | // CHECK: store float [[CALL]], float* [[T0]], align 4 |
| 333 | // CHECK: [[CAST_TMP:%.*]] = bitcast [[REC]]* [[TMP]] to [[AGG]]* |
| 334 | // CHECK: [[T0:%.*]] = getelementptr inbounds [[AGG]], [[AGG]]* [[CAST_TMP]], i32 0, i32 0 |
| 335 | // CHECK: [[FIRST:%.*]] = load float, float* [[T0]], align 4 |
| 336 | // CHECK: call [[SWIFTCC]] void @take_union_hom_fp(float [[FIRST]]) |
| 337 | // CHECK: ret void |
| 338 | |
| 339 | typedef union { |
| 340 | float f1; |
| 341 | float4 fv2; |
| 342 | } union_hom_fp_partial; |
| 343 | TEST(union_hom_fp_partial) |
| 344 | // CHECK-LABEL: define void @test_union_hom_fp_partial() |
| 345 | // CHECK: [[TMP:%.*]] = alloca [[REC:%.*]], align 16 |
| 346 | // CHECK: [[CALL:%.*]] = call [[SWIFTCC]] [[UAGG:{ float, float, float, float }]] @return_union_hom_fp_partial() |
| 347 | // CHECK: [[CAST_TMP:%.*]] = bitcast [[REC]]* [[TMP]] to [[AGG:{ float, float, float, float }]]* |
| 348 | // CHECK: [[T0:%.*]] = getelementptr inbounds [[AGG]], [[AGG]]* [[CAST_TMP]], i32 0, i32 0 |
| 349 | // CHECK: [[T1:%.*]] = extractvalue [[UAGG]] [[CALL]], 0 |
| 350 | // CHECK: store float [[T1]], float* [[T0]], align |
| 351 | // CHECK: [[T0:%.*]] = getelementptr inbounds [[AGG]], [[AGG]]* [[CAST_TMP]], i32 0, i32 1 |
| 352 | // CHECK: [[T1:%.*]] = extractvalue [[UAGG]] [[CALL]], 1 |
| 353 | // CHECK: store float [[T1]], float* [[T0]], align |
| 354 | // CHECK: [[T0:%.*]] = getelementptr inbounds [[AGG]], [[AGG]]* [[CAST_TMP]], i32 0, i32 2 |
| 355 | // CHECK: [[T1:%.*]] = extractvalue [[UAGG]] [[CALL]], 2 |
| 356 | // CHECK: store float [[T1]], float* [[T0]], align |
| 357 | // CHECK: [[T0:%.*]] = getelementptr inbounds [[AGG]], [[AGG]]* [[CAST_TMP]], i32 0, i32 3 |
| 358 | // CHECK: [[T1:%.*]] = extractvalue [[UAGG]] [[CALL]], 3 |
| 359 | // CHECK: store float [[T1]], float* [[T0]], align |
| 360 | // CHECK: [[CAST_TMP:%.*]] = bitcast [[REC]]* [[TMP]] to [[AGG]]* |
| 361 | // CHECK: [[T0:%.*]] = getelementptr inbounds [[AGG]], [[AGG]]* [[CAST_TMP]], i32 0, i32 0 |
| 362 | // CHECK: [[FIRST:%.*]] = load float, float* [[T0]], align |
| 363 | // CHECK: [[T0:%.*]] = getelementptr inbounds [[AGG]], [[AGG]]* [[CAST_TMP]], i32 0, i32 1 |
| 364 | // CHECK: [[SECOND:%.*]] = load float, float* [[T0]], align |
| 365 | // CHECK: [[T0:%.*]] = getelementptr inbounds [[AGG]], [[AGG]]* [[CAST_TMP]], i32 0, i32 2 |
| 366 | // CHECK: [[THIRD:%.*]] = load float, float* [[T0]], align |
| 367 | // CHECK: [[T0:%.*]] = getelementptr inbounds [[AGG]], [[AGG]]* [[CAST_TMP]], i32 0, i32 3 |
| 368 | // CHECK: [[FOURTH:%.*]] = load float, float* [[T0]], align |
| 369 | // CHECK: call [[SWIFTCC]] void @take_union_hom_fp_partial(float [[FIRST]], float [[SECOND]], float [[THIRD]], float [[FOURTH]]) |
| 370 | // CHECK: ret void |
| 371 | |
| 372 | typedef union { |
| 373 | struct { int x, y; } f1; |
| 374 | float4 fv2; |
| 375 | } union_het_fpv_partial; |
| 376 | TEST(union_het_fpv_partial) |
| 377 | // CHECK-LABEL: define void @test_union_het_fpv_partial() |
| 378 | // CHECK: [[TMP:%.*]] = alloca [[REC:%.*]], align 16 |
| 379 | // CHECK: [[CALL:%.*]] = call [[SWIFTCC]] [[UAGG:{ i32, i32, float, float }]] @return_union_het_fpv_partial() |
| 380 | // CHECK: [[CAST_TMP:%.*]] = bitcast [[REC]]* [[TMP]] to [[AGG:{ i32, i32, float, float }]]* |
| 381 | // CHECK: [[T0:%.*]] = getelementptr inbounds [[AGG]], [[AGG]]* [[CAST_TMP]], i32 0, i32 0 |
| 382 | // CHECK: [[T1:%.*]] = extractvalue [[UAGG]] [[CALL]], 0 |
| 383 | // CHECK: store i32 [[T1]], i32* [[T0]], align |
| 384 | // CHECK: [[T0:%.*]] = getelementptr inbounds [[AGG]], [[AGG]]* [[CAST_TMP]], i32 0, i32 1 |
| 385 | // CHECK: [[T1:%.*]] = extractvalue [[UAGG]] [[CALL]], 1 |
| 386 | // CHECK: store i32 [[T1]], i32* [[T0]], align |
| 387 | // CHECK: [[T0:%.*]] = getelementptr inbounds [[AGG]], [[AGG]]* [[CAST_TMP]], i32 0, i32 2 |
| 388 | // CHECK: [[T1:%.*]] = extractvalue [[UAGG]] [[CALL]], 2 |
| 389 | // CHECK: store float [[T1]], float* [[T0]], align |
| 390 | // CHECK: [[T0:%.*]] = getelementptr inbounds [[AGG]], [[AGG]]* [[CAST_TMP]], i32 0, i32 3 |
| 391 | // CHECK: [[T1:%.*]] = extractvalue [[UAGG]] [[CALL]], 3 |
| 392 | // CHECK: store float [[T1]], float* [[T0]], align |
| 393 | // CHECK: [[CAST_TMP:%.*]] = bitcast [[REC]]* [[TMP]] to [[AGG]]* |
| 394 | // CHECK: [[T0:%.*]] = getelementptr inbounds [[AGG]], [[AGG]]* [[CAST_TMP]], i32 0, i32 0 |
| 395 | // CHECK: [[FIRST:%.*]] = load i32, i32* [[T0]], align |
| 396 | // CHECK: [[T0:%.*]] = getelementptr inbounds [[AGG]], [[AGG]]* [[CAST_TMP]], i32 0, i32 1 |
| 397 | // CHECK: [[SECOND:%.*]] = load i32, i32* [[T0]], align |
| 398 | // CHECK: [[T0:%.*]] = getelementptr inbounds [[AGG]], [[AGG]]* [[CAST_TMP]], i32 0, i32 2 |
| 399 | // CHECK: [[THIRD:%.*]] = load float, float* [[T0]], align |
| 400 | // CHECK: [[T0:%.*]] = getelementptr inbounds [[AGG]], [[AGG]]* [[CAST_TMP]], i32 0, i32 3 |
| 401 | // CHECK: [[FOURTH:%.*]] = load float, float* [[T0]], align |
| 402 | // CHECK: call [[SWIFTCC]] void @take_union_het_fpv_partial(i32 [[FIRST]], i32 [[SECOND]], float [[THIRD]], float [[FOURTH]]) |
| 403 | // CHECK: ret void |
| 404 | |
| 405 | /*****************************************************************************/ |
| 406 | /****************************** VECTOR LEGALIZATION **************************/ |
| 407 | /*****************************************************************************/ |
| 408 | |
| 409 | TEST(int4) |
| 410 | // CHECK-LABEL: define {{.*}} <4 x i32> @return_int4() |
| 411 | // CHECK-LABEL: define {{.*}} @take_int4(<4 x i32> |
| 412 | |
| 413 | TEST(int8) |
| 414 | // CHECK-LABEL: define {{.*}} @return_int8() |
| 415 | // CHECK: [[RET:%.*]] = alloca [[REC:<8 x i32>]], align 32 |
| 416 | // CHECK: [[VAR:%.*]] = alloca [[REC]], align |
| 417 | // CHECK: store |
| 418 | // CHECK: load |
| 419 | // CHECK: store |
| 420 | // CHECK: [[CAST_TMP:%.*]] = bitcast [[REC]]* [[RET]] to [[AGG:{ <4 x i32>, <4 x i32> }]]* |
| 421 | // CHECK: [[T0:%.*]] = getelementptr inbounds [[AGG]], [[AGG]]* [[CAST_TMP]], i32 0, i32 0 |
| 422 | // CHECK: [[FIRST:%.*]] = load <4 x i32>, <4 x i32>* [[T0]], align |
| 423 | // CHECK: [[T0:%.*]] = getelementptr inbounds [[AGG]], [[AGG]]* [[CAST_TMP]], i32 0, i32 1 |
| 424 | // CHECK: [[SECOND:%.*]] = load <4 x i32>, <4 x i32>* [[T0]], align |
| 425 | // CHECK: [[T0:%.*]] = insertvalue [[UAGG:{ <4 x i32>, <4 x i32> }]] undef, <4 x i32> [[FIRST]], 0 |
| 426 | // CHECK: [[T1:%.*]] = insertvalue [[UAGG]] [[T0]], <4 x i32> [[SECOND]], 1 |
| 427 | // CHECK: ret [[UAGG]] [[T1]] |
| 428 | // CHECK-LABEL: define {{.*}} @take_int8(<4 x i32>, <4 x i32>) |
| 429 | // CHECK: [[V:%.*]] = alloca [[REC]], align |
| 430 | // CHECK: [[CAST_TMP:%.*]] = bitcast [[REC]]* [[V]] to [[AGG]]* |
| 431 | // CHECK: [[T0:%.*]] = getelementptr inbounds [[AGG]], [[AGG]]* [[CAST_TMP]], i32 0, i32 0 |
| 432 | // CHECK: store <4 x i32> %0, <4 x i32>* [[T0]], align |
| 433 | // CHECK: [[T0:%.*]] = getelementptr inbounds [[AGG]], [[AGG]]* [[CAST_TMP]], i32 0, i32 1 |
| 434 | // CHECK: store <4 x i32> %1, <4 x i32>* [[T0]], align |
| 435 | // CHECK: ret void |
| 436 | // CHECK-LABEL: define void @test_int8() |
| 437 | // CHECK: [[TMP1:%.*]] = alloca [[REC]], align |
| 438 | // CHECK: [[TMP2:%.*]] = alloca [[REC]], align |
| 439 | // CHECK: [[CALL:%.*]] = call [[SWIFTCC]] [[UAGG]] @return_int8() |
| 440 | // CHECK: [[CAST_TMP:%.*]] = bitcast [[REC]]* [[TMP1]] to [[AGG]]* |
| 441 | // CHECK: [[T0:%.*]] = getelementptr inbounds [[AGG]], [[AGG]]* [[CAST_TMP]], i32 0, i32 0 |
| 442 | // CHECK: [[T1:%.*]] = extractvalue [[UAGG]] [[CALL]], 0 |
| 443 | // CHECK: store <4 x i32> [[T1]], <4 x i32>* [[T0]], align |
| 444 | // CHECK: [[T0:%.*]] = getelementptr inbounds [[AGG]], [[AGG]]* [[CAST_TMP]], i32 0, i32 1 |
| 445 | // CHECK: [[T1:%.*]] = extractvalue [[UAGG]] [[CALL]], 1 |
| 446 | // CHECK: store <4 x i32> [[T1]], <4 x i32>* [[T0]], align |
| 447 | // CHECK: [[V:%.*]] = load [[REC]], [[REC]]* [[TMP1]], align |
| 448 | // CHECK: store [[REC]] [[V]], [[REC]]* [[TMP2]], align |
| 449 | // CHECK: [[CAST_TMP:%.*]] = bitcast [[REC]]* [[TMP2]] to [[AGG]]* |
| 450 | // CHECK: [[T0:%.*]] = getelementptr inbounds [[AGG]], [[AGG]]* [[CAST_TMP]], i32 0, i32 0 |
| 451 | // CHECK: [[FIRST:%.*]] = load <4 x i32>, <4 x i32>* [[T0]], align |
| 452 | // CHECK: [[T0:%.*]] = getelementptr inbounds [[AGG]], [[AGG]]* [[CAST_TMP]], i32 0, i32 1 |
| 453 | // CHECK: [[SECOND:%.*]] = load <4 x i32>, <4 x i32>* [[T0]], align |
| 454 | // CHECK: call [[SWIFTCC]] void @take_int8(<4 x i32> [[FIRST]], <4 x i32> [[SECOND]]) |
| 455 | // CHECK: ret void |
| 456 | |
| 457 | TEST(int5) |
| 458 | // CHECK-LABEL: define {{.*}} @return_int5() |
| 459 | // CHECK: [[RET:%.*]] = alloca [[REC:<5 x i32>]], align 32 |
| 460 | // CHECK: [[VAR:%.*]] = alloca [[REC]], align |
| 461 | // CHECK: store |
| 462 | // CHECK: load |
| 463 | // CHECK: store |
| 464 | // CHECK: [[CAST_TMP:%.*]] = bitcast [[REC]]* [[RET]] to [[AGG:{ <4 x i32>, i32 }]]* |
| 465 | // CHECK: [[T0:%.*]] = getelementptr inbounds [[AGG]], [[AGG]]* [[CAST_TMP]], i32 0, i32 0 |
| 466 | // CHECK: [[FIRST:%.*]] = load <4 x i32>, <4 x i32>* [[T0]], align |
| 467 | // CHECK: [[T0:%.*]] = getelementptr inbounds [[AGG]], [[AGG]]* [[CAST_TMP]], i32 0, i32 1 |
| 468 | // CHECK: [[SECOND:%.*]] = load i32, i32* [[T0]], align |
| 469 | // CHECK: [[T0:%.*]] = insertvalue [[UAGG:{ <4 x i32>, i32 }]] undef, <4 x i32> [[FIRST]], 0 |
| 470 | // CHECK: [[T1:%.*]] = insertvalue [[UAGG]] [[T0]], i32 [[SECOND]], 1 |
| 471 | // CHECK: ret [[UAGG]] [[T1]] |
| 472 | // CHECK-LABEL: define {{.*}} @take_int5(<4 x i32>, i32) |
| 473 | // CHECK: [[V:%.*]] = alloca [[REC]], align |
| 474 | // CHECK: [[CAST_TMP:%.*]] = bitcast [[REC]]* [[V]] to [[AGG]]* |
| 475 | // CHECK: [[T0:%.*]] = getelementptr inbounds [[AGG]], [[AGG]]* [[CAST_TMP]], i32 0, i32 0 |
| 476 | // CHECK: store <4 x i32> %0, <4 x i32>* [[T0]], align |
| 477 | // CHECK: [[T0:%.*]] = getelementptr inbounds [[AGG]], [[AGG]]* [[CAST_TMP]], i32 0, i32 1 |
| 478 | // CHECK: store i32 %1, i32* [[T0]], align |
| 479 | // CHECK: ret void |
| 480 | // CHECK-LABEL: define void @test_int5() |
| 481 | // CHECK: [[TMP1:%.*]] = alloca [[REC]], align |
| 482 | // CHECK: [[TMP2:%.*]] = alloca [[REC]], align |
| 483 | // CHECK: [[CALL:%.*]] = call [[SWIFTCC]] [[UAGG]] @return_int5() |
| 484 | // CHECK: [[CAST_TMP:%.*]] = bitcast [[REC]]* [[TMP1]] to [[AGG]]* |
| 485 | // CHECK: [[T0:%.*]] = getelementptr inbounds [[AGG]], [[AGG]]* [[CAST_TMP]], i32 0, i32 0 |
| 486 | // CHECK: [[T1:%.*]] = extractvalue [[UAGG]] [[CALL]], 0 |
| 487 | // CHECK: store <4 x i32> [[T1]], <4 x i32>* [[T0]], align |
| 488 | // CHECK: [[T0:%.*]] = getelementptr inbounds [[AGG]], [[AGG]]* [[CAST_TMP]], i32 0, i32 1 |
| 489 | // CHECK: [[T1:%.*]] = extractvalue [[UAGG]] [[CALL]], 1 |
| 490 | // CHECK: store i32 [[T1]], i32* [[T0]], align |
| 491 | // CHECK: [[V:%.*]] = load [[REC]], [[REC]]* [[TMP1]], align |
| 492 | // CHECK: store [[REC]] [[V]], [[REC]]* [[TMP2]], align |
| 493 | // CHECK: [[CAST_TMP:%.*]] = bitcast [[REC]]* [[TMP2]] to [[AGG]]* |
| 494 | // CHECK: [[T0:%.*]] = getelementptr inbounds [[AGG]], [[AGG]]* [[CAST_TMP]], i32 0, i32 0 |
| 495 | // CHECK: [[FIRST:%.*]] = load <4 x i32>, <4 x i32>* [[T0]], align |
| 496 | // CHECK: [[T0:%.*]] = getelementptr inbounds [[AGG]], [[AGG]]* [[CAST_TMP]], i32 0, i32 1 |
| 497 | // CHECK: [[SECOND:%.*]] = load i32, i32* [[T0]], align |
| 498 | // CHECK: call [[SWIFTCC]] void @take_int5(<4 x i32> [[FIRST]], i32 [[SECOND]]) |
| 499 | // CHECK: ret void |
John McCall | 8cde42c | 2016-04-04 20:39:50 +0000 | [diff] [blame] | 500 | |
| 501 | typedef struct { |
| 502 | int x; |
| 503 | int3 v __attribute__((packed)); |
| 504 | } misaligned_int3; |
| 505 | TEST(misaligned_int3) |
| 506 | // CHECK-LABEL: define {{.*}} @take_misaligned_int3(i32, i32, i32, i32) |
Arnold Schwaighofer | b715eb4 | 2016-10-14 21:55:56 +0000 | [diff] [blame] | 507 | |
| 508 | typedef struct { |
| 509 | float f0; |
| 510 | } struct_f1; |
| 511 | TEST(struct_f1) |
| 512 | // CHECK-LABEL: define swiftcc float @return_struct_f1() |
| 513 | // CHECK-LABEL: define swiftcc void @take_struct_f1(float) |
| 514 | |
| 515 | typedef struct { |
| 516 | float f0; |
| 517 | float f1; |
| 518 | } struct_f2; |
| 519 | TEST(struct_f2) |
| 520 | // CHECK-LABEL: define swiftcc { float, float } @return_struct_f2() |
| 521 | // CHECK-LABEL: define swiftcc void @take_struct_f2(float, float) |
| 522 | |
| 523 | typedef struct { |
| 524 | float f0; |
| 525 | float f1; |
| 526 | float f2; |
| 527 | } struct_f3; |
| 528 | TEST(struct_f3) |
| 529 | // CHECK-LABEL: define swiftcc { float, float, float } @return_struct_f3() |
| 530 | // CHECK-LABEL: define swiftcc void @take_struct_f3(float, float, float) |
| 531 | |
| 532 | typedef struct { |
| 533 | float f0; |
| 534 | float f1; |
| 535 | float f2; |
| 536 | float f3; |
| 537 | } struct_f4; |
| 538 | TEST(struct_f4) |
| 539 | // CHECK-LABEL: define swiftcc { float, float, float, float } @return_struct_f4() |
| 540 | // CHECK-LABEL: define swiftcc void @take_struct_f4(float, float, float, float) |
| 541 | |
| 542 | |
| 543 | typedef struct { |
| 544 | double d0; |
| 545 | } struct_d1; |
| 546 | TEST(struct_d1) |
| 547 | // CHECK-LABEL: define swiftcc double @return_struct_d1() |
| 548 | // CHECK-LABEL: define swiftcc void @take_struct_d1(double) |
| 549 | |
| 550 | typedef struct { |
| 551 | double d0; |
| 552 | double d1; |
| 553 | } struct_d2; |
| 554 | TEST(struct_d2) |
| 555 | // CHECK-LABEL: define swiftcc { double, double } @return_struct_d2() |
| 556 | // CHECK-LABEL: define swiftcc void @take_struct_d2(double, double) |
| 557 | |
| 558 | typedef struct { |
| 559 | double d0; |
| 560 | double d1; |
| 561 | double d2; |
| 562 | } struct_d3; |
| 563 | TEST(struct_d3) |
| 564 | // CHECK-LABEL: define swiftcc { double, double, double } @return_struct_d3() |
| 565 | // CHECK-LABEL: define swiftcc void @take_struct_d3(double, double, double) |
| 566 | |
| 567 | typedef struct { |
| 568 | double d0; |
| 569 | double d1; |
| 570 | double d2; |
| 571 | double d3; |
| 572 | } struct_d4; |
| 573 | TEST(struct_d4) |
| 574 | // CHECK-LABEL: define swiftcc { double, double, double, double } @return_struct_d4() |
| 575 | // CHECK-LABEL: define swiftcc void @take_struct_d4(double, double, double, double) |
| 576 | |
| 577 | typedef struct { |
| 578 | double d0; |
| 579 | double d1; |
| 580 | double d2; |
| 581 | double d3; |
| 582 | double d4; |
| 583 | } struct_d5; |
| 584 | TEST(struct_d5) |
| 585 | // CHECK: define swiftcc void @return_struct_d5([[STRUCT5:%.*]]* noalias sret |
| 586 | // CHECK: define swiftcc void @take_struct_d5([[STRUCT5]] |
| 587 | |
| 588 | typedef struct { |
| 589 | char c0; |
| 590 | } struct_c1; |
| 591 | TEST(struct_c1) |
| 592 | // CHECK-LABEL: define swiftcc i8 @return_struct_c1() |
| 593 | // CHECK-LABEL: define swiftcc void @take_struct_c1(i8) |
| 594 | |
| 595 | typedef struct { |
| 596 | char c0; |
| 597 | char c1; |
| 598 | } struct_c2; |
| 599 | TEST(struct_c2) |
| 600 | // CHECK-LABEL: define swiftcc i16 @return_struct_c2() |
| 601 | // CHECK-LABEL: define swiftcc void @take_struct_c2(i16) |
| 602 | // |
| 603 | |
| 604 | typedef struct { |
| 605 | char c0; |
| 606 | char c1; |
| 607 | char c2; |
| 608 | } struct_c3; |
| 609 | TEST(struct_c3) |
| 610 | // CHECK-LABEL: define swiftcc i32 @return_struct_c3() |
| 611 | // CHECK-LABEL: define swiftcc void @take_struct_c3(i32) |
| 612 | |
| 613 | typedef struct { |
| 614 | char c0; |
| 615 | char c1; |
| 616 | char c2; |
| 617 | char c3; |
| 618 | } struct_c4; |
| 619 | TEST(struct_c4) |
| 620 | // CHECK-LABEL: define swiftcc i32 @return_struct_c4() |
| 621 | // CHECK-LABEL: define swiftcc void @take_struct_c4(i32) |
| 622 | |
| 623 | typedef struct { |
| 624 | char c0; |
| 625 | char c1; |
| 626 | char c2; |
| 627 | char c3; |
| 628 | char c4; |
| 629 | } struct_c5; |
| 630 | TEST(struct_c5) |
| 631 | // CHECK-LABEL: define swiftcc { i32, i8 } @return_struct_c5() |
| 632 | // CHECK-LABEL: define swiftcc void @take_struct_c5(i32, i8) |
| 633 | |
| 634 | typedef struct { |
| 635 | short s0; |
| 636 | } struct_s1; |
| 637 | TEST(struct_s1) |
| 638 | // CHECK-LABEL: define swiftcc i16 @return_struct_s1() |
| 639 | // CHECK-LABEL: define swiftcc void @take_struct_s1(i16) |
| 640 | |
| 641 | typedef struct { |
| 642 | short s0; |
| 643 | short s1; |
| 644 | } struct_s2; |
| 645 | TEST(struct_s2) |
| 646 | // CHECK-LABEL: define swiftcc i32 @return_struct_s2() |
| 647 | // CHECK-LABEL: define swiftcc void @take_struct_s2(i32) |
| 648 | |
| 649 | typedef struct { |
| 650 | short s0; |
| 651 | short s1; |
| 652 | short s2; |
| 653 | } struct_s3; |
| 654 | TEST(struct_s3) |
| 655 | // CHECK-LABEL: define swiftcc { i32, i16 } @return_struct_s3() |
| 656 | // CHECK-LABEL: define swiftcc void @take_struct_s3(i32, i16) |
| 657 | |
| 658 | typedef struct { |
| 659 | short s0; |
| 660 | short s1; |
| 661 | short s2; |
| 662 | short s3; |
| 663 | } struct_s4; |
| 664 | TEST(struct_s4) |
| 665 | // CHECK-LABEL: define swiftcc { i32, i32 } @return_struct_s4() |
| 666 | // CHECK-LABEL: define swiftcc void @take_struct_s4(i32, i32) |
| 667 | |
| 668 | typedef struct { |
| 669 | short s0; |
| 670 | short s1; |
| 671 | short s2; |
| 672 | short s3; |
| 673 | short s4; |
| 674 | } struct_s5; |
| 675 | TEST(struct_s5) |
| 676 | // CHECK-LABEL: define swiftcc { i32, i32, i16 } @return_struct_s5() |
| 677 | // CHECK-LABEL: define swiftcc void @take_struct_s5(i32, i32, i16) |
| 678 | |
| 679 | |
| 680 | typedef struct { |
| 681 | int i0; |
| 682 | } struct_i1; |
| 683 | TEST(struct_i1) |
| 684 | // CHECK-LABEL: define swiftcc i32 @return_struct_i1() |
| 685 | // CHECK-LABEL: define swiftcc void @take_struct_i1(i32) |
| 686 | |
| 687 | typedef struct { |
| 688 | int i0; |
| 689 | int i1; |
| 690 | } struct_i2; |
| 691 | TEST(struct_i2) |
| 692 | // CHECK-LABEL: define swiftcc { i32, i32 } @return_struct_i2() |
| 693 | // CHECK-LABEL: define swiftcc void @take_struct_i2(i32, i32) |
| 694 | |
| 695 | typedef struct { |
| 696 | int i0; |
| 697 | int i1; |
| 698 | int i2; |
| 699 | } struct_i3; |
| 700 | TEST(struct_i3) |
| 701 | // CHECK-LABEL: define swiftcc { i32, i32, i32 } @return_struct_i3() |
| 702 | // CHECK-LABEL: define swiftcc void @take_struct_i3(i32, i32, i32) |
| 703 | |
| 704 | typedef struct { |
| 705 | int i0; |
| 706 | int i1; |
| 707 | int i2; |
| 708 | int i3; |
| 709 | } struct_i4; |
| 710 | TEST(struct_i4) |
| 711 | // CHECK-LABEL: define swiftcc { i32, i32, i32, i32 } @return_struct_i4() |
| 712 | // CHECK-LABEL: define swiftcc void @take_struct_i4(i32, i32, i32, i32) |
| 713 | |
| 714 | typedef struct { |
| 715 | long long l0; |
| 716 | } struct_l1; |
| 717 | TEST(struct_l1) |
| 718 | // CHECK-LABEL: define swiftcc i64 @return_struct_l1() |
| 719 | // CHECK-LABEL: define swiftcc void @take_struct_l1(i64) |
| 720 | |
| 721 | typedef struct { |
| 722 | long long l0; |
| 723 | long long l1; |
| 724 | } struct_l2; |
| 725 | TEST(struct_l2) |
| 726 | // CHECK-LABEL: define swiftcc { i64, i64 } @return_struct_l2() |
| 727 | // CHECK-LABEL: define swiftcc void @take_struct_l2(i64, i64) |
| 728 | |
| 729 | typedef struct { |
| 730 | long long l0; |
| 731 | long long l1; |
| 732 | long long l2; |
| 733 | } struct_l3; |
| 734 | TEST(struct_l3) |
| 735 | // CHECK: define swiftcc void @return_struct_l3([[STRUCT:%.*]]* noalias sret |
| 736 | // CHECK: define swiftcc void @take_struct_l3([[STRUCT]] |
| 737 | |
| 738 | typedef struct { |
| 739 | long long l0; |
| 740 | long long l1; |
| 741 | long long l2; |
| 742 | long long l3; |
| 743 | } struct_l4; |
| 744 | TEST(struct_l4) |
| 745 | // CHECK: define swiftcc void @return_struct_l4([[STRUCT:%.*]]* noalias sret |
| 746 | // CHECK: define swiftcc void @take_struct_l4([[STRUCT]] |
| 747 | |
| 748 | typedef struct { |
| 749 | long long l0; |
| 750 | long long l1; |
| 751 | long long l2; |
| 752 | long long l3; |
| 753 | long long l4; |
| 754 | } struct_l5; |
| 755 | TEST(struct_l5) |
| 756 | // CHECK: define swiftcc void @return_struct_l5([[STRUCT5:%.*]]* noalias sret |
| 757 | // CHECK: define swiftcc void @take_struct_l5([[STRUCT5]]* |
| 758 | |
| 759 | typedef struct { |
| 760 | char16 c0; |
| 761 | } struct_vc1; |
| 762 | TEST(struct_vc1) |
| 763 | // CHECK-LABEL: define swiftcc <16 x i8> @return_struct_vc1() |
| 764 | // CHECK-LABEL: define swiftcc void @take_struct_vc1(<16 x i8>) |
| 765 | |
| 766 | typedef struct { |
| 767 | char16 c0; |
| 768 | char16 c1; |
| 769 | } struct_vc2; |
| 770 | TEST(struct_vc2) |
| 771 | // CHECK-LABEL: define swiftcc { <16 x i8>, <16 x i8> } @return_struct_vc2() |
| 772 | // CHECK-LABEL: define swiftcc void @take_struct_vc2(<16 x i8>, <16 x i8>) |
| 773 | |
| 774 | typedef struct { |
| 775 | char16 c0; |
| 776 | char16 c1; |
| 777 | char16 c2; |
| 778 | } struct_vc3; |
| 779 | TEST(struct_vc3) |
| 780 | // CHECK-LABEL: define swiftcc { <16 x i8>, <16 x i8>, <16 x i8> } @return_struct_vc3() |
| 781 | // CHECK-LABEL: define swiftcc void @take_struct_vc3(<16 x i8>, <16 x i8>, <16 x i8>) |
| 782 | |
| 783 | typedef struct { |
| 784 | char16 c0; |
| 785 | char16 c1; |
| 786 | char16 c2; |
| 787 | char16 c3; |
| 788 | } struct_vc4; |
| 789 | TEST(struct_vc4) |
| 790 | // CHECK-LABEL: define swiftcc { <16 x i8>, <16 x i8>, <16 x i8>, <16 x i8> } @return_struct_vc4() |
| 791 | // CHECK-LABEL: define swiftcc void @take_struct_vc4(<16 x i8>, <16 x i8>, <16 x i8>, <16 x i8>) |
| 792 | |
| 793 | typedef struct { |
| 794 | char16 c0; |
| 795 | char16 c1; |
| 796 | char16 c2; |
| 797 | char16 c3; |
| 798 | char16 c4; |
| 799 | } struct_vc5; |
| 800 | TEST(struct_vc5) |
| 801 | // CHECK: define swiftcc void @return_struct_vc5([[STRUCT:%.*]]* noalias sret |
| 802 | // CHECK: define swiftcc void @take_struct_vc5([[STRUCT]] |
| 803 | |
| 804 | typedef struct { |
| 805 | short8 c0; |
| 806 | } struct_vs1; |
| 807 | TEST(struct_vs1) |
| 808 | // CHECK-LABEL: define swiftcc <8 x i16> @return_struct_vs1() |
| 809 | // CHECK-LABEL: define swiftcc void @take_struct_vs1(<8 x i16>) |
| 810 | |
| 811 | typedef struct { |
| 812 | short8 c0; |
| 813 | short8 c1; |
| 814 | } struct_vs2; |
| 815 | TEST(struct_vs2) |
| 816 | // CHECK-LABEL: define swiftcc { <8 x i16>, <8 x i16> } @return_struct_vs2() |
| 817 | // CHECK-LABEL: define swiftcc void @take_struct_vs2(<8 x i16>, <8 x i16>) |
| 818 | |
| 819 | typedef struct { |
| 820 | short8 c0; |
| 821 | short8 c1; |
| 822 | short8 c2; |
| 823 | } struct_vs3; |
| 824 | TEST(struct_vs3) |
| 825 | // CHECK-LABEL: define swiftcc { <8 x i16>, <8 x i16>, <8 x i16> } @return_struct_vs3() |
| 826 | // CHECK-LABEL: define swiftcc void @take_struct_vs3(<8 x i16>, <8 x i16>, <8 x i16>) |
| 827 | |
| 828 | typedef struct { |
| 829 | short8 c0; |
| 830 | short8 c1; |
| 831 | short8 c2; |
| 832 | short8 c3; |
| 833 | } struct_vs4; |
| 834 | TEST(struct_vs4) |
| 835 | // CHECK-LABEL: define swiftcc { <8 x i16>, <8 x i16>, <8 x i16>, <8 x i16> } @return_struct_vs4() |
| 836 | // CHECK-LABEL: define swiftcc void @take_struct_vs4(<8 x i16>, <8 x i16>, <8 x i16>, <8 x i16>) |
| 837 | |
| 838 | typedef struct { |
| 839 | short8 c0; |
| 840 | short8 c1; |
| 841 | short8 c2; |
| 842 | short8 c3; |
| 843 | short8 c4; |
| 844 | } struct_vs5; |
| 845 | TEST(struct_vs5) |
| 846 | // CHECK: define swiftcc void @return_struct_vs5([[STRUCT:%.*]]* noalias sret |
| 847 | // CHECK: define swiftcc void @take_struct_vs5([[STRUCT]] |
| 848 | |
| 849 | typedef struct { |
| 850 | int4 c0; |
| 851 | } struct_vi1; |
| 852 | TEST(struct_vi1) |
| 853 | // CHECK-LABEL: define swiftcc <4 x i32> @return_struct_vi1() |
| 854 | // CHECK-LABEL: define swiftcc void @take_struct_vi1(<4 x i32>) |
| 855 | |
| 856 | typedef struct { |
| 857 | int4 c0; |
| 858 | int4 c1; |
| 859 | } struct_vi2; |
| 860 | TEST(struct_vi2) |
| 861 | // CHECK-LABEL: define swiftcc { <4 x i32>, <4 x i32> } @return_struct_vi2() |
| 862 | // CHECK-LABEL: define swiftcc void @take_struct_vi2(<4 x i32>, <4 x i32>) |
| 863 | |
| 864 | typedef struct { |
| 865 | int4 c0; |
| 866 | int4 c1; |
| 867 | int4 c2; |
| 868 | } struct_vi3; |
| 869 | TEST(struct_vi3) |
| 870 | // CHECK-LABEL: define swiftcc { <4 x i32>, <4 x i32>, <4 x i32> } @return_struct_vi3() |
| 871 | // CHECK-LABEL: define swiftcc void @take_struct_vi3(<4 x i32>, <4 x i32>, <4 x i32>) |
| 872 | |
| 873 | typedef struct { |
| 874 | int4 c0; |
| 875 | int4 c1; |
| 876 | int4 c2; |
| 877 | int4 c3; |
| 878 | } struct_vi4; |
| 879 | TEST(struct_vi4) |
| 880 | // CHECK-LABEL: define swiftcc { <4 x i32>, <4 x i32>, <4 x i32>, <4 x i32> } @return_struct_vi4() |
| 881 | // CHECK-LABEL: define swiftcc void @take_struct_vi4(<4 x i32>, <4 x i32>, <4 x i32>, <4 x i32>) |
| 882 | |
| 883 | typedef struct { |
| 884 | int4 c0; |
| 885 | int4 c1; |
| 886 | int4 c2; |
| 887 | int4 c3; |
| 888 | int4 c4; |
| 889 | } struct_vi5; |
| 890 | TEST(struct_vi5) |
| 891 | // CHECK: define swiftcc void @return_struct_vi5([[STRUCT:%.*]]* noalias sret |
| 892 | // CHECK: define swiftcc void @take_struct_vi5([[STRUCT]] |
| 893 | |
| 894 | typedef struct { |
| 895 | long2 c0; |
| 896 | } struct_vl1; |
| 897 | TEST(struct_vl1) |
| 898 | // CHECK-LABEL: define swiftcc <2 x i64> @return_struct_vl1() |
| 899 | // CHECK-LABEL: define swiftcc void @take_struct_vl1(<2 x i64>) |
| 900 | |
| 901 | typedef struct { |
| 902 | long2 c0; |
| 903 | long2 c1; |
| 904 | long2 c2; |
| 905 | long2 c3; |
| 906 | } struct_vl4; |
| 907 | TEST(struct_vl4) |
| 908 | // CHECK-LABEL: define swiftcc { <2 x i64>, <2 x i64>, <2 x i64>, <2 x i64> } @return_struct_vl4() |
| 909 | // CHECK-LABEL: define swiftcc void @take_struct_vl4(<2 x i64>, <2 x i64>, <2 x i64>, <2 x i64>) |
| 910 | |
| 911 | typedef struct { |
| 912 | long2 c0; |
| 913 | long2 c1; |
| 914 | long2 c2; |
| 915 | long2 c3; |
| 916 | long2 c4; |
| 917 | } struct_vl5; |
| 918 | TEST(struct_vl5) |
| 919 | // CHECK: define swiftcc void @return_struct_vl5([[STRUCT:%.*]]* noalias sret |
| 920 | // CHECK: define swiftcc void @take_struct_vl5([[STRUCT]] |
| 921 | |
| 922 | typedef struct { |
| 923 | double2 c0; |
| 924 | } struct_vd1; |
| 925 | TEST(struct_vd1) |
| 926 | // CHECK-LABEL: define swiftcc <2 x double> @return_struct_vd1() |
| 927 | // CHECK-LABEL: define swiftcc void @take_struct_vd1(<2 x double>) |
| 928 | |
| 929 | typedef struct { |
| 930 | double2 c0; |
| 931 | double2 c1; |
| 932 | double2 c2; |
| 933 | double2 c3; |
| 934 | } struct_vd4; |
| 935 | TEST(struct_vd4) |
| 936 | // CHECK-LABEL: define swiftcc { <2 x double>, <2 x double>, <2 x double>, <2 x double> } @return_struct_vd4() |
| 937 | // CHECK-LABEL: define swiftcc void @take_struct_vd4(<2 x double>, <2 x double>, <2 x double>, <2 x double>) |
| 938 | |
| 939 | typedef struct { |
| 940 | double2 c0; |
| 941 | double2 c1; |
| 942 | double2 c2; |
| 943 | double2 c3; |
| 944 | double2 c4; |
| 945 | } struct_vd5; |
| 946 | TEST(struct_vd5) |
| 947 | // CHECK: define swiftcc void @return_struct_vd5([[STRUCT:%.*]]* noalias sret |
| 948 | // CHECK: define swiftcc void @take_struct_vd5([[STRUCT]] |
| 949 | |
| 950 | typedef struct { |
| 951 | double4 c0; |
| 952 | } struct_vd41; |
| 953 | TEST(struct_vd41) |
| 954 | // CHECK-LABEL: define swiftcc { <2 x double>, <2 x double> } @return_struct_vd41() |
| 955 | // CHECK-LABEL: define swiftcc void @take_struct_vd41(<2 x double>, <2 x double>) |
| 956 | |
| 957 | typedef struct { |
| 958 | double4 c0; |
| 959 | double4 c1; |
| 960 | } struct_vd42; |
| 961 | TEST(struct_vd42) |
| 962 | // CHECK-LABEL: define swiftcc { <2 x double>, <2 x double>, <2 x double>, <2 x double> } @return_struct_vd42() |
| 963 | // CHECK-LABEL: define swiftcc void @take_struct_vd42(<2 x double>, <2 x double>, <2 x double>, <2 x double>) |
| 964 | |
| 965 | typedef struct { |
| 966 | double4 c0; |
| 967 | double4 c1; |
| 968 | double4 c2; |
| 969 | } struct_vd43; |
| 970 | TEST(struct_vd43) |
| 971 | // CHECK: define swiftcc void @return_struct_vd43([[STRUCT:%.*]]* noalias sret |
| 972 | // CHECK: define swiftcc void @take_struct_vd43([[STRUCT]] |
| 973 | |
| 974 | typedef struct { |
| 975 | float4 c0; |
| 976 | } struct_vf1; |
| 977 | TEST(struct_vf1) |
| 978 | // CHECK-LABEL: define swiftcc <4 x float> @return_struct_vf1() |
| 979 | // CHECK-LABEL: define swiftcc void @take_struct_vf1(<4 x float>) |
| 980 | |
| 981 | typedef struct { |
| 982 | float4 c0; |
| 983 | float4 c1; |
| 984 | } struct_vf2; |
| 985 | TEST(struct_vf2) |
| 986 | // CHECK-LABEL: define swiftcc { <4 x float>, <4 x float> } @return_struct_vf2() |
| 987 | // CHECK-LABEL: define swiftcc void @take_struct_vf2(<4 x float>, <4 x float>) |
| 988 | |
| 989 | typedef struct { |
| 990 | float4 c0; |
| 991 | float4 c1; |
| 992 | float4 c2; |
| 993 | float4 c3; |
| 994 | } struct_vf4; |
| 995 | TEST(struct_vf4) |
| 996 | // CHECK-LABEL: define swiftcc { <4 x float>, <4 x float>, <4 x float>, <4 x float> } @return_struct_vf4() |
| 997 | // CHECK-LABEL: define swiftcc void @take_struct_vf4(<4 x float>, <4 x float>, <4 x float>, <4 x float>) |
| 998 | |
| 999 | typedef struct { |
| 1000 | float4 c0; |
| 1001 | float4 c1; |
| 1002 | float4 c2; |
| 1003 | float4 c3; |
| 1004 | float4 c4; |
| 1005 | } struct_vf5; |
| 1006 | TEST(struct_vf5) |
| 1007 | // CHECK: define swiftcc void @return_struct_vf5([[STRUCT:%.*]]* noalias sret |
| 1008 | // CHECK: define swiftcc void @take_struct_vf5([[STRUCT]] |
| 1009 | |
| 1010 | typedef struct { |
| 1011 | float8 c0; |
| 1012 | } struct_vf81; |
| 1013 | TEST(struct_vf81) |
| 1014 | // CHECK-LABEL: define swiftcc { <4 x float>, <4 x float> } @return_struct_vf81() |
| 1015 | // CHECK-LABEL: define swiftcc void @take_struct_vf81(<4 x float>, <4 x float>) |