1 ; RUN: opt -S -passes=loop-vectorize,instcombine -force-vector-width=4 < %s | FileCheck %s
3 target datalayout = "e-m:e-i64:64-i128:128-n32:64-S128"
5 ; Vectorization of loop with bitcast between GEP and load
6 ; Simplified source code:
7 ;void foo (ptr __restrict__ in, bool * __restrict__ res) {
9 ; for (int i = 0; i < 4096; ++i)
10 ; res[i] = ((unsigned long long)in[i] == 0);
15 ; CHECK: %[[IV:.+]] = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
16 ; CHECK: %[[v0:.+]] = getelementptr inbounds ptr, ptr %in, i64 %[[IV]]
17 ; CHECK: %wide.load = load <4 x i64>, ptr %[[v0]], align 8
18 ; CHECK: icmp eq <4 x i64> %wide.load, zeroinitializer
21 define void @foo(ptr noalias nocapture readonly %in, ptr noalias nocapture readnone %out, ptr noalias nocapture %res) #0 {
26 %indvars.iv = phi i64 [ 0, %entry ], [ %indvars.iv.next, %for.body ]
27 %arrayidx = getelementptr inbounds ptr, ptr %in, i64 %indvars.iv
28 %tmp54 = load i64, ptr %arrayidx, align 8
29 %cmp1 = icmp eq i64 %tmp54, 0
30 %arrayidx3 = getelementptr inbounds i8, ptr %res, i64 %indvars.iv
31 %frombool = zext i1 %cmp1 to i8
32 store i8 %frombool, ptr %arrayidx3, align 1
33 %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
34 %exitcond = icmp eq i64 %indvars.iv.next, 4096
35 br i1 %exitcond, label %for.end, label %for.body