425 lines · c
1// RUN: %clang_cc1 -triple x86_64-unknown-windows -emit-llvm -target-cpu core2 -o - %s | FileCheck %s2 3#define SWIFTCALL __attribute__((swiftcall))4#define OUT __attribute__((swift_indirect_result))5#define ERROR __attribute__((swift_error_result))6#define CONTEXT __attribute__((swift_context))7 8/*****************************************************************************/9/****************************** PARAMETER ABIS *******************************/10/*****************************************************************************/11 12SWIFTCALL void indirect_result_1(OUT int *arg0, OUT float *arg1) {}13// CHECK-LABEL: define {{.*}} void @indirect_result_1(ptr noalias noundef sret(ptr) align 4 dereferenceable(4){{.*}}, ptr noalias noundef align 4 dereferenceable(4){{.*}})14 15// TODO: maybe this shouldn't suppress sret.16SWIFTCALL int indirect_result_2(OUT int *arg0, OUT float *arg1) { __builtin_unreachable(); }17// CHECK-LABEL: define {{.*}} i32 @indirect_result_2(ptr noalias noundef align 4 dereferenceable(4){{.*}}, ptr noalias noundef align 4 dereferenceable(4){{.*}})18 19typedef struct { char array[1024]; } struct_reallybig;20SWIFTCALL struct_reallybig indirect_result_3(OUT int *arg0, OUT float *arg1) { __builtin_unreachable(); }21// CHECK-LABEL: define {{.*}} void @indirect_result_3(ptr dead_on_unwind noalias writable sret({{.*}}) {{.*}}, ptr noalias noundef align 4 dereferenceable(4){{.*}}, ptr noalias noundef align 4 dereferenceable(4){{.*}})22 23SWIFTCALL void context_1(CONTEXT void *self) {}24// CHECK-LABEL: define {{.*}} void @context_1(ptr noundef swiftself25 26SWIFTCALL void context_2(void *arg0, CONTEXT void *self) {}27// CHECK-LABEL: define {{.*}} void @context_2(ptr{{.*}}, ptr noundef swiftself28 29SWIFTCALL void context_error_1(CONTEXT int *self, ERROR float **error) {}30// CHECK-LABEL: define {{.*}} void @context_error_1(ptr noundef swiftself{{.*}}, ptr noundef swifterror %0)31// CHECK: [[TEMP:%.*]] = alloca ptr, align 832// CHECK: [[T0:%.*]] = load ptr, ptr [[ERRORARG:%.*]], align 833// CHECK: store ptr [[T0]], ptr [[TEMP]], align 834// CHECK: [[T0:%.*]] = load ptr, ptr [[TEMP]], align 835// CHECK: store ptr [[T0]], ptr [[ERRORARG]], align 836void test_context_error_1(void) {37 int x;38 float *error;39 context_error_1(&x, &error);40}41// CHECK-LABEL: define dso_local void @test_context_error_1()42// CHECK: [[X:%.*]] = alloca i32, align 443// CHECK: [[ERROR:%.*]] = alloca ptr, align 844// CHECK: [[TEMP:%.*]] = alloca swifterror ptr, align 845// CHECK: [[T0:%.*]] = load ptr, ptr [[ERROR]], align 846// CHECK: store ptr [[T0]], ptr [[TEMP]], align 847// CHECK: call [[SWIFTCC:swiftcc]] void @context_error_1(ptr noundef swiftself [[X]], ptr noundef swifterror [[TEMP]])48// CHECK: [[T0:%.*]] = load ptr, ptr [[TEMP]], align 849// CHECK: store ptr [[T0]], ptr [[ERROR]], align 850 51SWIFTCALL void context_error_2(short s, CONTEXT int *self, ERROR float **error) {}52// CHECK-LABEL: define {{.*}} void @context_error_2(i16{{.*}}, ptr noundef swiftself{{.*}}, ptr noundef swifterror %0)53 54/*****************************************************************************/55/********************************** LOWERING *********************************/56/*****************************************************************************/57 58typedef float float4 __attribute__((ext_vector_type(4)));59typedef float float8 __attribute__((ext_vector_type(8)));60typedef double double2 __attribute__((ext_vector_type(2)));61typedef double double4 __attribute__((ext_vector_type(4)));62typedef int int3 __attribute__((ext_vector_type(3)));63typedef int int4 __attribute__((ext_vector_type(4)));64typedef int int5 __attribute__((ext_vector_type(5)));65typedef int int8 __attribute__((ext_vector_type(8)));66 67#define TEST(TYPE) \68 SWIFTCALL TYPE return_##TYPE(void) { \69 TYPE result = {}; \70 return result; \71 } \72 SWIFTCALL void take_##TYPE(TYPE v) { \73 } \74 void test_##TYPE(void) { \75 take_##TYPE(return_##TYPE()); \76 }77 78/*****************************************************************************/79/*********************************** STRUCTS *********************************/80/*****************************************************************************/81 82typedef struct {83} struct_empty;84TEST(struct_empty);85// CHECK-LABEL: define {{.*}} @return_struct_empty()86// CHECK: ret void87// CHECK-LABEL: define {{.*}} @take_struct_empty()88// CHECK: ret void89 90typedef struct {91 int x;92 char c0;93 char c1;94 int f0;95 int f1;96} struct_1;97TEST(struct_1);98// CHECK-LABEL: define dso_local swiftcc { i64, i64 } @return_struct_1() {{.*}}{99// CHECK: [[RET:%.*]] = alloca [[STRUCT1:%.*]], align 4100// CHECK: call void @llvm.memset101// CHECK: [[GEP0:%.*]] = getelementptr inbounds nuw { i64, i64 }, ptr %retval, i32 0, i32 0102// CHECK: [[T0:%.*]] = load i64, ptr [[GEP0]], align 4103// CHECK: [[GEP1:%.*]] = getelementptr inbounds nuw { i64, i64 }, ptr %retval, i32 0, i32 1104// CHECK: [[T1:%.*]] = load i64, ptr [[GEP1]], align 4105// CHECK: [[R0:%.*]] = insertvalue { i64, i64 } poison, i64 [[T0]], 0106// CHECK: [[R1:%.*]] = insertvalue { i64, i64 } [[R0]], i64 [[T1]], 1107// CHECK: ret { i64, i64 } [[R1]]108// CHECK: }109// CHECK-LABEL: define dso_local swiftcc void @take_struct_1(i64 %0, i64 %1) {{.*}}{110// CHECK: [[V:%.*]] = alloca [[STRUCT1:%.*]], align 4111// CHECK: [[GEP0:%.*]] = getelementptr inbounds nuw { i64, i64 }, ptr [[V]], i32 0, i32 0112// CHECK: store i64 %0, ptr [[GEP0]], align 4113// CHECK: [[GEP1:%.*]] = getelementptr inbounds nuw { i64, i64 }, ptr [[V]], i32 0, i32 1114// CHECK: store i64 %1, ptr [[GEP1]], align 4115// CHECK: ret void116// CHECK: }117// CHECK-LABEL: define dso_local void @test_struct_1() {{.*}}{118// CHECK: [[AGG:%.*]] = alloca [[STRUCT1:%.*]], align 4119// CHECK: [[RET:%.*]] = call swiftcc { i64, i64 } @return_struct_1()120// CHECK: [[GEP0:%.*]] = getelementptr inbounds nuw { i64, i64 }, ptr [[AGG]], i32 0, i32 0121// CHECK: [[E0:%.*]] = extractvalue { i64, i64 } [[RET]], 0122// CHECK: store i64 [[E0]], ptr [[GEP0]], align 4123// CHECK: [[GEP1:%.*]] = getelementptr inbounds nuw { i64, i64 }, ptr [[AGG]], i32 0, i32 1124// CHECK: [[E1:%.*]] = extractvalue { i64, i64 } [[RET]], 1125// CHECK: store i64 [[E1]], ptr [[GEP1]], align 4126// CHECK: [[GEP2:%.*]] = getelementptr inbounds nuw { i64, i64 }, ptr [[AGG]], i32 0, i32 0127// CHECK: [[V0:%.*]] = load i64, ptr [[GEP2]], align 4128// CHECK: [[GEP3:%.*]] = getelementptr inbounds nuw { i64, i64 }, ptr [[AGG]], i32 0, i32 1129// CHECK: [[V1:%.*]] = load i64, ptr [[GEP3]], align 4130// CHECK: call swiftcc void @take_struct_1(i64 [[V0]], i64 [[V1]])131// CHECK: ret void132// CHECK: }133 134typedef struct {135 int x;136 char c0;137 __attribute__((aligned(2))) char c1;138 int f0;139 int f1;140} struct_2;141TEST(struct_2);142// CHECK-LABEL: define dso_local swiftcc { i64, i64 } @return_struct_2() {{.*}}{143// CHECK: [[RET:%.*]] = alloca [[STRUCT2:%.*]], align 4144// CHECK: call void @llvm.memset145// CHECK: [[GEP0:%.*]] = getelementptr inbounds nuw { i64, i64 }, ptr [[RET]], i32 0, i32 0146// CHECK: [[T0:%.*]] = load i64, ptr [[GEP0]], align 4147// CHECK: [[GEP1:%.*]] = getelementptr inbounds nuw { i64, i64 }, ptr [[RET]], i32 0, i32 1148// CHECK: [[T1:%.*]] = load i64, ptr [[GEP1]], align 4149// CHECK: [[R0:%.*]] = insertvalue { i64, i64 } poison, i64 [[T0]], 0150// CHECK: [[R1:%.*]] = insertvalue { i64, i64 } [[R0]], i64 [[T1]], 1151// CHECK: ret { i64, i64 } [[R1]]152// CHECK: }153// CHECK-LABEL: define dso_local swiftcc void @take_struct_2(i64 %0, i64 %1) {{.*}}{154// CHECK: [[V:%.*]] = alloca [[STRUCT2]], align 4155// CHECK: [[GEP0:%.*]] = getelementptr inbounds nuw { i64, i64 }, ptr [[V]], i32 0, i32 0156// CHECK: store i64 %0, ptr [[GEP0]], align 4157// CHECK: [[GEP1:%.*]] = getelementptr inbounds nuw { i64, i64 }, ptr [[V]], i32 0, i32 1158// CHECK: store i64 %1, ptr [[GEP1]], align 4159// CHECK: ret void160// CHECK: }161// CHECK-LABEL: define dso_local void @test_struct_2() {{.*}} {162// CHECK: [[TMP:%.*]] = alloca [[STRUCT2]], align 4163// CHECK: [[CALL:%.*]] = call swiftcc { i64, i64 } @return_struct_2()164// CHECK: [[GEP:%.*]] = getelementptr inbounds nuw {{.*}} [[TMP]], i32 0, i32 0165// CHECK: [[T0:%.*]] = extractvalue { i64, i64 } [[CALL]], 0166// CHECK: store i64 [[T0]], ptr [[GEP]], align 4167// CHECK: [[GEP:%.*]] = getelementptr inbounds nuw {{.*}} [[TMP]], i32 0, i32 1168// CHECK: [[T0:%.*]] = extractvalue { i64, i64 } [[CALL]], 1169// CHECK: store i64 [[T0]], ptr [[GEP]], align 4170// CHECK: [[GEP:%.*]] = getelementptr inbounds nuw { i64, i64 }, ptr [[TMP]], i32 0, i32 0171// CHECK: [[R0:%.*]] = load i64, ptr [[GEP]], align 4172// CHECK: [[GEP:%.*]] = getelementptr inbounds nuw { i64, i64 }, ptr [[TMP]], i32 0, i32 1173// CHECK: [[R1:%.*]] = load i64, ptr [[GEP]], align 4174// CHECK: call swiftcc void @take_struct_2(i64 [[R0]], i64 [[R1]])175// CHECK: ret void176// CHECK: }177 178// There's no way to put a field randomly in the middle of an otherwise179// empty storage unit in C, so that case has to be tested in C++, which180// can use empty structs to introduce arbitrary padding. (In C, they end up181// with size 0 and so don't affect layout.)182 183// Misaligned data rule.184typedef struct {185 char c0;186 __attribute__((packed)) float f;187} struct_misaligned_1;188TEST(struct_misaligned_1)189// CHECK-LABEL: define dso_local swiftcc i64 @return_struct_misaligned_1()190// CHECK: [[RET:%.*]] = alloca [[STRUCT:%.*]], align 1191// CHECK: call void @llvm.memset{{.*}}(ptr align 1 [[RET]], i8 0, i64 5192// CHECK: [[GEP:%.*]] = getelementptr inbounds nuw { i64 }, ptr [[RET]], i32 0, i32 0193// CHECK: [[R0:%.*]] = load i64, ptr [[GEP]], align 1194// CHECK: ret i64 [[R0]]195// CHECK:}196// CHECK-LABEL: define dso_local swiftcc void @take_struct_misaligned_1(i64 %0) {{.*}}{197// CHECK: [[V:%.*]] = alloca [[STRUCT:%.*]], align 1198// CHECK: [[GEP:%.*]] = getelementptr inbounds nuw { i64 }, ptr [[V]], i32 0, i32 0199// CHECK: store i64 %0, ptr [[GEP]], align 1200// CHECK: ret void201// CHECK: }202// CHECK: define dso_local void @test_struct_misaligned_1() {{.*}}{203// CHECK: [[AGG:%.*]] = alloca [[STRUCT:%.*]], align 1204// CHECK: [[CALL:%.*]] = call swiftcc i64 @return_struct_misaligned_1()205// CHECK: [[T1:%.*]] = getelementptr inbounds nuw { i64 }, ptr [[AGG]], i32 0, i32 0206// CHECK: store i64 [[CALL]], ptr [[T1]], align 1207// CHECK: [[T1:%.*]] = getelementptr inbounds nuw { i64 }, ptr [[AGG]], i32 0, i32 0208// CHECK: [[P:%.*]] = load i64, ptr [[T1]], align 1209// CHECK: call swiftcc void @take_struct_misaligned_1(i64 [[P]])210// CHECK: ret void211// CHECK: }212 213// Too many scalars.214typedef struct {215 long long x[5];216} struct_big_1;217TEST(struct_big_1)218 219// CHECK-LABEL: define {{.*}} void @return_struct_big_1({{.*}} dead_on_unwind noalias writable sret220 221// Should not be byval.222// CHECK-LABEL: define {{.*}} void @take_struct_big_1(ptr dead_on_return noundef{{( %.*)?}})223 224/*****************************************************************************/225/********************************* TYPE MERGING ******************************/226/*****************************************************************************/227 228typedef union {229 float f;230 double d;231} union_het_fp;232TEST(union_het_fp)233// CHECK-LABEL: define dso_local swiftcc i64 @return_union_het_fp()234// CHECK: [[RET:%.*]] = alloca [[UNION:%.*]], align 8235// CHECK: call void @llvm.memset{{.*}}(ptr align {{[0-9]+}} [[RET]]236// CHECK: [[GEP:%.*]] = getelementptr inbounds nuw { i64 }, ptr [[RET]], i32 0, i32 0237// CHECK: [[R0:%.*]] = load i64, ptr [[GEP]], align 8238// CHECK: ret i64 [[R0]]239// CHECK-LABEL: define dso_local swiftcc void @take_union_het_fp(i64 %0) {{.*}}{240// CHECK: [[V:%.*]] = alloca [[UNION:%.*]], align 8241// CHECK: [[GEP:%.*]] = getelementptr inbounds nuw { i64 }, ptr [[V]], i32 0, i32 0242// CHECK: store i64 %0, ptr [[GEP]], align 8243// CHECK: ret void244// CHECK: }245// CHECK-LABEL: define dso_local void @test_union_het_fp() {{.*}}{246// CHECK: [[AGG:%.*]] = alloca [[UNION:%.*]], align 8247// CHECK: [[CALL:%.*]] = call swiftcc i64 @return_union_het_fp()248// CHECK: [[T1:%.*]] = getelementptr inbounds nuw { i64 }, ptr [[AGG]], i32 0, i32 0249// CHECK: store i64 [[CALL]], ptr [[T1]], align 8250// CHECK: [[T1:%.*]] = getelementptr inbounds nuw { i64 }, ptr [[AGG]], i32 0, i32 0251// CHECK: [[V0:%.*]] = load i64, ptr [[T1]], align 8252// CHECK: call swiftcc void @take_union_het_fp(i64 [[V0]])253// CHECK: ret void254// CHECK: }255 256 257typedef union {258 float f1;259 float f2;260} union_hom_fp;261TEST(union_hom_fp)262// CHECK-LABEL: define dso_local void @test_union_hom_fp()263// CHECK: [[TMP:%.*]] = alloca [[REC:%.*]], align 4264// CHECK: [[CALL:%.*]] = call [[SWIFTCC]] float @return_union_hom_fp()265// CHECK: [[T0:%.*]] = getelementptr inbounds nuw [[AGG:{ float }]], ptr [[TMP]], i32 0, i32 0266// CHECK: store float [[CALL]], ptr [[T0]], align 4267// CHECK: [[T0:%.*]] = getelementptr inbounds nuw [[AGG]], ptr [[TMP]], i32 0, i32 0268// CHECK: [[FIRST:%.*]] = load float, ptr [[T0]], align 4269// CHECK: call [[SWIFTCC]] void @take_union_hom_fp(float [[FIRST]])270// CHECK: ret void271 272typedef union {273 float f1;274 float4 fv2;275} union_hom_fp_partial;276TEST(union_hom_fp_partial)277// CHECK: define dso_local void @test_union_hom_fp_partial()278// CHECK: [[AGG:%.*]] = alloca [[UNION:%.*]], align 16279// CHECK: [[CALL:%.*]] = call swiftcc { float, float, float, float } @return_union_hom_fp_partial()280// CHECK: [[T0:%.*]] = getelementptr inbounds nuw { float, float, float, float }, ptr [[AGG]], i32 0, i32 0281// CHECK: [[T1:%.*]] = extractvalue { float, float, float, float } [[CALL]], 0282// CHECK: store float [[T1]], ptr [[T0]], align 16283// CHECK: [[T0:%.*]] = getelementptr inbounds nuw { float, float, float, float }, ptr [[AGG]], i32 0, i32 1284// CHECK: [[T1:%.*]] = extractvalue { float, float, float, float } [[CALL]], 1285// CHECK: store float [[T1]], ptr [[T0]], align 4286// CHECK: [[T0:%.*]] = getelementptr inbounds nuw { float, float, float, float }, ptr [[AGG]], i32 0, i32 2287// CHECK: [[T1:%.*]] = extractvalue { float, float, float, float } [[CALL]], 2288// CHECK: store float [[T1]], ptr [[T0]], align 8289// CHECK: [[T0:%.*]] = getelementptr inbounds nuw { float, float, float, float }, ptr [[AGG]], i32 0, i32 3290// CHECK: [[T1:%.*]] = extractvalue { float, float, float, float } [[CALL]], 3291// CHECK: store float [[T1]], ptr [[T0]], align 4292// CHECK: [[T0:%.*]] = getelementptr inbounds nuw { float, float, float, float }, ptr [[AGG]], i32 0, i32 0293// CHECK: [[V0:%.*]] = load float, ptr [[T0]], align 16294// CHECK: [[T0:%.*]] = getelementptr inbounds nuw { float, float, float, float }, ptr [[AGG]], i32 0, i32 1295// CHECK: [[V1:%.*]] = load float, ptr [[T0]], align 4296// CHECK: [[T0:%.*]] = getelementptr inbounds nuw { float, float, float, float }, ptr [[AGG]], i32 0, i32 2297// CHECK: [[V2:%.*]] = load float, ptr [[T0]], align 8298// CHECK: [[T0:%.*]] = getelementptr inbounds nuw { float, float, float, float }, ptr [[AGG]], i32 0, i32 3299// CHECK: [[V3:%.*]] = load float, ptr [[T0]], align 4300// CHECK: call swiftcc void @take_union_hom_fp_partial(float [[V0]], float [[V1]], float [[V2]], float [[V3]])301// CHECK: ret void302// CHECK: }303 304typedef union {305 struct { int x, y; } f1;306 float4 fv2;307} union_het_fpv_partial;308TEST(union_het_fpv_partial)309// CHECK-LABEL: define dso_local void @test_union_het_fpv_partial()310// CHECK: [[AGG:%.*]] = alloca [[UNION:%.*]], align 16311// CHECK: [[CALL:%.*]] = call swiftcc { i64, float, float } @return_union_het_fpv_partial()312// CHECK: [[T0:%.*]] = getelementptr inbounds nuw { i64, float, float }, ptr [[AGG]], i32 0, i32 0313// CHECK: [[T1:%.*]] = extractvalue { i64, float, float } [[CALL]], 0314// CHECK: store i64 [[T1]], ptr [[T0]], align 16315// CHECK: [[T0:%.*]] = getelementptr inbounds nuw { i64, float, float }, ptr [[AGG]], i32 0, i32 1316// CHECK: [[T1:%.*]] = extractvalue { i64, float, float } [[CALL]], 1317// CHECK: store float [[T1]], ptr [[T0]], align 8318// CHECK: [[T0:%.*]] = getelementptr inbounds nuw { i64, float, float }, ptr [[AGG]], i32 0, i32 2319// CHECK: [[T1:%.*]] = extractvalue { i64, float, float } [[CALL]], 2320// CHECK: store float [[T1]], ptr [[T0]], align 4321// CHECK: [[T0:%.*]] = getelementptr inbounds nuw { i64, float, float }, ptr [[AGG]], i32 0, i32 0322// CHECK: [[V0:%.*]] = load i64, ptr [[T0]], align 16323// CHECK: [[T0:%.*]] = getelementptr inbounds nuw { i64, float, float }, ptr [[AGG]], i32 0, i32 1324// CHECK: [[V1:%.*]] = load float, ptr [[T0]], align 8325// CHECK: [[T0:%.*]] = getelementptr inbounds nuw { i64, float, float }, ptr [[AGG]], i32 0, i32 2326// CHECK: [[V2:%.*]] = load float, ptr [[T0]], align 4327// CHECK: call swiftcc void @take_union_het_fpv_partial(i64 [[V0]], float [[V1]], float [[V2]])328// CHECK: ret void329// CHECK: }330 331/*****************************************************************************/332/****************************** VECTOR LEGALIZATION **************************/333/*****************************************************************************/334 335TEST(int4)336// CHECK-LABEL: define {{.*}} <4 x i32> @return_int4()337// CHECK-LABEL: define {{.*}} @take_int4(<4 x i32>338 339TEST(int8)340// CHECK-LABEL: define {{.*}} @return_int8()341// CHECK: [[RET:%.*]] = alloca [[REC:<8 x i32>]], align 32342// CHECK: [[VAR:%.*]] = alloca [[REC]], align343// CHECK: store344// CHECK: load345// CHECK: store346// CHECK: [[T0:%.*]] = getelementptr inbounds nuw [[AGG:{ <4 x i32>, <4 x i32> }]], ptr [[RET]], i32 0, i32 0347// CHECK: [[FIRST:%.*]] = load <4 x i32>, ptr [[T0]], align348// CHECK: [[T0:%.*]] = getelementptr inbounds nuw [[AGG]], ptr [[RET]], i32 0, i32 1349// CHECK: [[SECOND:%.*]] = load <4 x i32>, ptr [[T0]], align350// CHECK: [[T0:%.*]] = insertvalue [[UAGG:{ <4 x i32>, <4 x i32> }]] poison, <4 x i32> [[FIRST]], 0351// CHECK: [[T1:%.*]] = insertvalue [[UAGG]] [[T0]], <4 x i32> [[SECOND]], 1352// CHECK: ret [[UAGG]] [[T1]]353// CHECK-LABEL: define {{.*}} @take_int8(<4 x i32> noundef %0, <4 x i32> noundef %1)354// CHECK: [[V:%.*]] = alloca [[REC]], align355// CHECK: [[T0:%.*]] = getelementptr inbounds nuw [[AGG]], ptr [[V]], i32 0, i32 0356// CHECK: store <4 x i32> %0, ptr [[T0]], align357// CHECK: [[T0:%.*]] = getelementptr inbounds nuw [[AGG]], ptr [[V]], i32 0, i32 1358// CHECK: store <4 x i32> %1, ptr [[T0]], align359// CHECK: ret void360// CHECK-LABEL: define dso_local void @test_int8()361// CHECK: [[TMP1:%.*]] = alloca [[REC]], align362// CHECK: [[TMP2:%.*]] = alloca [[REC]], align363// CHECK: [[CALL:%.*]] = call [[SWIFTCC]] [[UAGG]] @return_int8()364// CHECK: [[T0:%.*]] = getelementptr inbounds nuw [[AGG]], ptr [[TMP1]], i32 0, i32 0365// CHECK: [[T1:%.*]] = extractvalue [[UAGG]] [[CALL]], 0366// CHECK: store <4 x i32> [[T1]], ptr [[T0]], align367// CHECK: [[T0:%.*]] = getelementptr inbounds nuw [[AGG]], ptr [[TMP1]], i32 0, i32 1368// CHECK: [[T1:%.*]] = extractvalue [[UAGG]] [[CALL]], 1369// CHECK: store <4 x i32> [[T1]], ptr [[T0]], align370// CHECK: [[V:%.*]] = load [[REC]], ptr [[TMP1]], align371// CHECK: store [[REC]] [[V]], ptr [[TMP2]], align372// CHECK: [[T0:%.*]] = getelementptr inbounds nuw [[AGG]], ptr [[TMP2]], i32 0, i32 0373// CHECK: [[FIRST:%.*]] = load <4 x i32>, ptr [[T0]], align374// CHECK: [[T0:%.*]] = getelementptr inbounds nuw [[AGG]], ptr [[TMP2]], i32 0, i32 1375// CHECK: [[SECOND:%.*]] = load <4 x i32>, ptr [[T0]], align376// CHECK: call [[SWIFTCC]] void @take_int8(<4 x i32> noundef [[FIRST]], <4 x i32> noundef [[SECOND]])377// CHECK: ret void378 379TEST(int5)380// CHECK-LABEL: define {{.*}} @return_int5()381// CHECK: [[RET:%.*]] = alloca [[REC:<5 x i32>]], align 32382// CHECK: [[VAR:%.*]] = alloca [[REC]], align383// CHECK: store384// CHECK: load385// CHECK: store386// CHECK: [[T0:%.*]] = getelementptr inbounds nuw [[AGG:{ <4 x i32>, i32 }]], ptr [[RET]], i32 0, i32 0387// CHECK: [[FIRST:%.*]] = load <4 x i32>, ptr [[T0]], align388// CHECK: [[T0:%.*]] = getelementptr inbounds nuw [[AGG]], ptr [[RET]], i32 0, i32 1389// CHECK: [[SECOND:%.*]] = load i32, ptr [[T0]], align390// CHECK: [[T0:%.*]] = insertvalue [[UAGG:{ <4 x i32>, i32 }]] poison, <4 x i32> [[FIRST]], 0391// CHECK: [[T1:%.*]] = insertvalue [[UAGG]] [[T0]], i32 [[SECOND]], 1392// CHECK: ret [[UAGG]] [[T1]]393// CHECK-LABEL: define {{.*}} @take_int5(<4 x i32> %0, i32 %1)394// CHECK: [[V:%.*]] = alloca [[REC]], align395// CHECK: [[T0:%.*]] = getelementptr inbounds nuw [[AGG]], ptr [[V]], i32 0, i32 0396// CHECK: store <4 x i32> %0, ptr [[T0]], align397// CHECK: [[T0:%.*]] = getelementptr inbounds nuw [[AGG]], ptr [[V]], i32 0, i32 1398// CHECK: store i32 %1, ptr [[T0]], align399// CHECK: ret void400// CHECK-LABEL: define dso_local void @test_int5()401// CHECK: [[TMP1:%.*]] = alloca [[REC]], align402// CHECK: [[TMP2:%.*]] = alloca [[REC]], align403// CHECK: [[CALL:%.*]] = call [[SWIFTCC]] [[UAGG]] @return_int5()404// CHECK: [[T0:%.*]] = getelementptr inbounds nuw [[AGG]], ptr [[TMP1]], i32 0, i32 0405// CHECK: [[T1:%.*]] = extractvalue [[UAGG]] [[CALL]], 0406// CHECK: store <4 x i32> [[T1]], ptr [[T0]], align407// CHECK: [[T0:%.*]] = getelementptr inbounds nuw [[AGG]], ptr [[TMP1]], i32 0, i32 1408// CHECK: [[T1:%.*]] = extractvalue [[UAGG]] [[CALL]], 1409// CHECK: store i32 [[T1]], ptr [[T0]], align410// CHECK: [[V:%.*]] = load [[REC]], ptr [[TMP1]], align411// CHECK: store [[REC]] [[V]], ptr [[TMP2]], align412// CHECK: [[T0:%.*]] = getelementptr inbounds nuw [[AGG]], ptr [[TMP2]], i32 0, i32 0413// CHECK: [[FIRST:%.*]] = load <4 x i32>, ptr [[T0]], align414// CHECK: [[T0:%.*]] = getelementptr inbounds nuw [[AGG]], ptr [[TMP2]], i32 0, i32 1415// CHECK: [[SECOND:%.*]] = load i32, ptr [[T0]], align416// CHECK: call [[SWIFTCC]] void @take_int5(<4 x i32> [[FIRST]], i32 [[SECOND]])417// CHECK: ret void418 419typedef struct {420 int x;421 int3 v __attribute__((packed));422} misaligned_int3;423TEST(misaligned_int3)424// CHECK-LABEL: define dso_local swiftcc void @take_misaligned_int3(i64 %0, i64 %1)425