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]] ], [ [[TMP18:%.*]], [[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:    [[CONV2:%.*]] = uitofp i16 undef to double
20; CHECK-NEXT:    [[TMP4:%.*]] = fpext <4 x float> [[TMP2]] to <4 x 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:%.*]] = extractelement <2 x double> [[TMP9]], i32 0
27; CHECK-NEXT:    [[TMP11:%.*]] = insertelement <4 x double> poison, double [[TMP10]], i32 0
28; CHECK-NEXT:    [[TMP12:%.*]] = extractelement <2 x double> [[TMP9]], i32 1
29; CHECK-NEXT:    [[TMP13:%.*]] = insertelement <4 x double> [[TMP11]], double [[TMP12]], i32 1
30; CHECK-NEXT:    [[TMP14:%.*]] = fcmp ogt <4 x double> [[TMP13]], [[TMP4]]
31; CHECK-NEXT:    [[TMP15:%.*]] = shufflevector <2 x double> [[TMP9]], <2 x double> poison, <4 x i32> <i32 0, i32 1, i32 undef, i32 undef>
32; CHECK-NEXT:    [[TMP16:%.*]] = fptrunc <4 x double> [[TMP15]] to <4 x float>
33; CHECK-NEXT:    [[TMP17:%.*]] = select <4 x i1> [[TMP14]], <4 x float> [[TMP2]], <4 x float> [[TMP16]]
34; CHECK-NEXT:    br label [[BB3]]
35; CHECK:       bb3:
36; CHECK-NEXT:    [[TMP18]] = phi <4 x float> [ [[TMP17]], [[BB4]] ], [ [[TMP2]], [[BB2]] ]
37; CHECK-NEXT:    br label [[BB2]]
38;
39entry:
40  %conv = uitofp i16 undef to float
41  %sub = fsub float 6.553500e+04, undef
42  br label %bb1
43
44bb1:
45  br label %bb2
46
47bb2:
48  %0 = phi float [ %sub, %bb1 ], [ %9, %bb3 ]
49  %1 = phi float [ %conv, %bb1 ], [ %10, %bb3 ]
50  %2 = phi float [ undef, %bb1 ], [ %11, %bb3 ]
51  %3 = phi float [ undef, %bb1 ], [ %12, %bb3 ]
52  %4 = load double, double* undef, align 8
53  br i1 undef, label %bb3, label %bb4
54
55bb4:
56  %ext = fpext float %3 to double
57  %cmp1 = fcmp ogt double undef, %ext
58  %5 = fptrunc double undef to float
59  %sel1 = select i1 %cmp1, float %3, float %5
60  %ext2 = fpext float %2 to double
61  %cmp2 = fcmp ogt double undef, %ext2
62  %6 = fptrunc double undef to float
63  %sel2 = select i1 %cmp2, float %2, float %6
64  %ext3 = fpext float %1 to double
65  %conv2 = uitofp i16 undef to double
66  %add1 = fadd double %4, %conv2
67  %cmp3 = fcmp ogt double %add1, %ext3
68  %7 = fptrunc double %add1 to float
69  %sel3 = select i1 %cmp3, float %1, float %7
70  %ext4 = fpext float %0 to double
71  %sub1 = fsub double undef, undef
72  %cmp4 = fcmp ogt double %sub1, %ext4
73  %8 = fptrunc double %sub1 to float
74  %sel4 = select i1 %cmp4, float %0, float %8
75  br label %bb3
76
77bb3:
78  %9 = phi float [ %sel4, %bb4 ], [ %0, %bb2 ]
79  %10 = phi float [ %sel3, %bb4 ], [ %1, %bb2 ]
80  %11 = phi float [ %sel2, %bb4 ], [ %2, %bb2 ]
81  %12 = phi float [ %sel1, %bb4 ], [ %3, %bb2 ]
82  br label %bb2
83}
84