• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1; RUN: opt -S -mtriple=x86_64-pc_linux -loop-vectorize -instcombine < %s | FileCheck %s --check-prefix=NORMAL
2; RUN: opt -S -mtriple=x86_64-pc_linux -loop-vectorize -instcombine -mcpu=slm < %s | FileCheck %s --check-prefix=NORMAL
3; RUN: opt -S -mtriple=x86_64-pc_linux -loop-vectorize -instcombine -mcpu=atom < %s | FileCheck %s --check-prefix=ATOM
4
5; NORMAL-LABEL: foo
6; NORMAL: %[[WIDE:.*]] = load <8 x i32>, <8 x i32>* %{{.*}}, align 4
7; NORMAL: %[[STRIDED1:.*]] = shufflevector <8 x i32> %[[WIDE]], <8 x i32> undef, <4 x i32> <i32 0, i32 2, i32 4, i32 6>
8; NORMAL: %[[STRIDED2:.*]] = shufflevector <8 x i32> %wide.vec, <8 x i32> undef, <4 x i32> <i32 1, i32 3, i32 5, i32 7>
9; NORMAL: add nsw <4 x i32> %[[STRIDED2]], %[[STRIDED1]]
10
11; ATOM-LABEL: foo
12; ATOM: load i32
13; ATOM: load i32
14; ATOM: store i32
15define void @foo(i32* noalias nocapture %a, i32* noalias nocapture readonly %b) {
16entry:
17  br label %for.body
18
19for.cond.cleanup:                                 ; preds = %for.body
20  ret void
21
22for.body:                                         ; preds = %for.body, %entry
23  %indvars.iv = phi i64 [ 0, %entry ], [ %indvars.iv.next, %for.body ]
24  %0 = shl nsw i64 %indvars.iv, 1
25  %arrayidx = getelementptr inbounds i32, i32* %b, i64 %0
26  %1 = load i32, i32* %arrayidx, align 4
27  %2 = or i64 %0, 1
28  %arrayidx3 = getelementptr inbounds i32, i32* %b, i64 %2
29  %3 = load i32, i32* %arrayidx3, align 4
30  %add4 = add nsw i32 %3, %1
31  %arrayidx6 = getelementptr inbounds i32, i32* %a, i64 %indvars.iv
32  store i32 %add4, i32* %arrayidx6, align 4
33  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
34  %exitcond = icmp eq i64 %indvars.iv.next, 1024
35  br i1 %exitcond, label %for.cond.cleanup, label %for.body
36}
37