1 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
2 ; RUN: opt -slp-vectorizer -slp-vectorize-hor -slp-vectorize-hor-store -S < %s -mtriple=x86_64-unknown-linux-gnu -mcpu=haswell | FileCheck %s
3 target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128-ni:1"
5 define void @test() #0 {
8 ; CHECK-NEXT: br label [[LOOP:%.*]]
10 ; CHECK-NEXT: [[DUMMY_PHI:%.*]] = phi i64 [ 1, [[ENTRY:%.*]] ], [ [[OP_EXTRA3:%.*]], [[LOOP]] ]
11 ; CHECK-NEXT: [[TMP0:%.*]] = phi i64 [ 2, [[ENTRY]] ], [ [[TMP6:%.*]], [[LOOP]] ]
12 ; CHECK-NEXT: [[DUMMY_ADD:%.*]] = add i16 0, 0
13 ; CHECK-NEXT: [[TMP1:%.*]] = insertelement <4 x i64> undef, i64 [[TMP0]], i32 0
14 ; CHECK-NEXT: [[TMP2:%.*]] = insertelement <4 x i64> [[TMP1]], i64 [[TMP0]], i32 1
15 ; CHECK-NEXT: [[TMP3:%.*]] = insertelement <4 x i64> [[TMP2]], i64 [[TMP0]], i32 2
16 ; CHECK-NEXT: [[TMP4:%.*]] = insertelement <4 x i64> [[TMP3]], i64 [[TMP0]], i32 3
17 ; CHECK-NEXT: [[TMP5:%.*]] = add <4 x i64> [[TMP4]], <i64 3, i64 2, i64 1, i64 0>
18 ; CHECK-NEXT: [[TMP6]] = extractelement <4 x i64> [[TMP5]], i32 3
19 ; CHECK-NEXT: [[TMP7:%.*]] = extractelement <4 x i64> [[TMP5]], i32 0
20 ; CHECK-NEXT: [[DUMMY_SHL:%.*]] = shl i64 [[TMP7]], 32
21 ; CHECK-NEXT: [[TMP8:%.*]] = add <4 x i64> <i64 1, i64 1, i64 1, i64 1>, [[TMP5]]
22 ; CHECK-NEXT: [[TMP9:%.*]] = ashr exact <4 x i64> [[TMP8]], <i64 32, i64 32, i64 32, i64 32>
23 ; CHECK-NEXT: [[SUM1:%.*]] = add i64 undef, undef
24 ; CHECK-NEXT: [[SUM2:%.*]] = add i64 [[SUM1]], undef
25 ; CHECK-NEXT: [[ZSUM:%.*]] = add i64 [[SUM2]], 0
26 ; CHECK-NEXT: [[JOIN:%.*]] = add i64 [[TMP6]], [[ZSUM]]
27 ; CHECK-NEXT: [[RDX_SHUF:%.*]] = shufflevector <4 x i64> [[TMP9]], <4 x i64> undef, <4 x i32> <i32 2, i32 3, i32 undef, i32 undef>
28 ; CHECK-NEXT: [[BIN_RDX:%.*]] = add <4 x i64> [[TMP9]], [[RDX_SHUF]]
29 ; CHECK-NEXT: [[RDX_SHUF1:%.*]] = shufflevector <4 x i64> [[BIN_RDX]], <4 x i64> undef, <4 x i32> <i32 1, i32 undef, i32 undef, i32 undef>
30 ; CHECK-NEXT: [[BIN_RDX2:%.*]] = add <4 x i64> [[BIN_RDX]], [[RDX_SHUF1]]
31 ; CHECK-NEXT: [[TMP10:%.*]] = extractelement <4 x i64> [[BIN_RDX2]], i32 0
32 ; CHECK-NEXT: [[OP_EXTRA:%.*]] = add i64 [[TMP10]], 0
33 ; CHECK-NEXT: [[OP_EXTRA3]] = add i64 [[OP_EXTRA]], [[TMP6]]
34 ; CHECK-NEXT: [[LAST:%.*]] = add i64 [[JOIN]], undef
35 ; CHECK-NEXT: br label [[LOOP]]
41 %dummy_phi = phi i64 [ 1, %entry ], [ %last, %loop ]
42 %0 = phi i64 [ 2, %entry ], [ %fork, %loop ]
45 %inc11 = add i64 1, %inc1
46 %exact1 = ashr exact i64 %inc11, 32
48 %dummy_add = add i16 0, 0
49 %inc12 = add i64 1, %inc2
50 %exact2 = ashr exact i64 %inc12, 32
51 %dummy_shl = shl i64 %inc3, 32
52 %inc13 = add i64 1, %inc3
53 %exact3 = ashr exact i64 %inc13, 32
55 %sum1 = add i64 %exact3, %exact2
56 %sum2 = add i64 %sum1, %exact1
57 %zsum = add i64 %sum2, 0
58 %sext22 = add i64 1, %fork
59 %exact4 = ashr exact i64 %sext22, 32
60 %join = add i64 %fork, %zsum
61 %last = add i64 %join, %exact4