1; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
2; RUN: opt -slp-vectorizer -S -mcpu=cascadelake -mtriple=x86_64-unknown-linux-gnu < %s | FileCheck %s
3
4define void @foo() {
5; CHECK-LABEL: @foo(
6; CHECK-NEXT:  entry:
7; CHECK-NEXT:    [[CONV:%.*]] = uitofp i16 undef to float
8; CHECK-NEXT:    [[SUB:%.*]] = fsub float 6.553500e+04, undef
9; CHECK-NEXT:    br label [[BB1:%.*]]
10; CHECK:       bb1:
11; CHECK-NEXT:    [[TMP0:%.*]] = insertelement <4 x float> poison, float [[SUB]], i32 0
12; CHECK-NEXT:    [[TMP1:%.*]] = insertelement <4 x float> [[TMP0]], float [[CONV]], i32 1
13; CHECK-NEXT:    br label [[BB2:%.*]]
14; CHECK:       bb2:
15; CHECK-NEXT:    [[TMP2:%.*]] = phi <4 x float> [ [[TMP1]], [[BB1]] ], [ [[TMP14:%.*]], [[BB3:%.*]] ]
16; CHECK-NEXT:    [[TMP3:%.*]] = load double, double* undef, align 8
17; CHECK-NEXT:    br i1 undef, label [[BB3]], label [[BB4:%.*]]
18; CHECK:       bb4:
19; CHECK-NEXT:    [[TMP4:%.*]] = fpext <4 x float> [[TMP2]] to <4 x double>
20; CHECK-NEXT:    [[CONV2:%.*]] = uitofp i16 undef to double
21; CHECK-NEXT:    [[TMP5:%.*]] = insertelement <2 x double> <double undef, double poison>, double [[TMP3]], i32 1
22; CHECK-NEXT:    [[TMP6:%.*]] = insertelement <2 x double> <double undef, double poison>, double [[CONV2]], i32 1
23; CHECK-NEXT:    [[TMP7:%.*]] = fsub <2 x double> [[TMP5]], [[TMP6]]
24; CHECK-NEXT:    [[TMP8:%.*]] = fadd <2 x double> [[TMP5]], [[TMP6]]
25; CHECK-NEXT:    [[TMP9:%.*]] = shufflevector <2 x double> [[TMP7]], <2 x double> [[TMP8]], <2 x i32> <i32 0, i32 3>
26; CHECK-NEXT:    [[TMP10:%.*]] = shufflevector <2 x double> [[TMP9]], <2 x double> poison, <4 x i32> <i32 0, i32 1, i32 undef, i32 undef>
27; CHECK-NEXT:    [[TMP11:%.*]] = fcmp ogt <4 x double> [[TMP10]], [[TMP4]]
28; CHECK-NEXT:    [[TMP12:%.*]] = fptrunc <4 x double> [[TMP10]] to <4 x float>
29; CHECK-NEXT:    [[TMP13:%.*]] = select <4 x i1> [[TMP11]], <4 x float> [[TMP2]], <4 x float> [[TMP12]]
30; CHECK-NEXT:    br label [[BB3]]
31; CHECK:       bb3:
32; CHECK-NEXT:    [[TMP14]] = phi <4 x float> [ [[TMP13]], [[BB4]] ], [ [[TMP2]], [[BB2]] ]
33; CHECK-NEXT:    br label [[BB2]]
34;
35entry:
36  %conv = uitofp i16 undef to float
37  %sub = fsub float 6.553500e+04, undef
38  br label %bb1
39
40bb1:
41  br label %bb2
42
43bb2:
44  %0 = phi float [ %sub, %bb1 ], [ %9, %bb3 ]
45  %1 = phi float [ %conv, %bb1 ], [ %10, %bb3 ]
46  %2 = phi float [ undef, %bb1 ], [ %11, %bb3 ]
47  %3 = phi float [ undef, %bb1 ], [ %12, %bb3 ]
48  %4 = load double, double* undef, align 8
49  br i1 undef, label %bb3, label %bb4
50
51bb4:
52  %ext = fpext float %3 to double
53  %cmp1 = fcmp ogt double undef, %ext
54  %5 = fptrunc double undef to float
55  %sel1 = select i1 %cmp1, float %3, float %5
56  %ext2 = fpext float %2 to double
57  %cmp2 = fcmp ogt double undef, %ext2
58  %6 = fptrunc double undef to float
59  %sel2 = select i1 %cmp2, float %2, float %6
60  %ext3 = fpext float %1 to double
61  %conv2 = uitofp i16 undef to double
62  %add1 = fadd double %4, %conv2
63  %cmp3 = fcmp ogt double %add1, %ext3
64  %7 = fptrunc double %add1 to float
65  %sel3 = select i1 %cmp3, float %1, float %7
66  %ext4 = fpext float %0 to double
67  %sub1 = fsub double undef, undef
68  %cmp4 = fcmp ogt double %sub1, %ext4
69  %8 = fptrunc double %sub1 to float
70  %sel4 = select i1 %cmp4, float %0, float %8
71  br label %bb3
72
73bb3:
74  %9 = phi float [ %sel4, %bb4 ], [ %0, %bb2 ]
75  %10 = phi float [ %sel3, %bb4 ], [ %1, %bb2 ]
76  %11 = phi float [ %sel2, %bb4 ], [ %2, %bb2 ]
77  %12 = phi float [ %sel1, %bb4 ], [ %3, %bb2 ]
78  br label %bb2
79}
80