1 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
2 ; RUN: opt -S -passes=slp-vectorizer -mtriple=x86_64-unknown-linux -mattr="-avx512pf,+avx512f,+avx512bw" -slp-threshold=-100 -slp-min-tree-size=0 < %s | FileCheck %s
4 define i32 @foo(i32 %a) {
7 ; CHECK-NEXT: [[TMP0:%.*]] = insertelement <2 x i32> <i32 0, i32 poison>, i32 [[A:%.*]], i32 1
8 ; CHECK-NEXT: [[TMP1:%.*]] = sub nsw <2 x i32> zeroinitializer, [[TMP0]]
9 ; CHECK-NEXT: [[TMP2:%.*]] = shufflevector <2 x i32> [[TMP1]], <2 x i32> poison, <4 x i32> <i32 0, i32 0, i32 0, i32 1>
10 ; CHECK-NEXT: [[TMP3:%.*]] = extractelement <4 x i32> [[TMP2]], i32 0
11 ; CHECK-NEXT: br i1 false, label [[BB5:%.*]], label [[BB1:%.*]]
13 ; CHECK-NEXT: [[TMP4:%.*]] = mul <2 x i32> [[TMP1]], <i32 3, i32 1>
14 ; CHECK-NEXT: [[TMP5:%.*]] = extractelement <2 x i32> [[TMP4]], i32 0
15 ; CHECK-NEXT: [[TMP6:%.*]] = extractelement <2 x i32> [[TMP4]], i32 1
16 ; CHECK-NEXT: [[OP_RDX10:%.*]] = add i32 [[TMP5]], [[TMP6]]
17 ; CHECK-NEXT: [[OP_RDX11:%.*]] = add i32 [[OP_RDX10]], 0
18 ; CHECK-NEXT: br label [[BB3:%.*]]
20 ; CHECK-NEXT: br label [[BB3]]
22 ; CHECK-NEXT: [[P1:%.*]] = phi i32 [ [[OP_RDX11]], [[BB1]] ], [ 0, [[BB2:%.*]] ]
23 ; CHECK-NEXT: ret i32 0
25 ; CHECK-NEXT: [[TMP7:%.*]] = shufflevector <2 x i32> [[TMP1]], <2 x i32> poison, <4 x i32> zeroinitializer
26 ; CHECK-NEXT: [[TMP8:%.*]] = add <4 x i32> [[TMP2]], [[TMP7]]
27 ; CHECK-NEXT: [[TMP9:%.*]] = call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> [[TMP8]])
28 ; CHECK-NEXT: [[OP_RDX8:%.*]] = add i32 [[TMP9]], 0
29 ; CHECK-NEXT: [[OP_RDX9:%.*]] = add i32 [[OP_RDX8]], [[TMP3]]
30 ; CHECK-NEXT: ret i32 [[OP_RDX9]]
32 ; CHECK-NEXT: br label [[BB4:%.*]]
35 %0 = sub nsw i32 0, %a
36 %local = sub nsw i32 0, 0
37 br i1 false, label %bb5, label %bb1
40 %1 = add i32 %0, %local
42 %3 = add i32 %2, %local
44 %5 = add i32 %4, %local
51 %p1 = phi i32 [ %5, %bb1 ], [ 0, %bb2 ]
55 %6 = add i32 %0, %local
56 %7 = add i32 %6, %local
58 %9 = add i32 %8, %local
60 %11 = add i32 %10, %local
62 %13 = add i32 %12, %local
64 %15 = add i32 %14, %local
66 %17 = add i32 %16, %local
68 %19 = add i32 %18, %local