1 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
2 ; RUN: opt < %s -basicaa -slp-vectorizer -S -mtriple=aarch64-unknown-linux-gnu -mcpu=cortex-a57 | FileCheck %s
3 target datalayout = "e-m:e-i64:64-i128:128-n32:64-S128"
4 target triple = "aarch64--linux-gnu"
6 define void @test1(i32* noalias nocapture %a, i32* noalias nocapture readonly %b, i32* noalias nocapture readonly %c) {
9 ; CHECK-NEXT: [[ARRAYIDX3:%.*]] = getelementptr inbounds i32, i32* [[B:%.*]], i64 1
10 ; CHECK-NEXT: [[ARRAYIDX4:%.*]] = getelementptr inbounds i32, i32* [[C:%.*]], i64 1
11 ; CHECK-NEXT: [[ARRAYIDX7:%.*]] = getelementptr inbounds i32, i32* [[A:%.*]], i64 1
12 ; CHECK-NEXT: [[ARRAYIDX8:%.*]] = getelementptr inbounds i32, i32* [[B]], i64 2
13 ; CHECK-NEXT: [[ARRAYIDX9:%.*]] = getelementptr inbounds i32, i32* [[C]], i64 2
14 ; CHECK-NEXT: [[ARRAYIDX12:%.*]] = getelementptr inbounds i32, i32* [[A]], i64 2
15 ; CHECK-NEXT: [[ARRAYIDX13:%.*]] = getelementptr inbounds i32, i32* [[B]], i64 3
16 ; CHECK-NEXT: [[TMP0:%.*]] = bitcast i32* [[B]] to <4 x i32>*
17 ; CHECK-NEXT: [[TMP1:%.*]] = load <4 x i32>, <4 x i32>* [[TMP0]], align 4
18 ; CHECK-NEXT: [[ARRAYIDX14:%.*]] = getelementptr inbounds i32, i32* [[C]], i64 3
19 ; CHECK-NEXT: [[TMP2:%.*]] = bitcast i32* [[C]] to <4 x i32>*
20 ; CHECK-NEXT: [[TMP3:%.*]] = load <4 x i32>, <4 x i32>* [[TMP2]], align 4
21 ; CHECK-NEXT: [[TMP4:%.*]] = add nsw <4 x i32> [[TMP3]], [[TMP1]]
22 ; CHECK-NEXT: [[TMP5:%.*]] = sdiv <4 x i32> [[TMP4]], <i32 2, i32 2, i32 2, i32 2>
23 ; CHECK-NEXT: [[ARRAYIDX17:%.*]] = getelementptr inbounds i32, i32* [[A]], i64 3
24 ; CHECK-NEXT: [[TMP6:%.*]] = bitcast i32* [[A]] to <4 x i32>*
25 ; CHECK-NEXT: store <4 x i32> [[TMP5]], <4 x i32>* [[TMP6]], align 4
26 ; CHECK-NEXT: ret void
29 %0 = load i32, i32* %b, align 4
30 %1 = load i32, i32* %c, align 4
31 %add = add nsw i32 %1, %0
32 %div = sdiv i32 %add, 2
33 store i32 %div, i32* %a, align 4
34 %arrayidx3 = getelementptr inbounds i32, i32* %b, i64 1
35 %2 = load i32, i32* %arrayidx3, align 4
36 %arrayidx4 = getelementptr inbounds i32, i32* %c, i64 1
37 %3 = load i32, i32* %arrayidx4, align 4
38 %add5 = add nsw i32 %3, %2
39 %div6 = sdiv i32 %add5, 2
40 %arrayidx7 = getelementptr inbounds i32, i32* %a, i64 1
41 store i32 %div6, i32* %arrayidx7, align 4
42 %arrayidx8 = getelementptr inbounds i32, i32* %b, i64 2
43 %4 = load i32, i32* %arrayidx8, align 4
44 %arrayidx9 = getelementptr inbounds i32, i32* %c, i64 2
45 %5 = load i32, i32* %arrayidx9, align 4
46 %add10 = add nsw i32 %5, %4
47 %div11 = sdiv i32 %add10, 2
48 %arrayidx12 = getelementptr inbounds i32, i32* %a, i64 2
49 store i32 %div11, i32* %arrayidx12, align 4
50 %arrayidx13 = getelementptr inbounds i32, i32* %b, i64 3
51 %6 = load i32, i32* %arrayidx13, align 4
52 %arrayidx14 = getelementptr inbounds i32, i32* %c, i64 3
53 %7 = load i32, i32* %arrayidx14, align 4
54 %add15 = add nsw i32 %7, %6
55 %div16 = sdiv i32 %add15, 2
56 %arrayidx17 = getelementptr inbounds i32, i32* %a, i64 3
57 store i32 %div16, i32* %arrayidx17, align 4