1 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
2 ; RUN: opt < %s -passes=slp-vectorizer -S -mtriple=aarch64-w32-windows-gnu | FileCheck %s
4 define i32 @foo(i32 %v1, double %v2, i1 %arg, i32 %arg2) {
7 ; CHECK-NEXT: [[TMP0:%.*]] = insertelement <2 x i32> <i32 poison, i32 undef>, i32 [[V1:%.*]], i32 0
8 ; CHECK-NEXT: [[TMP1:%.*]] = sitofp <2 x i32> [[TMP0]] to <2 x double>
9 ; CHECK-NEXT: [[TMP2:%.*]] = shufflevector <2 x double> [[TMP1]], <2 x double> poison, <4 x i32> <i32 1, i32 0, i32 1, i32 0>
10 ; CHECK-NEXT: br label [[FOR_COND15_PREHEADER:%.*]]
11 ; CHECK: for.cond15.preheader:
12 ; CHECK-NEXT: br label [[IF_END:%.*]]
14 ; CHECK-NEXT: br label [[IF_END_1:%.*]]
16 ; CHECK-NEXT: br label [[FOR_COND15:%.*]]
18 ; CHECK-NEXT: switch i32 %arg2, label [[DO_BODY:%.*]] [
19 ; CHECK-NEXT: i32 0, label [[SW_BB:%.*]]
20 ; CHECK-NEXT: i32 1, label [[SW_BB195:%.*]]
23 ; CHECK-NEXT: [[ARRAYIDX43:%.*]] = getelementptr inbounds [4 x [2 x double]], ptr undef, i32 0, i64 1, i64 0
24 ; CHECK-NEXT: [[TMP3:%.*]] = insertelement <2 x double> <double poison, double undef>, double [[V2:%.*]], i32 0
25 ; CHECK-NEXT: [[TMP4:%.*]] = fmul <2 x double> [[TMP3]], [[TMP1]]
26 ; CHECK-NEXT: [[TMP5:%.*]] = shufflevector <2 x double> [[TMP4]], <2 x double> poison, <4 x i32> <i32 0, i32 0, i32 1, i32 1>
27 ; CHECK-NEXT: [[TMP6:%.*]] = load <4 x double>, ptr [[ARRAYIDX43]], align 8
28 ; CHECK-NEXT: [[TMP7:%.*]] = fmul <4 x double> [[TMP6]], [[TMP5]]
29 ; CHECK-NEXT: [[TMP8:%.*]] = shufflevector <4 x double> [[TMP7]], <4 x double> poison, <4 x i32> <i32 3, i32 1, i32 2, i32 0>
30 ; CHECK-NEXT: [[TMP9:%.*]] = call <4 x double> @llvm.fmuladd.v4f64(<4 x double> undef, <4 x double> [[TMP2]], <4 x double> [[TMP8]])
31 ; CHECK-NEXT: br label [[SW_EPILOG:%.*]]
33 ; CHECK-NEXT: br label [[SW_EPILOG]]
35 ; CHECK-NEXT: unreachable
37 ; CHECK-NEXT: [[TMP10:%.*]] = phi <4 x double> [ undef, [[SW_BB195]] ], [ [[TMP9]], [[SW_BB]] ]
38 ; CHECK-NEXT: ret i32 undef
40 ; CHECK-NEXT: br label [[FOR_COND15_1:%.*]]
41 ; CHECK: for.cond15.1:
42 ; CHECK-NEXT: br i1 %arg, label [[FOR_END39:%.*]], label [[FOR_COND15_PREHEADER]]
45 %conv = sitofp i32 undef to double
46 %conv2 = sitofp i32 %v1 to double
47 br label %for.cond15.preheader
49 for.cond15.preheader: ; preds = %for.cond15.1, %entry
52 for.cond15: ; preds = %if.end
55 if.end: ; preds = %for.cond15.preheader
58 for.end39: ; preds = %for.cond15.1
59 switch i32 %arg2, label %do.body [
61 i32 1, label %sw.bb195
64 sw.bb: ; preds = %for.end39
65 %arrayidx43 = getelementptr inbounds [4 x [2 x double]], ptr undef, i32 0, i64 1, i64 0
66 %0 = load double, ptr %arrayidx43, align 8
67 %arrayidx45 = getelementptr inbounds [4 x [2 x double]], ptr undef, i32 0, i64 2, i64 0
68 %1 = load double, ptr %arrayidx45, align 8
69 %arrayidx51 = getelementptr inbounds [4 x [2 x double]], ptr undef, i32 0, i64 2, i64 1
70 %2 = load double, ptr %arrayidx51, align 8
71 %arrayidx58 = getelementptr inbounds [4 x [2 x double]], ptr undef, i32 0, i64 1, i64 1
72 %3 = load double, ptr %arrayidx58, align 8
73 %mul = fmul double %v2, %conv2
74 %mul109 = fmul double undef, %conv
75 %mul143 = fmul double %0, %mul
76 %4 = call double @llvm.fmuladd.f64(double undef, double %conv2, double %mul143)
77 %mul154 = fmul double %1, %mul109
78 %5 = call double @llvm.fmuladd.f64(double undef, double %conv, double %mul154)
79 %mul172 = fmul double %3, %mul
80 %6 = call double @llvm.fmuladd.f64(double undef, double %conv2, double %mul172)
81 %mul183 = fmul double %2, %mul109
82 %7 = call double @llvm.fmuladd.f64(double undef, double %conv, double %mul183)
85 sw.bb195: ; preds = %for.end39
88 do.body: ; preds = %for.end39
91 sw.epilog: ; preds = %sw.bb195, %sw.bb
92 %x4.0 = phi double [ undef, %sw.bb195 ], [ %7, %sw.bb ]
93 %x3.0 = phi double [ undef, %sw.bb195 ], [ %6, %sw.bb ]
94 %x1.0 = phi double [ undef, %sw.bb195 ], [ %5, %sw.bb ]
95 %x0.0 = phi double [ undef, %sw.bb195 ], [ %4, %sw.bb ]
98 if.end.1: ; preds = %for.cond15
99 br label %for.cond15.1
101 for.cond15.1: ; preds = %if.end.1
102 br i1 %arg, label %for.end39, label %for.cond15.preheader
105 declare double @llvm.fmuladd.f64(double, double, double)