1 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
2 ; RUN: opt -passes=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_RDX1:%.*]], [[LOOP]] ]
11 ; CHECK-NEXT: [[TMP0:%.*]] = phi i64 [ 2, [[ENTRY]] ], [ [[TMP4:%.*]], [[LOOP]] ]
12 ; CHECK-NEXT: [[TMP1:%.*]] = insertelement <4 x i64> poison, i64 [[TMP0]], i32 0
13 ; CHECK-NEXT: [[TMP2:%.*]] = shufflevector <4 x i64> [[TMP1]], <4 x i64> poison, <4 x i32> zeroinitializer
14 ; CHECK-NEXT: [[TMP3:%.*]] = add <4 x i64> [[TMP2]], <i64 3, i64 2, i64 1, i64 0>
15 ; CHECK-NEXT: [[TMP4]] = extractelement <4 x i64> [[TMP3]], i32 3
16 ; CHECK-NEXT: [[DUMMY_ADD:%.*]] = add i16 0, 0
17 ; CHECK-NEXT: [[TMP5:%.*]] = extractelement <4 x i64> [[TMP3]], i32 0
18 ; CHECK-NEXT: [[DUMMY_SHL:%.*]] = shl i64 [[TMP5]], 32
19 ; CHECK-NEXT: [[TMP6:%.*]] = add <4 x i64> splat (i64 1), [[TMP3]]
20 ; CHECK-NEXT: [[TMP7:%.*]] = ashr exact <4 x i64> [[TMP6]], splat (i64 32)
21 ; CHECK-NEXT: [[TMP8:%.*]] = call i64 @llvm.vector.reduce.add.v4i64(<4 x i64> [[TMP7]])
22 ; CHECK-NEXT: [[OP_RDX:%.*]] = add i64 [[TMP8]], [[TMP4]]
23 ; CHECK-NEXT: [[OP_RDX1]] = add i64 [[OP_RDX]], 0
24 ; CHECK-NEXT: br label [[LOOP]]
30 %dummy_phi = phi i64 [ 1, %entry ], [ %last, %loop ]
31 %0 = phi i64 [ 2, %entry ], [ %fork, %loop ]
34 %inc11 = add i64 1, %inc1
35 %exact1 = ashr exact i64 %inc11, 32
37 %dummy_add = add i16 0, 0
38 %inc12 = add i64 1, %inc2
39 %exact2 = ashr exact i64 %inc12, 32
40 %dummy_shl = shl i64 %inc3, 32
41 %inc13 = add i64 1, %inc3
42 %exact3 = ashr exact i64 %inc13, 32
44 %sum1 = add i64 %exact3, %exact2
45 %sum2 = add i64 %sum1, %exact1
46 %zsum = add i64 %sum2, 0
47 %sext22 = add i64 1, %fork
48 %exact4 = ashr exact i64 %sext22, 32
49 %join = add i64 %fork, %zsum
50 %last = add i64 %join, %exact4