1 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
2 ; RUN: opt -slp-vectorizer -S %s | FileCheck %s
4 target datalayout = "e-m:o-i64:64-i128:128-n32:64-S128"
5 target triple = "arm64-apple-ios13.0.0"
8 declare i32* @get_ptr()
10 define void @test(i64* %ptr, i64* noalias %res) {
13 ; CHECK-NEXT: br label [[FOR_BODY:%.*]]
15 ; CHECK-NEXT: [[CALL_I_I:%.*]] = call i32* @get_ptr()
16 ; CHECK-NEXT: [[GEP_1:%.*]] = getelementptr i32, i32* [[CALL_I_I]], i32 2
17 ; CHECK-NEXT: [[GEP_2:%.*]] = getelementptr i32, i32* [[CALL_I_I]], i32 1
18 ; CHECK-NEXT: [[TMP0:%.*]] = bitcast i32* [[CALL_I_I]] to <2 x i32>*
19 ; CHECK-NEXT: [[TMP1:%.*]] = load <2 x i32>, <2 x i32>* [[TMP0]], align 2
20 ; CHECK-NEXT: [[GEP_3:%.*]] = getelementptr i32, i32* [[CALL_I_I]], i32 3
21 ; CHECK-NEXT: [[TMP2:%.*]] = bitcast i32* [[GEP_1]] to <2 x i32>*
22 ; CHECK-NEXT: [[TMP3:%.*]] = load <2 x i32>, <2 x i32>* [[TMP2]], align 2
23 ; CHECK-NEXT: [[TMP4:%.*]] = zext <2 x i32> [[TMP1]] to <2 x i64>
24 ; CHECK-NEXT: [[TMP5:%.*]] = zext <2 x i32> [[TMP3]] to <2 x i64>
25 ; CHECK-NEXT: [[TMP6:%.*]] = sub nsw <2 x i64> [[TMP4]], [[TMP5]]
26 ; CHECK-NEXT: [[RES_1:%.*]] = getelementptr i64, i64* [[RES:%.*]], i64 1
27 ; CHECK-NEXT: [[TMP7:%.*]] = bitcast i64* [[RES]] to <2 x i64>*
28 ; CHECK-NEXT: store <2 x i64> [[TMP6]], <2 x i64>* [[TMP7]], align 8
29 ; CHECK-NEXT: [[C:%.*]] = call i1 @cond()
30 ; CHECK-NEXT: br i1 [[C]], label [[FOR_BODY]], label [[EXIT:%.*]]
32 ; CHECK-NEXT: ret void
37 for.body: ; preds = %for.body, %entry
38 %call.i.i = call i32* @get_ptr()
39 %l.0.0 = load i32, i32* %call.i.i, align 2
40 %gep.1 = getelementptr i32, i32* %call.i.i, i32 2
41 %l.1.0 = load i32, i32* %gep.1, align 2
42 %ext.0.0 = zext i32 %l.0.0 to i64
43 %ext.1.0 = zext i32 %l.1.0 to i64
44 %sub.1 = sub nsw i64 %ext.0.0, %ext.1.0
46 %gep.2 = getelementptr i32, i32* %call.i.i, i32 1
47 %l.0.1 = load i32, i32* %gep.2, align 2
48 %gep.3 = getelementptr i32, i32* %call.i.i, i32 3
49 %l.1.1 = load i32, i32* %gep.3, align 2
50 %ext.0.1 = zext i32 %l.0.1 to i64
51 %ext.1.1 = zext i32 %l.1.1 to i64
52 %sub.2 = sub nsw i64 %ext.0.1, %ext.1.1
54 store i64 %sub.1, i64* %res
55 %res.1 = getelementptr i64, i64* %res, i64 1
56 store i64 %sub.2, i64* %res.1
59 br i1 %c, label %for.body, label %exit