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 | FileCheck %s
3 target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128-ni:1"
5 define void @mainTest(i32* %ptr) #0 {
6 ; CHECK-LABEL: @mainTest(
8 ; CHECK-NEXT: [[CMP:%.*]] = icmp eq i32* [[PTR:%.*]], null
9 ; CHECK-NEXT: br i1 [[CMP]], label [[LOOP:%.*]], label [[BAIL_OUT:%.*]]
11 ; CHECK-NEXT: [[DUMMY_PHI:%.*]] = phi i32 [ 1, [[ENTRY:%.*]] ], [ [[OP_EXTRA5:%.*]], [[LOOP]] ]
12 ; CHECK-NEXT: [[TMP0:%.*]] = getelementptr inbounds i32, i32* [[PTR]], i64 1
13 ; CHECK-NEXT: [[TMP1:%.*]] = getelementptr inbounds i32, i32* [[PTR]], i64 2
14 ; CHECK-NEXT: [[TMP2:%.*]] = getelementptr inbounds i32, i32* [[PTR]], i64 3
15 ; CHECK-NEXT: [[TMP3:%.*]] = bitcast i32* [[PTR]] to <4 x i32>*
16 ; CHECK-NEXT: [[TMP4:%.*]] = load <4 x i32>, <4 x i32>* [[TMP3]], align 4
17 ; CHECK-NEXT: [[TMP5:%.*]] = extractelement <4 x i32> [[TMP4]], i32 3
18 ; CHECK-NEXT: [[TMP6:%.*]] = extractelement <4 x i32> [[TMP4]], i32 2
19 ; CHECK-NEXT: [[TMP7:%.*]] = extractelement <4 x i32> [[TMP4]], i32 1
20 ; CHECK-NEXT: [[TMP8:%.*]] = mul <4 x i32> [[TMP4]], [[TMP4]]
21 ; CHECK-NEXT: [[TMP9:%.*]] = sext i32 [[TMP6]] to i64
22 ; CHECK-NEXT: [[RDX_SHUF:%.*]] = shufflevector <4 x i32> [[TMP8]], <4 x i32> undef, <4 x i32> <i32 2, i32 3, i32 undef, i32 undef>
23 ; CHECK-NEXT: [[BIN_RDX:%.*]] = add <4 x i32> [[TMP8]], [[RDX_SHUF]]
24 ; CHECK-NEXT: [[RDX_SHUF1:%.*]] = shufflevector <4 x i32> [[BIN_RDX]], <4 x i32> undef, <4 x i32> <i32 1, i32 undef, i32 undef, i32 undef>
25 ; CHECK-NEXT: [[BIN_RDX2:%.*]] = add <4 x i32> [[BIN_RDX]], [[RDX_SHUF1]]
26 ; CHECK-NEXT: [[TMP10:%.*]] = extractelement <4 x i32> [[BIN_RDX2]], i32 0
27 ; CHECK-NEXT: [[OP_EXTRA:%.*]] = add i32 [[TMP10]], 1
28 ; CHECK-NEXT: [[OP_EXTRA3:%.*]] = add i32 [[OP_EXTRA]], [[TMP7]]
29 ; CHECK-NEXT: [[OP_EXTRA4:%.*]] = add i32 [[OP_EXTRA3]], [[TMP6]]
30 ; CHECK-NEXT: [[OP_EXTRA5]] = add i32 [[OP_EXTRA4]], [[TMP5]]
31 ; CHECK-NEXT: br label [[LOOP]]
33 ; CHECK-NEXT: ret void
36 %cmp = icmp eq i32* %ptr, null
37 br i1 %cmp, label %loop, label %bail_out
40 %dummy_phi = phi i32 [ 1, %entry ], [ %18, %loop ]
41 %0 = load i32, i32 * %ptr , align 4
44 %3 = getelementptr inbounds i32, i32 * %ptr, i64 1
45 %4 = load i32, i32 * %3 , align 4
49 %8 = getelementptr inbounds i32, i32 *%ptr, i64 2
50 %9 = load i32, i32 * %8 , align 4
53 %12 = add i32 %11, %10
54 %13 = sext i32 %9 to i64
55 %14 = getelementptr inbounds i32, i32 *%ptr, i64 3
56 %15 = load i32, i32 * %14 , align 4
57 %16 = mul i32 %15, %15
58 %17 = add i32 %12, %15
59 %18 = add i32 %17, %16
66 attributes #0 = { "target-cpu"="westmere" }