Revert r354244 "[DAGCombiner] Eliminate dead stores to stack."
[llvm-complete.git] / test / Transforms / SLPVectorizer / X86 / PR40310.ll
blobad1434146a5b3626cb1ecc6343a7439d414d3d61
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=skylake < %s | FileCheck %s
4 define void @mainTest(i32 %param, i32 * %vals, i32 %len) {
5 ; CHECK-LABEL: @mainTest(
6 ; CHECK-NEXT:  bci_15.preheader:
7 ; CHECK-NEXT:    [[TMP0:%.*]] = insertelement <2 x i32> <i32 31, i32 undef>, i32 [[PARAM:%.*]], i32 1
8 ; CHECK-NEXT:    br label [[BCI_15:%.*]]
9 ; CHECK:       bci_15:
10 ; CHECK-NEXT:    [[TMP1:%.*]] = phi <2 x i32> [ [[TMP7:%.*]], [[BCI_15]] ], [ [[TMP0]], [[BCI_15_PREHEADER:%.*]] ]
11 ; CHECK-NEXT:    [[SHUFFLE:%.*]] = shufflevector <2 x i32> [[TMP1]], <2 x i32> undef, <16 x i32> <i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 1>
12 ; CHECK-NEXT:    [[TMP2:%.*]] = extractelement <16 x i32> [[SHUFFLE]], i32 0
13 ; CHECK-NEXT:    [[TMP3:%.*]] = extractelement <16 x i32> [[SHUFFLE]], i32 15
14 ; CHECK-NEXT:    store atomic i32 [[TMP3]], i32* [[VALS:%.*]] unordered, align 4
15 ; CHECK-NEXT:    [[TMP4:%.*]] = add <16 x i32> <i32 15, i32 14, i32 13, i32 12, i32 11, i32 10, i32 9, i32 8, i32 7, i32 6, i32 5, i32 4, i32 3, i32 2, i32 1, i32 -1>, [[SHUFFLE]]
16 ; CHECK-NEXT:    [[V14:%.*]] = and i32 [[TMP2]], undef
17 ; CHECK-NEXT:    [[V16:%.*]] = and i32 undef, [[V14]]
18 ; CHECK-NEXT:    [[V18:%.*]] = and i32 undef, [[V16]]
19 ; CHECK-NEXT:    [[V20:%.*]] = and i32 undef, [[V18]]
20 ; CHECK-NEXT:    [[V22:%.*]] = and i32 undef, [[V20]]
21 ; CHECK-NEXT:    [[V24:%.*]] = and i32 undef, [[V22]]
22 ; CHECK-NEXT:    [[V26:%.*]] = and i32 undef, [[V24]]
23 ; CHECK-NEXT:    [[V28:%.*]] = and i32 undef, [[V26]]
24 ; CHECK-NEXT:    [[V30:%.*]] = and i32 undef, [[V28]]
25 ; CHECK-NEXT:    [[V32:%.*]] = and i32 undef, [[V30]]
26 ; CHECK-NEXT:    [[V34:%.*]] = and i32 undef, [[V32]]
27 ; CHECK-NEXT:    [[V36:%.*]] = and i32 undef, [[V34]]
28 ; CHECK-NEXT:    [[V38:%.*]] = and i32 undef, [[V36]]
29 ; CHECK-NEXT:    [[V40:%.*]] = and i32 undef, [[V38]]
30 ; CHECK-NEXT:    [[V42:%.*]] = and i32 undef, [[V40]]
31 ; CHECK-NEXT:    [[RDX_SHUF:%.*]] = shufflevector <16 x i32> [[TMP4]], <16 x i32> undef, <16 x i32> <i32 8, i32 9, i32 10, i32 11, i32 12, i32 13, i32 14, i32 15, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef>
32 ; CHECK-NEXT:    [[BIN_RDX:%.*]] = and <16 x i32> [[TMP4]], [[RDX_SHUF]]
33 ; CHECK-NEXT:    [[RDX_SHUF1:%.*]] = shufflevector <16 x i32> [[BIN_RDX]], <16 x i32> undef, <16 x i32> <i32 4, i32 5, i32 6, i32 7, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef>
34 ; CHECK-NEXT:    [[BIN_RDX2:%.*]] = and <16 x i32> [[BIN_RDX]], [[RDX_SHUF1]]
35 ; CHECK-NEXT:    [[RDX_SHUF3:%.*]] = shufflevector <16 x i32> [[BIN_RDX2]], <16 x i32> undef, <16 x i32> <i32 2, i32 3, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef>
36 ; CHECK-NEXT:    [[BIN_RDX4:%.*]] = and <16 x i32> [[BIN_RDX2]], [[RDX_SHUF3]]
37 ; CHECK-NEXT:    [[RDX_SHUF5:%.*]] = shufflevector <16 x i32> [[BIN_RDX4]], <16 x i32> undef, <16 x i32> <i32 1, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef>
38 ; CHECK-NEXT:    [[BIN_RDX6:%.*]] = and <16 x i32> [[BIN_RDX4]], [[RDX_SHUF5]]
39 ; CHECK-NEXT:    [[TMP5:%.*]] = extractelement <16 x i32> [[BIN_RDX6]], i32 0
40 ; CHECK-NEXT:    [[OP_EXTRA:%.*]] = and i32 [[TMP5]], [[TMP2]]
41 ; CHECK-NEXT:    [[V43:%.*]] = and i32 undef, [[V42]]
42 ; CHECK-NEXT:    [[V44:%.*]] = add i32 [[TMP2]], 16
43 ; CHECK-NEXT:    [[TMP6:%.*]] = insertelement <2 x i32> undef, i32 [[V44]], i32 0
44 ; CHECK-NEXT:    [[TMP7]] = insertelement <2 x i32> [[TMP6]], i32 [[OP_EXTRA]], i32 1
45 ; CHECK-NEXT:    br i1 true, label [[BCI_15]], label [[LOOPEXIT:%.*]]
46 ; CHECK:       loopexit:
47 ; CHECK-NEXT:    ret void
49 bci_15.preheader:
50   br label %bci_15
52 bci_15:                                       ; preds = %bci_15.preheader, %bci_15
53   %local_0_ = phi i32 [ %v43, %bci_15 ], [ %param, %bci_15.preheader ]
54   %local_4_ = phi i32 [ %v44, %bci_15 ], [ 31, %bci_15.preheader ]
55   %v12 = add i32 %local_0_, -1
56   store atomic i32 %local_0_, i32 * %vals unordered, align 4
57   %v13 = add i32 %local_4_, 1
58   %v14 = and i32 %local_4_, %v12
59   %v15 = add i32 %local_4_, 2
60   %v16 = and i32 %v13, %v14
61   %v17 = add i32 %local_4_, 3
62   %v18 = and i32 %v15, %v16
63   %v19 = add i32 %local_4_, 4
64   %v20 = and i32 %v17, %v18
65   %v21 = add i32 %local_4_, 5
66   %v22 = and i32 %v19, %v20
67   %v23 = add i32 %local_4_, 6
68   %v24 = and i32 %v21, %v22
69   %v25 = add i32 %local_4_, 7
70   %v26 = and i32 %v23, %v24
71   %v27 = add i32 %local_4_, 8
72   %v28 = and i32 %v25, %v26
73   %v29 = add i32 %local_4_, 9
74   %v30 = and i32 %v27, %v28
75   %v31 = add i32 %local_4_, 10
76   %v32 = and i32 %v29, %v30
77   %v33 = add i32 %local_4_, 11
78   %v34 = and i32 %v31, %v32
79   %v35 = add i32 %local_4_, 12
80   %v36 = and i32 %v33, %v34
81   %v37 = add i32 %local_4_, 13
82   %v38 = and i32 %v35, %v36
83   %v39 = add i32 %local_4_, 14
84   %v40 = and i32 %v37, %v38
85   %v41 = add i32 %local_4_, 15
86   %v42 = and i32 %v39, %v40
87   %v43 = and i32 %v41, %v42
88   %v44 = add i32 %local_4_, 16
89   br i1 true, label %bci_15, label %loopexit
91 loopexit:
92   ret void