1 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
2 ; RUN: opt -mtriple=i386-linux-gnu -passes=slp-vectorizer -S %s | FileCheck %s
4 %struct.a = type { [2 x i64] }
6 @a = external global %struct.a
7 @b = external global %struct.a
8 @c = external global %struct.a
10 define void @f(i1 %x) #0 {
13 ; CHECK-NEXT: [[A1:%.*]] = load i64, ptr getelementptr inbounds ([[STRUCT_A:%.*]], ptr @a, i32 0, i32 0, i32 1), align 8
14 ; CHECK-NEXT: [[TMP0:%.*]] = load <2 x i64>, ptr @a, align 8
15 ; CHECK-NEXT: br i1 [[X:%.*]], label [[WHILE_BODY_LR_PH:%.*]], label [[WHILE_END:%.*]]
16 ; CHECK: while.body.lr.ph:
17 ; CHECK-NEXT: [[ICMP_A1:%.*]] = icmp eq i64 [[A1]], 0
18 ; CHECK-NEXT: [[TMP1:%.*]] = load <2 x i64>, ptr @b, align 8
19 ; CHECK-NEXT: [[TMP2:%.*]] = insertelement <2 x i1> poison, i1 [[ICMP_A1]], i32 0
20 ; CHECK-NEXT: [[TMP3:%.*]] = shufflevector <2 x i1> [[TMP2]], <2 x i1> poison, <2 x i32> zeroinitializer
21 ; CHECK-NEXT: [[TMP4:%.*]] = select <2 x i1> [[TMP3]], <2 x i64> [[TMP1]], <2 x i64> [[TMP0]]
22 ; CHECK-NEXT: br label [[WHILE_END]]
24 ; CHECK-NEXT: [[TMP5:%.*]] = phi <2 x i64> [ [[TMP0]], [[ENTRY:%.*]] ], [ [[TMP4]], [[WHILE_BODY_LR_PH]] ]
25 ; CHECK-NEXT: [[TMP6:%.*]] = load <2 x i64>, ptr @c, align 8
26 ; CHECK-NEXT: [[TMP7:%.*]] = extractelement <2 x i64> [[TMP5]], i32 0
27 ; CHECK-NEXT: [[ICMP_D0:%.*]] = icmp eq i64 [[TMP7]], 0
28 ; CHECK-NEXT: br i1 [[ICMP_D0]], label [[IF_END:%.*]], label [[IF_THEN:%.*]]
30 ; CHECK-NEXT: [[AND0_TMP:%.*]] = and i64 [[TMP7]], 8
31 ; CHECK-NEXT: [[TMP8:%.*]] = insertelement <2 x i64> poison, i64 [[AND0_TMP]], i32 0
32 ; CHECK-NEXT: [[TMP9:%.*]] = shufflevector <2 x i64> [[TMP8]], <2 x i64> [[TMP5]], <2 x i32> <i32 0, i32 3>
33 ; CHECK-NEXT: [[TMP10:%.*]] = and <2 x i64> [[TMP9]], [[TMP6]]
34 ; CHECK-NEXT: store <2 x i64> [[TMP10]], ptr @a, align 8
35 ; CHECK-NEXT: br label [[IF_END]]
37 ; CHECK-NEXT: ret void
40 %a0 = load i64, ptr @a, align 8
41 %a1 = load i64, ptr getelementptr inbounds (%struct.a, ptr @a, i32 0, i32 0, i32 1), align 8
42 br i1 %x, label %while.body.lr.ph, label %while.end
45 %icmp.a1 = icmp eq i64 %a1, 0
46 %b0 = load i64, ptr @b, align 8
47 %b1 = load i64, ptr getelementptr inbounds (%struct.a, ptr @b, i32 0, i32 0, i32 1), align 8
48 %c0 = select i1 %icmp.a1, i64 %b0, i64 %a0
49 %c1 = select i1 %icmp.a1, i64 %b1, i64 %a1
53 %d0 = phi i64 [ %a0, %entry ], [ %c0, %while.body.lr.ph ]
54 %d1 = phi i64 [ %a1, %entry ], [ %c1, %while.body.lr.ph ]
55 %e0 = load i64, ptr @c, align 8
56 %e1 = load i64, ptr getelementptr inbounds (%struct.a, ptr @c, i32 0, i32 0, i32 1), align 8
57 %icmp.d0 = icmp eq i64 %d0, 0
58 br i1 %icmp.d0, label %if.end, label %if.then
61 %and0.tmp = and i64 %d0, 8
62 %and0 = and i64 %and0.tmp, %e0
63 %and1 = and i64 %e1, %d1
64 store i64 %and0, ptr @a, align 8
65 store i64 %and1, ptr getelementptr inbounds (%struct.a, ptr @a, i32 0, i32 0, i32 1), align 8
72 attributes #0 = { "target-features"="+sse2" }