1 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
2 ; RUN: opt -S -slp-vectorizer -mtriple=x86_64-apple-macosx -mcpu=haswell < %s | FileCheck %s
4 define void @test(ptr %r, ptr %p, ptr %q) #0 {
6 ; CHECK-NEXT: [[P0:%.*]] = getelementptr inbounds i64, ptr [[P:%.*]], i64 0
7 ; CHECK-NEXT: [[P1:%.*]] = getelementptr inbounds i64, ptr [[P]], i64 1
8 ; CHECK-NEXT: [[P2:%.*]] = getelementptr inbounds i64, ptr [[P]], i64 2
9 ; CHECK-NEXT: [[P3:%.*]] = getelementptr inbounds i64, ptr [[P]], i64 3
10 ; CHECK-NEXT: [[Q0:%.*]] = getelementptr inbounds i64, ptr [[Q:%.*]], i64 0
11 ; CHECK-NEXT: [[Q1:%.*]] = getelementptr inbounds i64, ptr [[Q]], i64 1
12 ; CHECK-NEXT: [[Q2:%.*]] = getelementptr inbounds i64, ptr [[Q]], i64 2
13 ; CHECK-NEXT: [[Q3:%.*]] = getelementptr inbounds i64, ptr [[Q]], i64 3
14 ; CHECK-NEXT: [[TMP1:%.*]] = bitcast ptr [[P0]] to <4 x i64>*
15 ; CHECK-NEXT: [[TMP2:%.*]] = load <4 x i64>, <4 x i64>* [[TMP1]], align 2
16 ; CHECK-NEXT: [[TMP3:%.*]] = bitcast ptr [[Q0]] to <4 x i64>*
17 ; CHECK-NEXT: [[TMP4:%.*]] = load <4 x i64>, <4 x i64>* [[TMP3]], align 2
18 ; CHECK-NEXT: [[TMP5:%.*]] = sub nsw <4 x i64> [[TMP2]], [[TMP4]]
19 ; CHECK-NEXT: [[TMP6:%.*]] = extractelement <4 x i64> [[TMP5]], i32 0
20 ; CHECK-NEXT: [[G0:%.*]] = getelementptr inbounds i32, ptr [[R:%.*]], i64 [[TMP6]]
21 ; CHECK-NEXT: [[TMP7:%.*]] = extractelement <4 x i64> [[TMP5]], i32 1
22 ; CHECK-NEXT: [[G1:%.*]] = getelementptr inbounds i32, ptr [[R]], i64 [[TMP7]]
23 ; CHECK-NEXT: [[TMP8:%.*]] = extractelement <4 x i64> [[TMP5]], i32 2
24 ; CHECK-NEXT: [[G2:%.*]] = getelementptr inbounds i32, ptr [[R]], i64 [[TMP8]]
25 ; CHECK-NEXT: [[TMP9:%.*]] = extractelement <4 x i64> [[TMP5]], i32 3
26 ; CHECK-NEXT: [[G3:%.*]] = getelementptr inbounds i32, ptr [[R]], i64 [[TMP9]]
27 ; CHECK-NEXT: ret void
29 %p0 = getelementptr inbounds i64, ptr %p, i64 0
30 %p1 = getelementptr inbounds i64, ptr %p, i64 1
31 %p2 = getelementptr inbounds i64, ptr %p, i64 2
32 %p3 = getelementptr inbounds i64, ptr %p, i64 3
34 %q0 = getelementptr inbounds i64, ptr %q, i64 0
35 %q1 = getelementptr inbounds i64, ptr %q, i64 1
36 %q2 = getelementptr inbounds i64, ptr %q, i64 2
37 %q3 = getelementptr inbounds i64, ptr %q, i64 3
39 %x0 = load i64, ptr %p0, align 2
40 %x1 = load i64, ptr %p1, align 2
41 %x2 = load i64, ptr %p2, align 2
42 %x3 = load i64, ptr %p3, align 2
44 %y0 = load i64, ptr %q0, align 2
45 %y1 = load i64, ptr %q1, align 2
46 %y2 = load i64, ptr %q2, align 2
47 %y3 = load i64, ptr %q3, align 2
49 %sub0 = sub nsw i64 %x0, %y0
50 %sub1 = sub nsw i64 %x1, %y1
51 %sub2 = sub nsw i64 %x2, %y2
52 %sub3 = sub nsw i64 %x3, %y3
54 %g0 = getelementptr inbounds i32, ptr %r, i64 %sub0
55 %g1 = getelementptr inbounds i32, ptr %r, i64 %sub1
56 %g2 = getelementptr inbounds i32, ptr %r, i64 %sub2
57 %g3 = getelementptr inbounds i32, ptr %r, i64 %sub3