1 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
2 ; RUN: opt -passes=slp-vectorizer -S < %s -mtriple=x86_64-unknown-linux-gnu -mcpu=skylake -slp-threshold=-4 | FileCheck %s --check-prefix=CHECK
3 ; RUN: opt -passes=slp-vectorizer -S < %s -mtriple=x86_64-unknown-linux-gnu -mcpu=skylake -slp-threshold=-4 -slp-min-tree-size=5 | FileCheck %s --check-prefix=FORCE_REDUCTION
5 define void @Test(i32) {
8 ; CHECK-NEXT: br label [[LOOP:%.*]]
10 ; CHECK-NEXT: [[LOCAL_8_43_US:%.*]] = phi i32 [ [[VAL_43:%.*]], [[LOOP]] ], [ 0, [[ENTRY:%.*]] ]
11 ; CHECK-NEXT: [[TMP1:%.*]] = phi <2 x i32> [ [[TMP6:%.*]], [[LOOP]] ], [ zeroinitializer, [[ENTRY]] ]
12 ; CHECK-NEXT: [[TMP2:%.*]] = shufflevector <2 x i32> [[TMP1]], <2 x i32> poison, <8 x i32> <i32 0, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1>
13 ; CHECK-NEXT: [[TMP3:%.*]] = add <8 x i32> [[TMP2]], <i32 0, i32 55, i32 285, i32 1240, i32 1496, i32 8555, i32 12529, i32 13685>
14 ; CHECK-NEXT: [[TMP4:%.*]] = call i32 @llvm.vector.reduce.and.v8i32(<8 x i32> [[TMP3]])
15 ; CHECK-NEXT: [[OP_RDX:%.*]] = and i32 [[TMP0:%.*]], [[TMP4]]
16 ; CHECK-NEXT: [[OP_RDX1:%.*]] = and i32 [[OP_RDX]], [[LOCAL_8_43_US]]
17 ; CHECK-NEXT: [[VAL_43]] = add i32 [[LOCAL_8_43_US]], 14910
18 ; CHECK-NEXT: [[TMP5:%.*]] = insertelement <2 x i32> poison, i32 [[OP_RDX1]], i32 0
19 ; CHECK-NEXT: [[TMP6]] = insertelement <2 x i32> [[TMP5]], i32 [[VAL_43]], i32 1
20 ; CHECK-NEXT: br label [[LOOP]]
22 ; FORCE_REDUCTION-LABEL: @Test(
23 ; FORCE_REDUCTION-NEXT: entry:
24 ; FORCE_REDUCTION-NEXT: br label [[LOOP:%.*]]
25 ; FORCE_REDUCTION: loop:
26 ; FORCE_REDUCTION-NEXT: [[LOCAL_8_43_US:%.*]] = phi i32 [ [[VAL_43:%.*]], [[LOOP]] ], [ 0, [[ENTRY:%.*]] ]
27 ; FORCE_REDUCTION-NEXT: [[TMP1:%.*]] = phi <2 x i32> [ [[TMP6:%.*]], [[LOOP]] ], [ zeroinitializer, [[ENTRY]] ]
28 ; FORCE_REDUCTION-NEXT: [[TMP2:%.*]] = shufflevector <2 x i32> [[TMP1]], <2 x i32> poison, <8 x i32> <i32 0, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1>
29 ; FORCE_REDUCTION-NEXT: [[TMP3:%.*]] = add <8 x i32> [[TMP2]], <i32 0, i32 55, i32 285, i32 1240, i32 1496, i32 8555, i32 12529, i32 13685>
30 ; FORCE_REDUCTION-NEXT: [[TMP4:%.*]] = call i32 @llvm.vector.reduce.and.v8i32(<8 x i32> [[TMP3]])
31 ; FORCE_REDUCTION-NEXT: [[OP_RDX:%.*]] = and i32 [[TMP0:%.*]], [[TMP4]]
32 ; FORCE_REDUCTION-NEXT: [[OP_RDX1:%.*]] = and i32 [[OP_RDX]], [[LOCAL_8_43_US]]
33 ; FORCE_REDUCTION-NEXT: [[VAL_43]] = add i32 [[LOCAL_8_43_US]], 14910
34 ; FORCE_REDUCTION-NEXT: [[TMP5:%.*]] = insertelement <2 x i32> poison, i32 [[OP_RDX1]], i32 0
35 ; FORCE_REDUCTION-NEXT: [[TMP6]] = insertelement <2 x i32> [[TMP5]], i32 [[VAL_43]], i32 1
36 ; FORCE_REDUCTION-NEXT: br label [[LOOP]]
42 %local_4_39.us = phi i32 [ %val_42, %loop ], [ 0, %entry ]
43 %local_8_43.us = phi i32 [ %val_43, %loop ], [ 0, %entry ]
44 %val_0 = add i32 %local_4_39.us, 0
45 %val_1 = and i32 %local_8_43.us, %val_0
46 %val_2 = and i32 %val_1, %0
47 %val_3 = and i32 %val_2, %0
48 %val_4 = and i32 %val_3, %0
49 %val_5 = and i32 %val_4, %0
50 %val_6 = add i32 %local_8_43.us, 55
51 %val_7 = and i32 %val_5, %val_6
52 %val_8 = and i32 %val_7, %0
53 %val_9 = and i32 %val_8, %0
54 %val_10 = and i32 %val_9, %0
55 %val_11 = add i32 %local_8_43.us, 285
56 %val_12 = and i32 %val_10, %val_11
57 %val_13 = and i32 %val_12, %0
58 %val_14 = and i32 %val_13, %0
59 %val_15 = and i32 %val_14, %0
60 %val_16 = and i32 %val_15, %0
61 %val_17 = and i32 %val_16, %0
62 %val_18 = add i32 %local_8_43.us, 1240
63 %val_19 = and i32 %val_17, %val_18
64 %val_20 = add i32 %local_8_43.us, 1496
65 %val_21 = and i32 %val_19, %val_20
66 %val_22 = and i32 %val_21, %0
67 %val_23 = and i32 %val_22, %0
68 %val_24 = and i32 %val_23, %0
69 %val_25 = and i32 %val_24, %0
70 %val_26 = and i32 %val_25, %0
71 %val_27 = and i32 %val_26, %0
72 %val_28 = and i32 %val_27, %0
73 %val_29 = and i32 %val_28, %0
74 %val_30 = and i32 %val_29, %0
75 %val_31 = and i32 %val_30, %0
76 %val_32 = and i32 %val_31, %0
77 %val_33 = and i32 %val_32, %0
78 %val_34 = add i32 %local_8_43.us, 8555
79 %val_35 = and i32 %val_33, %val_34
80 %val_36 = and i32 %val_35, %0
81 %val_37 = and i32 %val_36, %0
82 %val_38 = and i32 %val_37, %0
83 %val_39 = add i32 %local_8_43.us, 12529
84 %val_40 = and i32 %val_38, %val_39
85 %val_41 = add i32 %local_8_43.us, 13685
86 %val_42 = and i32 %val_40, %val_41
87 %val_43 = add i32 %local_8_43.us, 14910