1 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
2 ; RUN: opt -slp-vectorizer -S -mtriple=x86_64-unknown-linux-gnu -mcpu=bdver2 < %s | FileCheck %s
4 target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
9 ; CHECK-NEXT: br i1 undef, label [[BB1:%.*]], label [[BB2:%.*]]
11 ; CHECK-NEXT: ret void
13 ; CHECK-NEXT: [[T:%.*]] = select i1 undef, i16 undef, i16 15
14 ; CHECK-NEXT: [[TMP0:%.*]] = insertelement <2 x i16> <i16 poison, i16 undef>, i16 [[T]], i32 0
15 ; CHECK-NEXT: [[TMP1:%.*]] = sext <2 x i16> [[TMP0]] to <2 x i32>
16 ; CHECK-NEXT: [[TMP2:%.*]] = sub nsw <2 x i32> <i32 undef, i32 63>, [[TMP1]]
17 ; CHECK-NEXT: [[TMP3:%.*]] = sub <2 x i32> [[TMP2]], undef
18 ; CHECK-NEXT: [[SHUFFLE10:%.*]] = shufflevector <2 x i32> [[TMP3]], <2 x i32> poison, <4 x i32> <i32 0, i32 0, i32 0, i32 1>
19 ; CHECK-NEXT: [[TMP4:%.*]] = add <4 x i32> [[SHUFFLE10]], <i32 15, i32 31, i32 47, i32 poison>
20 ; CHECK-NEXT: [[TMP5:%.*]] = call i32 @llvm.vector.reduce.smax.v4i32(<4 x i32> [[TMP4]])
21 ; CHECK-NEXT: [[T19:%.*]] = select i1 undef, i32 [[TMP5]], i32 undef
22 ; CHECK-NEXT: [[T20:%.*]] = icmp sgt i32 [[T19]], 63
23 ; CHECK-NEXT: [[TMP6:%.*]] = sub nsw <2 x i32> undef, [[TMP1]]
24 ; CHECK-NEXT: [[TMP7:%.*]] = sub <2 x i32> [[TMP6]], undef
25 ; CHECK-NEXT: [[SHUFFLE:%.*]] = shufflevector <2 x i32> [[TMP7]], <2 x i32> poison, <4 x i32> <i32 0, i32 1, i32 0, i32 1>
26 ; CHECK-NEXT: [[TMP8:%.*]] = add nsw <4 x i32> [[SHUFFLE]], <i32 -49, i32 -33, i32 -33, i32 -17>
27 ; CHECK-NEXT: [[TMP9:%.*]] = call i32 @llvm.vector.reduce.smin.v4i32(<4 x i32> [[TMP8]])
28 ; CHECK-NEXT: [[OP_EXTRA:%.*]] = icmp slt i32 [[TMP9]], undef
29 ; CHECK-NEXT: [[OP_EXTRA1:%.*]] = select i1 [[OP_EXTRA]], i32 [[TMP9]], i32 undef
30 ; CHECK-NEXT: [[OP_EXTRA2:%.*]] = icmp slt i32 [[OP_EXTRA1]], undef
31 ; CHECK-NEXT: [[OP_EXTRA3:%.*]] = select i1 [[OP_EXTRA2]], i32 [[OP_EXTRA1]], i32 undef
32 ; CHECK-NEXT: [[OP_EXTRA4:%.*]] = icmp slt i32 [[OP_EXTRA3]], undef
33 ; CHECK-NEXT: [[OP_EXTRA5:%.*]] = select i1 [[OP_EXTRA4]], i32 [[OP_EXTRA3]], i32 undef
34 ; CHECK-NEXT: [[OP_EXTRA6:%.*]] = icmp slt i32 [[OP_EXTRA5]], undef
35 ; CHECK-NEXT: [[OP_EXTRA7:%.*]] = select i1 [[OP_EXTRA6]], i32 [[OP_EXTRA5]], i32 undef
36 ; CHECK-NEXT: [[OP_EXTRA8:%.*]] = icmp slt i32 [[OP_EXTRA7]], undef
37 ; CHECK-NEXT: [[OP_EXTRA9:%.*]] = select i1 [[OP_EXTRA8]], i32 [[OP_EXTRA7]], i32 undef
38 ; CHECK-NEXT: [[T45:%.*]] = icmp sgt i32 undef, [[OP_EXTRA9]]
39 ; CHECK-NEXT: unreachable
42 br i1 undef, label %bb1, label %bb2
48 %t = select i1 undef, i16 undef, i16 15
49 %t3 = sext i16 undef to i32
50 %t4 = sext i16 %t to i32
51 %t5 = sub nsw i32 undef, %t4
52 %t6 = sub i32 %t5, undef
53 %t7 = sub nsw i32 63, %t3
54 %t8 = sub i32 %t7, undef
55 %t9 = add i32 %t8, undef
56 %t10 = add nsw i32 %t6, 15
57 %t11 = icmp sgt i32 %t9, %t10
58 %t12 = select i1 %t11, i32 %t9, i32 %t10
59 %t13 = add nsw i32 %t6, 31
60 %t14 = icmp sgt i32 %t12, %t13
61 %t15 = select i1 %t14, i32 %t12, i32 %t13
62 %t16 = add nsw i32 %t6, 47
63 %t17 = icmp sgt i32 %t15, %t16
64 %t18 = select i1 %t17, i32 %t15, i32 %t16
65 %t19 = select i1 undef, i32 %t18, i32 undef
66 %t20 = icmp sgt i32 %t19, 63
67 %t21 = sub nsw i32 undef, %t3
68 %t22 = sub i32 %t21, undef
69 %t23 = sub nsw i32 undef, %t4
70 %t24 = sub i32 %t23, undef
71 %t25 = add nsw i32 %t24, -49
72 %t26 = icmp sgt i32 %t25, undef
73 %t27 = select i1 %t26, i32 undef, i32 %t25
74 %t28 = icmp sgt i32 %t27, undef
75 %t29 = select i1 %t28, i32 undef, i32 %t27
76 %t30 = add nsw i32 %t22, -33
77 %t31 = icmp sgt i32 %t30, undef
78 %t32 = select i1 %t31, i32 undef, i32 %t30
79 %t33 = icmp sgt i32 %t32, %t29
80 %t34 = select i1 %t33, i32 %t29, i32 %t32
81 %t35 = add nsw i32 %t24, -33
82 %t36 = icmp sgt i32 %t35, undef
83 %t37 = select i1 %t36, i32 undef, i32 %t35
84 %t38 = icmp sgt i32 %t37, %t34
85 %t39 = select i1 %t38, i32 %t34, i32 %t37
86 %t40 = add nsw i32 %t22, -17
87 %t41 = icmp sgt i32 %t40, undef
88 %t42 = select i1 %t41, i32 undef, i32 %t40
89 %t43 = icmp sgt i32 %t42, %t39
90 %t44 = select i1 %t43, i32 %t39, i32 %t42
91 %t45 = icmp sgt i32 undef, %t44