480 lines · plain
1; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --check-globals none --filter-out-after "^scalar.ph:" --version 52; RUN: opt -p loop-vectorize -S %s | FileCheck --check-prefixes=CHECK %s3 4target datalayout = "e-m:o-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-n32:64-S128-Fn32"5target triple = "arm64-apple-macosx15.0.0"6 7define void @test_add_double_same_const_args_1(ptr %res, ptr noalias %A, ptr noalias %B) {8; CHECK-LABEL: define void @test_add_double_same_const_args_1(9; CHECK-SAME: ptr [[RES:%.*]], ptr noalias [[A:%.*]], ptr noalias [[B:%.*]]) {10; CHECK-NEXT: [[ENTRY:.*:]]11; CHECK-NEXT: br label %[[VECTOR_PH:.*]]12; CHECK: [[VECTOR_PH]]:13; CHECK-NEXT: br label %[[VECTOR_BODY:.*]]14; CHECK: [[VECTOR_BODY]]:15; CHECK-NEXT: [[INDEX:%.*]] = phi i64 [ 0, %[[VECTOR_PH]] ], [ [[INDEX_NEXT:%.*]], %[[VECTOR_BODY]] ]16; CHECK-NEXT: [[TMP1:%.*]] = add i64 [[INDEX]], 117; CHECK-NEXT: [[TMP2:%.*]] = getelementptr inbounds nuw { double, double }, ptr [[A]], i64 [[INDEX]]18; CHECK-NEXT: [[TMP3:%.*]] = getelementptr inbounds nuw { double, double }, ptr [[A]], i64 [[TMP1]]19; CHECK-NEXT: [[STRIDED_VEC1:%.*]] = load <2 x double>, ptr [[TMP2]], align 420; CHECK-NEXT: [[STRIDED_VEC4:%.*]] = load <2 x double>, ptr [[TMP3]], align 421; CHECK-NEXT: [[TMP6:%.*]] = fadd <2 x double> [[STRIDED_VEC1]], splat (double 1.000000e+00)22; CHECK-NEXT: [[TMP7:%.*]] = fadd <2 x double> [[STRIDED_VEC4]], splat (double 1.000000e+00)23; CHECK-NEXT: [[TMP8:%.*]] = getelementptr inbounds nuw { double, double }, ptr [[RES]], i64 [[INDEX]]24; CHECK-NEXT: [[TMP9:%.*]] = getelementptr inbounds nuw { double, double }, ptr [[RES]], i64 [[TMP1]]25; CHECK-NEXT: store <2 x double> [[TMP6]], ptr [[TMP8]], align 426; CHECK-NEXT: store <2 x double> [[TMP7]], ptr [[TMP9]], align 427; CHECK-NEXT: [[INDEX_NEXT]] = add nuw i64 [[INDEX]], 228; CHECK-NEXT: [[TMP12:%.*]] = icmp eq i64 [[INDEX_NEXT]], 10029; CHECK-NEXT: br i1 [[TMP12]], label %[[MIDDLE_BLOCK:.*]], label %[[VECTOR_BODY]], !llvm.loop [[LOOP0:![0-9]+]]30; CHECK: [[MIDDLE_BLOCK]]:31; CHECK-NEXT: br [[EXIT:label %.*]]32; CHECK: [[SCALAR_PH:.*:]]33;34entry:35 br label %loop36 37loop:38 %iv = phi i64 [ 0, %entry ], [ %iv.next, %loop ]39 %gep.A.0 = getelementptr inbounds nuw { double, double }, ptr %A, i64 %iv40 %l.A.0 = load double, ptr %gep.A.0, align 441 %gep.A.1 = getelementptr inbounds nuw i8, ptr %gep.A.0, i64 842 %l.A.1 = load double, ptr %gep.A.1, align 443 %add.0 = fadd double %l.A.0, 1.044 %add.1 = fadd double %l.A.1, 1.045 %gep.res.0 = getelementptr inbounds nuw { double, double }, ptr %res, i64 %iv46 store double %add.0, ptr %gep.res.0, align 447 %gep.res.1 = getelementptr inbounds nuw i8, ptr %gep.res.0, i64 848 store double %add.1, ptr %gep.res.1, align 449 %iv.next = add nuw nsw i64 %iv, 150 %ec = icmp eq i64 %iv.next, 10051 br i1 %ec, label %exit, label %loop52 53exit:54 ret void55}56 57define void @test_add_double_same_const_args_2(ptr %res, ptr noalias %A, ptr noalias %B) {58; CHECK-LABEL: define void @test_add_double_same_const_args_2(59; CHECK-SAME: ptr [[RES:%.*]], ptr noalias [[A:%.*]], ptr noalias [[B:%.*]]) {60; CHECK-NEXT: [[ENTRY:.*:]]61; CHECK-NEXT: br label %[[VECTOR_PH:.*]]62; CHECK: [[VECTOR_PH]]:63; CHECK-NEXT: br label %[[VECTOR_BODY:.*]]64; CHECK: [[VECTOR_BODY]]:65; CHECK-NEXT: [[INDEX:%.*]] = phi i64 [ 0, %[[VECTOR_PH]] ], [ [[INDEX_NEXT:%.*]], %[[VECTOR_BODY]] ]66; CHECK-NEXT: [[TMP1:%.*]] = add i64 [[INDEX]], 167; CHECK-NEXT: [[TMP2:%.*]] = getelementptr inbounds nuw { double, double }, ptr [[B]], i64 [[INDEX]]68; CHECK-NEXT: [[TMP3:%.*]] = getelementptr inbounds nuw { double, double }, ptr [[B]], i64 [[TMP1]]69; CHECK-NEXT: [[STRIDED_VEC1:%.*]] = load <2 x double>, ptr [[TMP2]], align 470; CHECK-NEXT: [[STRIDED_VEC4:%.*]] = load <2 x double>, ptr [[TMP3]], align 471; CHECK-NEXT: [[TMP6:%.*]] = fadd <2 x double> splat (double 1.000000e+00), [[STRIDED_VEC1]]72; CHECK-NEXT: [[TMP7:%.*]] = fadd <2 x double> splat (double 1.000000e+00), [[STRIDED_VEC4]]73; CHECK-NEXT: [[TMP8:%.*]] = getelementptr inbounds nuw { double, double }, ptr [[RES]], i64 [[INDEX]]74; CHECK-NEXT: [[TMP9:%.*]] = getelementptr inbounds nuw { double, double }, ptr [[RES]], i64 [[TMP1]]75; CHECK-NEXT: store <2 x double> [[TMP6]], ptr [[TMP8]], align 476; CHECK-NEXT: store <2 x double> [[TMP7]], ptr [[TMP9]], align 477; CHECK-NEXT: [[INDEX_NEXT]] = add nuw i64 [[INDEX]], 278; CHECK-NEXT: [[TMP12:%.*]] = icmp eq i64 [[INDEX_NEXT]], 10079; CHECK-NEXT: br i1 [[TMP12]], label %[[MIDDLE_BLOCK:.*]], label %[[VECTOR_BODY]], !llvm.loop [[LOOP4:![0-9]+]]80; CHECK: [[MIDDLE_BLOCK]]:81; CHECK-NEXT: br [[EXIT:label %.*]]82; CHECK: [[SCALAR_PH:.*:]]83;84entry:85 br label %loop86 87loop:88 %iv = phi i64 [ 0, %entry ], [ %iv.next, %loop ]89 %gep.B.0 = getelementptr inbounds nuw { double, double }, ptr %B, i64 %iv90 %l.B.0 = load double, ptr %gep.B.0, align 491 %add.0 = fadd double 1.0, %l.B.092 %gep.B.1 = getelementptr inbounds nuw i8, ptr %gep.B.0, i64 893 %l.B.1 = load double, ptr %gep.B.1, align 494 %add.1 = fadd double 1.0, %l.B.195 %gep.res.0 = getelementptr inbounds nuw { double, double }, ptr %res, i64 %iv96 store double %add.0, ptr %gep.res.0, align 497 %gep.res.1 = getelementptr inbounds nuw i8, ptr %gep.res.0, i64 898 store double %add.1, ptr %gep.res.1, align 499 %iv.next = add nuw nsw i64 %iv, 1100 %ec = icmp eq i64 %iv.next, 100101 br i1 %ec, label %exit, label %loop102 103exit:104 ret void105}106 107define void @test_add_double_mixed_const_args(ptr %res, ptr noalias %A, ptr noalias %B) {108; CHECK-LABEL: define void @test_add_double_mixed_const_args(109; CHECK-SAME: ptr [[RES:%.*]], ptr noalias [[A:%.*]], ptr noalias [[B:%.*]]) {110; CHECK-NEXT: [[ENTRY:.*:]]111; CHECK-NEXT: br label %[[VECTOR_PH:.*]]112; CHECK: [[VECTOR_PH]]:113; CHECK-NEXT: br label %[[VECTOR_BODY:.*]]114; CHECK: [[VECTOR_BODY]]:115; CHECK-NEXT: [[INDEX:%.*]] = phi i64 [ 0, %[[VECTOR_PH]] ], [ [[INDEX_NEXT:%.*]], %[[VECTOR_BODY]] ]116; CHECK-NEXT: [[TMP1:%.*]] = add i64 [[INDEX]], 2117; CHECK-NEXT: [[TMP2:%.*]] = getelementptr inbounds nuw { double, double }, ptr [[B]], i64 [[INDEX]]118; CHECK-NEXT: [[TMP3:%.*]] = getelementptr inbounds nuw { double, double }, ptr [[B]], i64 [[TMP1]]119; CHECK-NEXT: [[WIDE_VEC:%.*]] = load <4 x double>, ptr [[TMP2]], align 4120; CHECK-NEXT: [[STRIDED_VEC:%.*]] = shufflevector <4 x double> [[WIDE_VEC]], <4 x double> poison, <2 x i32> <i32 0, i32 2>121; CHECK-NEXT: [[STRIDED_VEC1:%.*]] = shufflevector <4 x double> [[WIDE_VEC]], <4 x double> poison, <2 x i32> <i32 1, i32 3>122; CHECK-NEXT: [[WIDE_VEC2:%.*]] = load <4 x double>, ptr [[TMP3]], align 4123; CHECK-NEXT: [[STRIDED_VEC3:%.*]] = shufflevector <4 x double> [[WIDE_VEC2]], <4 x double> poison, <2 x i32> <i32 0, i32 2>124; CHECK-NEXT: [[STRIDED_VEC4:%.*]] = shufflevector <4 x double> [[WIDE_VEC2]], <4 x double> poison, <2 x i32> <i32 1, i32 3>125; CHECK-NEXT: [[TMP4:%.*]] = fadd <2 x double> splat (double 1.000000e+00), [[STRIDED_VEC]]126; CHECK-NEXT: [[TMP5:%.*]] = fadd <2 x double> splat (double 1.000000e+00), [[STRIDED_VEC3]]127; CHECK-NEXT: [[TMP6:%.*]] = fadd <2 x double> splat (double 2.000000e+00), [[STRIDED_VEC1]]128; CHECK-NEXT: [[TMP7:%.*]] = fadd <2 x double> splat (double 2.000000e+00), [[STRIDED_VEC4]]129; CHECK-NEXT: [[TMP8:%.*]] = getelementptr inbounds nuw { double, double }, ptr [[RES]], i64 [[INDEX]]130; CHECK-NEXT: [[TMP9:%.*]] = getelementptr inbounds nuw { double, double }, ptr [[RES]], i64 [[TMP1]]131; CHECK-NEXT: [[TMP10:%.*]] = shufflevector <2 x double> [[TMP4]], <2 x double> [[TMP6]], <4 x i32> <i32 0, i32 1, i32 2, i32 3>132; CHECK-NEXT: [[INTERLEAVED_VEC:%.*]] = shufflevector <4 x double> [[TMP10]], <4 x double> poison, <4 x i32> <i32 0, i32 2, i32 1, i32 3>133; CHECK-NEXT: store <4 x double> [[INTERLEAVED_VEC]], ptr [[TMP8]], align 4134; CHECK-NEXT: [[TMP11:%.*]] = shufflevector <2 x double> [[TMP5]], <2 x double> [[TMP7]], <4 x i32> <i32 0, i32 1, i32 2, i32 3>135; CHECK-NEXT: [[INTERLEAVED_VEC5:%.*]] = shufflevector <4 x double> [[TMP11]], <4 x double> poison, <4 x i32> <i32 0, i32 2, i32 1, i32 3>136; CHECK-NEXT: store <4 x double> [[INTERLEAVED_VEC5]], ptr [[TMP9]], align 4137; CHECK-NEXT: [[INDEX_NEXT]] = add nuw i64 [[INDEX]], 4138; CHECK-NEXT: [[TMP12:%.*]] = icmp eq i64 [[INDEX_NEXT]], 100139; CHECK-NEXT: br i1 [[TMP12]], label %[[MIDDLE_BLOCK:.*]], label %[[VECTOR_BODY]], !llvm.loop [[LOOP6:![0-9]+]]140; CHECK: [[MIDDLE_BLOCK]]:141; CHECK-NEXT: br [[EXIT:label %.*]]142; CHECK: [[SCALAR_PH:.*:]]143;144entry:145 br label %loop146 147loop:148 %iv = phi i64 [ 0, %entry ], [ %iv.next, %loop ]149 %gep.B.0 = getelementptr inbounds nuw { double, double }, ptr %B, i64 %iv150 %l.B.0 = load double, ptr %gep.B.0, align 4151 %add.0 = fadd double 1.0, %l.B.0152 %gep.B.1 = getelementptr inbounds nuw i8, ptr %gep.B.0, i64 8153 %l.B.1 = load double, ptr %gep.B.1, align 4154 %add.1 = fadd double 2.0, %l.B.1155 %gep.res.0 = getelementptr inbounds nuw { double, double }, ptr %res, i64 %iv156 store double %add.0, ptr %gep.res.0, align 4157 %gep.res.1 = getelementptr inbounds nuw i8, ptr %gep.res.0, i64 8158 store double %add.1, ptr %gep.res.1, align 4159 %iv.next = add nuw nsw i64 %iv, 1160 %ec = icmp eq i64 %iv.next, 100161 br i1 %ec, label %exit, label %loop162 163exit:164 ret void165}166 167define void @test_add_double_same_var_args_1(ptr %res, ptr noalias %A, ptr noalias %B, double %x) {168; CHECK-LABEL: define void @test_add_double_same_var_args_1(169; CHECK-SAME: ptr [[RES:%.*]], ptr noalias [[A:%.*]], ptr noalias [[B:%.*]], double [[X:%.*]]) {170; CHECK-NEXT: [[ENTRY:.*:]]171; CHECK-NEXT: br label %[[VECTOR_PH:.*]]172; CHECK: [[VECTOR_PH]]:173; CHECK-NEXT: [[BROADCAST_SPLATINSERT:%.*]] = insertelement <2 x double> poison, double [[X]], i64 0174; CHECK-NEXT: [[BROADCAST_SPLAT:%.*]] = shufflevector <2 x double> [[BROADCAST_SPLATINSERT]], <2 x double> poison, <2 x i32> zeroinitializer175; CHECK-NEXT: br label %[[VECTOR_BODY:.*]]176; CHECK: [[VECTOR_BODY]]:177; CHECK-NEXT: [[INDEX:%.*]] = phi i64 [ 0, %[[VECTOR_PH]] ], [ [[INDEX_NEXT:%.*]], %[[VECTOR_BODY]] ]178; CHECK-NEXT: [[TMP0:%.*]] = add i64 [[INDEX]], 2179; CHECK-NEXT: [[TMP1:%.*]] = getelementptr inbounds nuw { double, double }, ptr [[A]], i64 [[INDEX]]180; CHECK-NEXT: [[TMP2:%.*]] = getelementptr inbounds nuw { double, double }, ptr [[A]], i64 [[TMP0]]181; CHECK-NEXT: [[WIDE_VEC:%.*]] = load <4 x double>, ptr [[TMP1]], align 4182; CHECK-NEXT: [[STRIDED_VEC:%.*]] = shufflevector <4 x double> [[WIDE_VEC]], <4 x double> poison, <2 x i32> <i32 0, i32 2>183; CHECK-NEXT: [[STRIDED_VEC1:%.*]] = shufflevector <4 x double> [[WIDE_VEC]], <4 x double> poison, <2 x i32> <i32 1, i32 3>184; CHECK-NEXT: [[WIDE_VEC2:%.*]] = load <4 x double>, ptr [[TMP2]], align 4185; CHECK-NEXT: [[STRIDED_VEC3:%.*]] = shufflevector <4 x double> [[WIDE_VEC2]], <4 x double> poison, <2 x i32> <i32 0, i32 2>186; CHECK-NEXT: [[STRIDED_VEC4:%.*]] = shufflevector <4 x double> [[WIDE_VEC2]], <4 x double> poison, <2 x i32> <i32 1, i32 3>187; CHECK-NEXT: [[TMP3:%.*]] = fadd <2 x double> [[STRIDED_VEC]], [[BROADCAST_SPLAT]]188; CHECK-NEXT: [[TMP4:%.*]] = fadd <2 x double> [[STRIDED_VEC3]], [[BROADCAST_SPLAT]]189; CHECK-NEXT: [[TMP5:%.*]] = fadd <2 x double> [[STRIDED_VEC1]], [[BROADCAST_SPLAT]]190; CHECK-NEXT: [[TMP6:%.*]] = fadd <2 x double> [[STRIDED_VEC4]], [[BROADCAST_SPLAT]]191; CHECK-NEXT: [[TMP7:%.*]] = getelementptr inbounds nuw { double, double }, ptr [[RES]], i64 [[INDEX]]192; CHECK-NEXT: [[TMP8:%.*]] = getelementptr inbounds nuw { double, double }, ptr [[RES]], i64 [[TMP0]]193; CHECK-NEXT: [[TMP9:%.*]] = shufflevector <2 x double> [[TMP3]], <2 x double> [[TMP5]], <4 x i32> <i32 0, i32 1, i32 2, i32 3>194; CHECK-NEXT: [[INTERLEAVED_VEC:%.*]] = shufflevector <4 x double> [[TMP9]], <4 x double> poison, <4 x i32> <i32 0, i32 2, i32 1, i32 3>195; CHECK-NEXT: store <4 x double> [[INTERLEAVED_VEC]], ptr [[TMP7]], align 4196; CHECK-NEXT: [[TMP10:%.*]] = shufflevector <2 x double> [[TMP4]], <2 x double> [[TMP6]], <4 x i32> <i32 0, i32 1, i32 2, i32 3>197; CHECK-NEXT: [[INTERLEAVED_VEC5:%.*]] = shufflevector <4 x double> [[TMP10]], <4 x double> poison, <4 x i32> <i32 0, i32 2, i32 1, i32 3>198; CHECK-NEXT: store <4 x double> [[INTERLEAVED_VEC5]], ptr [[TMP8]], align 4199; CHECK-NEXT: [[INDEX_NEXT]] = add nuw i64 [[INDEX]], 4200; CHECK-NEXT: [[TMP11:%.*]] = icmp eq i64 [[INDEX_NEXT]], 100201; CHECK-NEXT: br i1 [[TMP11]], label %[[MIDDLE_BLOCK:.*]], label %[[VECTOR_BODY]], !llvm.loop [[LOOP8:![0-9]+]]202; CHECK: [[MIDDLE_BLOCK]]:203; CHECK-NEXT: br [[EXIT:label %.*]]204; CHECK: [[SCALAR_PH:.*:]]205;206entry:207 br label %loop208 209loop:210 %iv = phi i64 [ 0, %entry ], [ %iv.next, %loop ]211 %gep.A.0 = getelementptr inbounds nuw { double, double }, ptr %A, i64 %iv212 %l.A.0 = load double, ptr %gep.A.0, align 4213 %gep.A.1 = getelementptr inbounds nuw i8, ptr %gep.A.0, i64 8214 %l.A.1 = load double, ptr %gep.A.1, align 4215 %add.0 = fadd double %l.A.0, %x216 %add.1 = fadd double %l.A.1, %x217 %gep.res.0 = getelementptr inbounds nuw { double, double }, ptr %res, i64 %iv218 store double %add.0, ptr %gep.res.0, align 4219 %gep.res.1 = getelementptr inbounds nuw i8, ptr %gep.res.0, i64 8220 store double %add.1, ptr %gep.res.1, align 4221 %iv.next = add nuw nsw i64 %iv, 1222 %ec = icmp eq i64 %iv.next, 100223 br i1 %ec, label %exit, label %loop224 225exit:226 ret void227}228 229define void @test_add_double_same_var_args_2(ptr %res, ptr noalias %A, ptr noalias %B, double %x) {230; CHECK-LABEL: define void @test_add_double_same_var_args_2(231; CHECK-SAME: ptr [[RES:%.*]], ptr noalias [[A:%.*]], ptr noalias [[B:%.*]], double [[X:%.*]]) {232; CHECK-NEXT: [[ENTRY:.*:]]233; CHECK-NEXT: br label %[[VECTOR_PH:.*]]234; CHECK: [[VECTOR_PH]]:235; CHECK-NEXT: [[BROADCAST_SPLATINSERT:%.*]] = insertelement <2 x double> poison, double [[X]], i64 0236; CHECK-NEXT: [[BROADCAST_SPLAT:%.*]] = shufflevector <2 x double> [[BROADCAST_SPLATINSERT]], <2 x double> poison, <2 x i32> zeroinitializer237; CHECK-NEXT: br label %[[VECTOR_BODY:.*]]238; CHECK: [[VECTOR_BODY]]:239; CHECK-NEXT: [[INDEX:%.*]] = phi i64 [ 0, %[[VECTOR_PH]] ], [ [[INDEX_NEXT:%.*]], %[[VECTOR_BODY]] ]240; CHECK-NEXT: [[TMP0:%.*]] = add i64 [[INDEX]], 2241; CHECK-NEXT: [[TMP1:%.*]] = getelementptr inbounds nuw { double, double }, ptr [[A]], i64 [[INDEX]]242; CHECK-NEXT: [[TMP2:%.*]] = getelementptr inbounds nuw { double, double }, ptr [[A]], i64 [[TMP0]]243; CHECK-NEXT: [[WIDE_VEC:%.*]] = load <4 x double>, ptr [[TMP1]], align 4244; CHECK-NEXT: [[STRIDED_VEC:%.*]] = shufflevector <4 x double> [[WIDE_VEC]], <4 x double> poison, <2 x i32> <i32 0, i32 2>245; CHECK-NEXT: [[STRIDED_VEC1:%.*]] = shufflevector <4 x double> [[WIDE_VEC]], <4 x double> poison, <2 x i32> <i32 1, i32 3>246; CHECK-NEXT: [[WIDE_VEC2:%.*]] = load <4 x double>, ptr [[TMP2]], align 4247; CHECK-NEXT: [[STRIDED_VEC3:%.*]] = shufflevector <4 x double> [[WIDE_VEC2]], <4 x double> poison, <2 x i32> <i32 0, i32 2>248; CHECK-NEXT: [[STRIDED_VEC4:%.*]] = shufflevector <4 x double> [[WIDE_VEC2]], <4 x double> poison, <2 x i32> <i32 1, i32 3>249; CHECK-NEXT: [[TMP3:%.*]] = fadd <2 x double> [[BROADCAST_SPLAT]], [[STRIDED_VEC]]250; CHECK-NEXT: [[TMP4:%.*]] = fadd <2 x double> [[BROADCAST_SPLAT]], [[STRIDED_VEC3]]251; CHECK-NEXT: [[TMP5:%.*]] = fadd <2 x double> [[BROADCAST_SPLAT]], [[STRIDED_VEC1]]252; CHECK-NEXT: [[TMP6:%.*]] = fadd <2 x double> [[BROADCAST_SPLAT]], [[STRIDED_VEC4]]253; CHECK-NEXT: [[TMP7:%.*]] = getelementptr inbounds nuw { double, double }, ptr [[RES]], i64 [[INDEX]]254; CHECK-NEXT: [[TMP8:%.*]] = getelementptr inbounds nuw { double, double }, ptr [[RES]], i64 [[TMP0]]255; CHECK-NEXT: [[TMP9:%.*]] = shufflevector <2 x double> [[TMP3]], <2 x double> [[TMP5]], <4 x i32> <i32 0, i32 1, i32 2, i32 3>256; CHECK-NEXT: [[INTERLEAVED_VEC:%.*]] = shufflevector <4 x double> [[TMP9]], <4 x double> poison, <4 x i32> <i32 0, i32 2, i32 1, i32 3>257; CHECK-NEXT: store <4 x double> [[INTERLEAVED_VEC]], ptr [[TMP7]], align 4258; CHECK-NEXT: [[TMP10:%.*]] = shufflevector <2 x double> [[TMP4]], <2 x double> [[TMP6]], <4 x i32> <i32 0, i32 1, i32 2, i32 3>259; CHECK-NEXT: [[INTERLEAVED_VEC5:%.*]] = shufflevector <4 x double> [[TMP10]], <4 x double> poison, <4 x i32> <i32 0, i32 2, i32 1, i32 3>260; CHECK-NEXT: store <4 x double> [[INTERLEAVED_VEC5]], ptr [[TMP8]], align 4261; CHECK-NEXT: [[INDEX_NEXT]] = add nuw i64 [[INDEX]], 4262; CHECK-NEXT: [[TMP11:%.*]] = icmp eq i64 [[INDEX_NEXT]], 100263; CHECK-NEXT: br i1 [[TMP11]], label %[[MIDDLE_BLOCK:.*]], label %[[VECTOR_BODY]], !llvm.loop [[LOOP10:![0-9]+]]264; CHECK: [[MIDDLE_BLOCK]]:265; CHECK-NEXT: br [[EXIT:label %.*]]266; CHECK: [[SCALAR_PH:.*:]]267;268entry:269 br label %loop270 271loop:272 %iv = phi i64 [ 0, %entry ], [ %iv.next, %loop ]273 %gep.A.0 = getelementptr inbounds nuw { double, double }, ptr %A, i64 %iv274 %l.A.0 = load double, ptr %gep.A.0, align 4275 %gep.A.1 = getelementptr inbounds nuw i8, ptr %gep.A.0, i64 8276 %l.A.1 = load double, ptr %gep.A.1, align 4277 %add.0 = fadd double %x, %l.A.0278 %add.1 = fadd double %x, %l.A.1279 %gep.res.0 = getelementptr inbounds nuw { double, double }, ptr %res, i64 %iv280 store double %add.0, ptr %gep.res.0, align 4281 %gep.res.1 = getelementptr inbounds nuw i8, ptr %gep.res.0, i64 8282 store double %add.1, ptr %gep.res.1, align 4283 %iv.next = add nuw nsw i64 %iv, 1284 %ec = icmp eq i64 %iv.next, 100285 br i1 %ec, label %exit, label %loop286 287exit:288 ret void289}290 291define void @test_add_double_same_var_args_at_different_positions(ptr %res, ptr noalias %A, ptr noalias %B, double %x) {292; CHECK-LABEL: define void @test_add_double_same_var_args_at_different_positions(293; CHECK-SAME: ptr [[RES:%.*]], ptr noalias [[A:%.*]], ptr noalias [[B:%.*]], double [[X:%.*]]) {294; CHECK-NEXT: [[ENTRY:.*:]]295; CHECK-NEXT: br label %[[VECTOR_PH:.*]]296; CHECK: [[VECTOR_PH]]:297; CHECK-NEXT: [[BROADCAST_SPLATINSERT:%.*]] = insertelement <2 x double> poison, double [[X]], i64 0298; CHECK-NEXT: [[BROADCAST_SPLAT:%.*]] = shufflevector <2 x double> [[BROADCAST_SPLATINSERT]], <2 x double> poison, <2 x i32> zeroinitializer299; CHECK-NEXT: br label %[[VECTOR_BODY:.*]]300; CHECK: [[VECTOR_BODY]]:301; CHECK-NEXT: [[INDEX:%.*]] = phi i64 [ 0, %[[VECTOR_PH]] ], [ [[INDEX_NEXT:%.*]], %[[VECTOR_BODY]] ]302; CHECK-NEXT: [[TMP0:%.*]] = add i64 [[INDEX]], 2303; CHECK-NEXT: [[TMP1:%.*]] = getelementptr inbounds nuw { double, double }, ptr [[A]], i64 [[INDEX]]304; CHECK-NEXT: [[TMP2:%.*]] = getelementptr inbounds nuw { double, double }, ptr [[A]], i64 [[TMP0]]305; CHECK-NEXT: [[WIDE_VEC:%.*]] = load <4 x double>, ptr [[TMP1]], align 4306; CHECK-NEXT: [[STRIDED_VEC:%.*]] = shufflevector <4 x double> [[WIDE_VEC]], <4 x double> poison, <2 x i32> <i32 0, i32 2>307; CHECK-NEXT: [[STRIDED_VEC1:%.*]] = shufflevector <4 x double> [[WIDE_VEC]], <4 x double> poison, <2 x i32> <i32 1, i32 3>308; CHECK-NEXT: [[WIDE_VEC2:%.*]] = load <4 x double>, ptr [[TMP2]], align 4309; CHECK-NEXT: [[STRIDED_VEC3:%.*]] = shufflevector <4 x double> [[WIDE_VEC2]], <4 x double> poison, <2 x i32> <i32 0, i32 2>310; CHECK-NEXT: [[STRIDED_VEC4:%.*]] = shufflevector <4 x double> [[WIDE_VEC2]], <4 x double> poison, <2 x i32> <i32 1, i32 3>311; CHECK-NEXT: [[TMP3:%.*]] = fadd <2 x double> [[STRIDED_VEC]], [[BROADCAST_SPLAT]]312; CHECK-NEXT: [[TMP4:%.*]] = fadd <2 x double> [[STRIDED_VEC3]], [[BROADCAST_SPLAT]]313; CHECK-NEXT: [[TMP5:%.*]] = fadd <2 x double> [[BROADCAST_SPLAT]], [[STRIDED_VEC1]]314; CHECK-NEXT: [[TMP6:%.*]] = fadd <2 x double> [[BROADCAST_SPLAT]], [[STRIDED_VEC4]]315; CHECK-NEXT: [[TMP7:%.*]] = getelementptr inbounds nuw { double, double }, ptr [[RES]], i64 [[INDEX]]316; CHECK-NEXT: [[TMP8:%.*]] = getelementptr inbounds nuw { double, double }, ptr [[RES]], i64 [[TMP0]]317; CHECK-NEXT: [[TMP9:%.*]] = shufflevector <2 x double> [[TMP3]], <2 x double> [[TMP5]], <4 x i32> <i32 0, i32 1, i32 2, i32 3>318; CHECK-NEXT: [[INTERLEAVED_VEC:%.*]] = shufflevector <4 x double> [[TMP9]], <4 x double> poison, <4 x i32> <i32 0, i32 2, i32 1, i32 3>319; CHECK-NEXT: store <4 x double> [[INTERLEAVED_VEC]], ptr [[TMP7]], align 4320; CHECK-NEXT: [[TMP10:%.*]] = shufflevector <2 x double> [[TMP4]], <2 x double> [[TMP6]], <4 x i32> <i32 0, i32 1, i32 2, i32 3>321; CHECK-NEXT: [[INTERLEAVED_VEC5:%.*]] = shufflevector <4 x double> [[TMP10]], <4 x double> poison, <4 x i32> <i32 0, i32 2, i32 1, i32 3>322; CHECK-NEXT: store <4 x double> [[INTERLEAVED_VEC5]], ptr [[TMP8]], align 4323; CHECK-NEXT: [[INDEX_NEXT]] = add nuw i64 [[INDEX]], 4324; CHECK-NEXT: [[TMP11:%.*]] = icmp eq i64 [[INDEX_NEXT]], 100325; CHECK-NEXT: br i1 [[TMP11]], label %[[MIDDLE_BLOCK:.*]], label %[[VECTOR_BODY]], !llvm.loop [[LOOP12:![0-9]+]]326; CHECK: [[MIDDLE_BLOCK]]:327; CHECK-NEXT: br [[EXIT:label %.*]]328; CHECK: [[SCALAR_PH:.*:]]329;330entry:331 br label %loop332 333loop:334 %iv = phi i64 [ 0, %entry ], [ %iv.next, %loop ]335 %gep.A.0 = getelementptr inbounds nuw { double, double }, ptr %A, i64 %iv336 %l.A.0 = load double, ptr %gep.A.0, align 4337 %gep.A.1 = getelementptr inbounds nuw i8, ptr %gep.A.0, i64 8338 %l.A.1 = load double, ptr %gep.A.1, align 4339 %add.0 = fadd double %l.A.0, %x340 %add.1 = fadd double %x, %l.A.1341 %gep.res.0 = getelementptr inbounds nuw { double, double }, ptr %res, i64 %iv342 store double %add.0, ptr %gep.res.0, align 4343 %gep.res.1 = getelementptr inbounds nuw i8, ptr %gep.res.0, i64 8344 store double %add.1, ptr %gep.res.1, align 4345 %iv.next = add nuw nsw i64 %iv, 1346 %ec = icmp eq i64 %iv.next, 100347 br i1 %ec, label %exit, label %loop348 349exit:350 ret void351}352 353define void @test_add_double_different_var_args_1(ptr %res, ptr noalias %A, ptr noalias %B, double %x, double %y) {354; CHECK-LABEL: define void @test_add_double_different_var_args_1(355; CHECK-SAME: ptr [[RES:%.*]], ptr noalias [[A:%.*]], ptr noalias [[B:%.*]], double [[X:%.*]], double [[Y:%.*]]) {356; CHECK-NEXT: [[ENTRY:.*:]]357; CHECK-NEXT: br label %[[VECTOR_PH:.*]]358; CHECK: [[VECTOR_PH]]:359; CHECK-NEXT: [[BROADCAST_SPLATINSERT:%.*]] = insertelement <2 x double> poison, double [[X]], i64 0360; CHECK-NEXT: [[BROADCAST_SPLAT:%.*]] = shufflevector <2 x double> [[BROADCAST_SPLATINSERT]], <2 x double> poison, <2 x i32> zeroinitializer361; CHECK-NEXT: [[BROADCAST_SPLATINSERT1:%.*]] = insertelement <2 x double> poison, double [[Y]], i64 0362; CHECK-NEXT: [[BROADCAST_SPLAT2:%.*]] = shufflevector <2 x double> [[BROADCAST_SPLATINSERT1]], <2 x double> poison, <2 x i32> zeroinitializer363; CHECK-NEXT: br label %[[VECTOR_BODY:.*]]364; CHECK: [[VECTOR_BODY]]:365; CHECK-NEXT: [[INDEX:%.*]] = phi i64 [ 0, %[[VECTOR_PH]] ], [ [[INDEX_NEXT:%.*]], %[[VECTOR_BODY]] ]366; CHECK-NEXT: [[TMP0:%.*]] = add i64 [[INDEX]], 2367; CHECK-NEXT: [[TMP1:%.*]] = getelementptr inbounds nuw { double, double }, ptr [[A]], i64 [[INDEX]]368; CHECK-NEXT: [[TMP2:%.*]] = getelementptr inbounds nuw { double, double }, ptr [[A]], i64 [[TMP0]]369; CHECK-NEXT: [[WIDE_VEC:%.*]] = load <4 x double>, ptr [[TMP1]], align 4370; CHECK-NEXT: [[STRIDED_VEC:%.*]] = shufflevector <4 x double> [[WIDE_VEC]], <4 x double> poison, <2 x i32> <i32 0, i32 2>371; CHECK-NEXT: [[STRIDED_VEC3:%.*]] = shufflevector <4 x double> [[WIDE_VEC]], <4 x double> poison, <2 x i32> <i32 1, i32 3>372; CHECK-NEXT: [[WIDE_VEC4:%.*]] = load <4 x double>, ptr [[TMP2]], align 4373; CHECK-NEXT: [[STRIDED_VEC5:%.*]] = shufflevector <4 x double> [[WIDE_VEC4]], <4 x double> poison, <2 x i32> <i32 0, i32 2>374; CHECK-NEXT: [[STRIDED_VEC6:%.*]] = shufflevector <4 x double> [[WIDE_VEC4]], <4 x double> poison, <2 x i32> <i32 1, i32 3>375; CHECK-NEXT: [[TMP3:%.*]] = fadd <2 x double> [[STRIDED_VEC]], [[BROADCAST_SPLAT]]376; CHECK-NEXT: [[TMP4:%.*]] = fadd <2 x double> [[STRIDED_VEC5]], [[BROADCAST_SPLAT]]377; CHECK-NEXT: [[TMP5:%.*]] = fadd <2 x double> [[STRIDED_VEC3]], [[BROADCAST_SPLAT2]]378; CHECK-NEXT: [[TMP6:%.*]] = fadd <2 x double> [[STRIDED_VEC6]], [[BROADCAST_SPLAT2]]379; CHECK-NEXT: [[TMP7:%.*]] = getelementptr inbounds nuw { double, double }, ptr [[RES]], i64 [[INDEX]]380; CHECK-NEXT: [[TMP8:%.*]] = getelementptr inbounds nuw { double, double }, ptr [[RES]], i64 [[TMP0]]381; CHECK-NEXT: [[TMP9:%.*]] = shufflevector <2 x double> [[TMP3]], <2 x double> [[TMP5]], <4 x i32> <i32 0, i32 1, i32 2, i32 3>382; CHECK-NEXT: [[INTERLEAVED_VEC:%.*]] = shufflevector <4 x double> [[TMP9]], <4 x double> poison, <4 x i32> <i32 0, i32 2, i32 1, i32 3>383; CHECK-NEXT: store <4 x double> [[INTERLEAVED_VEC]], ptr [[TMP7]], align 4384; CHECK-NEXT: [[TMP10:%.*]] = shufflevector <2 x double> [[TMP4]], <2 x double> [[TMP6]], <4 x i32> <i32 0, i32 1, i32 2, i32 3>385; CHECK-NEXT: [[INTERLEAVED_VEC7:%.*]] = shufflevector <4 x double> [[TMP10]], <4 x double> poison, <4 x i32> <i32 0, i32 2, i32 1, i32 3>386; CHECK-NEXT: store <4 x double> [[INTERLEAVED_VEC7]], ptr [[TMP8]], align 4387; CHECK-NEXT: [[INDEX_NEXT]] = add nuw i64 [[INDEX]], 4388; CHECK-NEXT: [[TMP11:%.*]] = icmp eq i64 [[INDEX_NEXT]], 100389; CHECK-NEXT: br i1 [[TMP11]], label %[[MIDDLE_BLOCK:.*]], label %[[VECTOR_BODY]], !llvm.loop [[LOOP14:![0-9]+]]390; CHECK: [[MIDDLE_BLOCK]]:391; CHECK-NEXT: br [[EXIT:label %.*]]392; CHECK: [[SCALAR_PH:.*:]]393;394entry:395 br label %loop396 397loop:398 %iv = phi i64 [ 0, %entry ], [ %iv.next, %loop ]399 %gep.A.0 = getelementptr inbounds nuw { double, double }, ptr %A, i64 %iv400 %l.A.0 = load double, ptr %gep.A.0, align 4401 %gep.A.1 = getelementptr inbounds nuw i8, ptr %gep.A.0, i64 8402 %l.A.1 = load double, ptr %gep.A.1, align 4403 %add.0 = fadd double %l.A.0, %x404 %add.1 = fadd double %l.A.1, %y405 %gep.res.0 = getelementptr inbounds nuw { double, double }, ptr %res, i64 %iv406 store double %add.0, ptr %gep.res.0, align 4407 %gep.res.1 = getelementptr inbounds nuw i8, ptr %gep.res.0, i64 8408 store double %add.1, ptr %gep.res.1, align 4409 %iv.next = add nuw nsw i64 %iv, 1410 %ec = icmp eq i64 %iv.next, 100411 br i1 %ec, label %exit, label %loop412 413exit:414 ret void415}416 417define void @test_add_double_different_var_args_2(ptr %res, ptr noalias %A, ptr noalias %B, double %x, double %y) {418; CHECK-LABEL: define void @test_add_double_different_var_args_2(419; CHECK-SAME: ptr [[RES:%.*]], ptr noalias [[A:%.*]], ptr noalias [[B:%.*]], double [[X:%.*]], double [[Y:%.*]]) {420; CHECK-NEXT: [[ENTRY:.*:]]421; CHECK-NEXT: br label %[[VECTOR_PH:.*]]422; CHECK: [[VECTOR_PH]]:423; CHECK-NEXT: [[BROADCAST_SPLATINSERT:%.*]] = insertelement <2 x double> poison, double [[Y]], i64 0424; CHECK-NEXT: [[BROADCAST_SPLAT:%.*]] = shufflevector <2 x double> [[BROADCAST_SPLATINSERT]], <2 x double> poison, <2 x i32> zeroinitializer425; CHECK-NEXT: [[BROADCAST_SPLATINSERT1:%.*]] = insertelement <2 x double> poison, double [[X]], i64 0426; CHECK-NEXT: [[BROADCAST_SPLAT2:%.*]] = shufflevector <2 x double> [[BROADCAST_SPLATINSERT1]], <2 x double> poison, <2 x i32> zeroinitializer427; CHECK-NEXT: br label %[[VECTOR_BODY:.*]]428; CHECK: [[VECTOR_BODY]]:429; CHECK-NEXT: [[INDEX:%.*]] = phi i64 [ 0, %[[VECTOR_PH]] ], [ [[INDEX_NEXT:%.*]], %[[VECTOR_BODY]] ]430; CHECK-NEXT: [[TMP0:%.*]] = add i64 [[INDEX]], 2431; CHECK-NEXT: [[TMP1:%.*]] = getelementptr inbounds nuw { double, double }, ptr [[A]], i64 [[INDEX]]432; CHECK-NEXT: [[TMP2:%.*]] = getelementptr inbounds nuw { double, double }, ptr [[A]], i64 [[TMP0]]433; CHECK-NEXT: [[WIDE_VEC:%.*]] = load <4 x double>, ptr [[TMP1]], align 4434; CHECK-NEXT: [[STRIDED_VEC:%.*]] = shufflevector <4 x double> [[WIDE_VEC]], <4 x double> poison, <2 x i32> <i32 0, i32 2>435; CHECK-NEXT: [[STRIDED_VEC3:%.*]] = shufflevector <4 x double> [[WIDE_VEC]], <4 x double> poison, <2 x i32> <i32 1, i32 3>436; CHECK-NEXT: [[WIDE_VEC4:%.*]] = load <4 x double>, ptr [[TMP2]], align 4437; CHECK-NEXT: [[STRIDED_VEC5:%.*]] = shufflevector <4 x double> [[WIDE_VEC4]], <4 x double> poison, <2 x i32> <i32 0, i32 2>438; CHECK-NEXT: [[STRIDED_VEC6:%.*]] = shufflevector <4 x double> [[WIDE_VEC4]], <4 x double> poison, <2 x i32> <i32 1, i32 3>439; CHECK-NEXT: [[TMP3:%.*]] = fadd <2 x double> [[BROADCAST_SPLAT]], [[STRIDED_VEC]]440; CHECK-NEXT: [[TMP4:%.*]] = fadd <2 x double> [[BROADCAST_SPLAT]], [[STRIDED_VEC5]]441; CHECK-NEXT: [[TMP5:%.*]] = fadd <2 x double> [[BROADCAST_SPLAT2]], [[STRIDED_VEC3]]442; CHECK-NEXT: [[TMP6:%.*]] = fadd <2 x double> [[BROADCAST_SPLAT2]], [[STRIDED_VEC6]]443; CHECK-NEXT: [[TMP7:%.*]] = getelementptr inbounds nuw { double, double }, ptr [[RES]], i64 [[INDEX]]444; CHECK-NEXT: [[TMP8:%.*]] = getelementptr inbounds nuw { double, double }, ptr [[RES]], i64 [[TMP0]]445; CHECK-NEXT: [[TMP9:%.*]] = shufflevector <2 x double> [[TMP3]], <2 x double> [[TMP5]], <4 x i32> <i32 0, i32 1, i32 2, i32 3>446; CHECK-NEXT: [[INTERLEAVED_VEC:%.*]] = shufflevector <4 x double> [[TMP9]], <4 x double> poison, <4 x i32> <i32 0, i32 2, i32 1, i32 3>447; CHECK-NEXT: store <4 x double> [[INTERLEAVED_VEC]], ptr [[TMP7]], align 4448; CHECK-NEXT: [[TMP10:%.*]] = shufflevector <2 x double> [[TMP4]], <2 x double> [[TMP6]], <4 x i32> <i32 0, i32 1, i32 2, i32 3>449; CHECK-NEXT: [[INTERLEAVED_VEC7:%.*]] = shufflevector <4 x double> [[TMP10]], <4 x double> poison, <4 x i32> <i32 0, i32 2, i32 1, i32 3>450; CHECK-NEXT: store <4 x double> [[INTERLEAVED_VEC7]], ptr [[TMP8]], align 4451; CHECK-NEXT: [[INDEX_NEXT]] = add nuw i64 [[INDEX]], 4452; CHECK-NEXT: [[TMP11:%.*]] = icmp eq i64 [[INDEX_NEXT]], 100453; CHECK-NEXT: br i1 [[TMP11]], label %[[MIDDLE_BLOCK:.*]], label %[[VECTOR_BODY]], !llvm.loop [[LOOP16:![0-9]+]]454; CHECK: [[MIDDLE_BLOCK]]:455; CHECK-NEXT: br [[EXIT:label %.*]]456; CHECK: [[SCALAR_PH:.*:]]457;458entry:459 br label %loop460 461loop:462 %iv = phi i64 [ 0, %entry ], [ %iv.next, %loop ]463 %gep.A.0 = getelementptr inbounds nuw { double, double }, ptr %A, i64 %iv464 %l.A.0 = load double, ptr %gep.A.0, align 4465 %gep.A.1 = getelementptr inbounds nuw i8, ptr %gep.A.0, i64 8466 %l.A.1 = load double, ptr %gep.A.1, align 4467 %add.0 = fadd double %y, %l.A.0468 %add.1 = fadd double %x, %l.A.1469 %gep.res.0 = getelementptr inbounds nuw { double, double }, ptr %res, i64 %iv470 store double %add.0, ptr %gep.res.0, align 4471 %gep.res.1 = getelementptr inbounds nuw i8, ptr %gep.res.0, i64 8472 store double %add.1, ptr %gep.res.1, align 4473 %iv.next = add nuw nsw i64 %iv, 1474 %ec = icmp eq i64 %iv.next, 100475 br i1 %ec, label %exit, label %loop476 477exit:478 ret void479}480