177 lines · plain
1; RUN: opt -passes=loop-vectorize < %s -S -o - | FileCheck %s2 3target datalayout = "e-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64"4target triple = "thumbv8.1m.main-none-eabi"5 6; CHECK-LABEL: test_i32_align47; CHECK: call void @llvm.masked.store.v4i32.p08define void @test_i32_align4(ptr nocapture %A, i32 %n) #0 {9entry:10 %cmp12 = icmp sgt i32 %n, 011 br i1 %cmp12, label %for.body.preheader, label %for.cond.cleanup12 13for.body.preheader: ; preds = %entry14 br label %for.body15 16for.body: ; preds = %for.body.preheader, %for.inc17 %i.013 = phi i32 [ %inc, %for.inc ], [ 0, %for.body.preheader ]18 %arrayidx = getelementptr inbounds i32, ptr %A, i32 %i.01319 %0 = load i32, ptr %arrayidx, align 420 %.off = add i32 %0, 921 %1 = icmp ult i32 %.off, 1922 br i1 %1, label %if.then, label %for.inc23 24if.then: ; preds = %for.body25 store i32 0, ptr %arrayidx, align 426 br label %for.inc27 28for.inc: ; preds = %for.body, %if.then29 %inc = add nuw nsw i32 %i.013, 130 %exitcond = icmp eq i32 %inc, %n31 br i1 %exitcond, label %for.cond.cleanup.loopexit, label %for.body32 33for.cond.cleanup.loopexit: ; preds = %for.inc34 br label %for.cond.cleanup35 36for.cond.cleanup: ; preds = %for.cond.cleanup.loopexit, %entry37 ret void38}39 40; CHECK-LABEL: test_i32_align241; CHECK-NOT: call void @llvm.masked.store42define void @test_i32_align2(ptr nocapture %A, i32 %n) #0 {43entry:44 %cmp12 = icmp sgt i32 %n, 045 br i1 %cmp12, label %for.body.preheader, label %for.cond.cleanup46 47for.body.preheader: ; preds = %entry48 br label %for.body49 50for.body: ; preds = %for.body.preheader, %for.inc51 %i.013 = phi i32 [ %inc, %for.inc ], [ 0, %for.body.preheader ]52 %arrayidx = getelementptr inbounds i32, ptr %A, i32 %i.01353 %0 = load i32, ptr %arrayidx, align 254 %.off = add i32 %0, 955 %1 = icmp ult i32 %.off, 1956 br i1 %1, label %if.then, label %for.inc57 58if.then: ; preds = %for.body59 store i32 0, ptr %arrayidx, align 260 br label %for.inc61 62for.inc: ; preds = %for.body, %if.then63 %inc = add nuw nsw i32 %i.013, 164 %exitcond = icmp eq i32 %inc, %n65 br i1 %exitcond, label %for.cond.cleanup.loopexit, label %for.body66 67for.cond.cleanup.loopexit: ; preds = %for.inc68 br label %for.cond.cleanup69 70for.cond.cleanup: ; preds = %for.cond.cleanup.loopexit, %entry71 ret void72}73 74; CHECK-LABEL: test_i32_noalign75; CHECK: call void @llvm.masked.store.v4i32.p076define void @test_i32_noalign(ptr nocapture %A, i32 %n) #0 {77entry:78 %cmp12 = icmp sgt i32 %n, 079 br i1 %cmp12, label %for.body.preheader, label %for.cond.cleanup80 81for.body.preheader: ; preds = %entry82 br label %for.body83 84for.body: ; preds = %for.body.preheader, %for.inc85 %i.013 = phi i32 [ %inc, %for.inc ], [ 0, %for.body.preheader ]86 %arrayidx = getelementptr inbounds i32, ptr %A, i32 %i.01387 %0 = load i32, ptr %arrayidx88 %.off = add i32 %0, 989 %1 = icmp ult i32 %.off, 1990 br i1 %1, label %if.then, label %for.inc91 92if.then: ; preds = %for.body93 store i32 0, ptr %arrayidx94 br label %for.inc95 96for.inc: ; preds = %for.body, %if.then97 %inc = add nuw nsw i32 %i.013, 198 %exitcond = icmp eq i32 %inc, %n99 br i1 %exitcond, label %for.cond.cleanup.loopexit, label %for.body100 101for.cond.cleanup.loopexit: ; preds = %for.inc102 br label %for.cond.cleanup103 104for.cond.cleanup: ; preds = %for.cond.cleanup.loopexit, %entry105 ret void106}107 108; CHECK-LABEL: test_i16_align2109; CHECK: call void @llvm.masked.store.v8i16.p0110define void @test_i16_align2(ptr nocapture %A, i32 %n) #0 {111entry:112 %cmp12 = icmp sgt i32 %n, 0113 br i1 %cmp12, label %for.body.preheader, label %for.cond.cleanup114 115for.body.preheader: ; preds = %entry116 br label %for.body117 118for.body: ; preds = %for.body.preheader, %for.inc119 %i.013 = phi i32 [ %inc, %for.inc ], [ 0, %for.body.preheader ]120 %arrayidx = getelementptr inbounds i16, ptr %A, i32 %i.013121 %0 = load i16, ptr %arrayidx, align 2122 %.off = add i16 %0, 9123 %1 = icmp ult i16 %.off, 19124 br i1 %1, label %if.then, label %for.inc125 126if.then: ; preds = %for.body127 store i16 0, ptr %arrayidx, align 2128 br label %for.inc129 130for.inc: ; preds = %for.body, %if.then131 %inc = add nuw nsw i32 %i.013, 1132 %exitcond = icmp eq i32 %inc, %n133 br i1 %exitcond, label %for.cond.cleanup.loopexit, label %for.body134 135for.cond.cleanup.loopexit: ; preds = %for.inc136 br label %for.cond.cleanup137 138for.cond.cleanup: ; preds = %for.cond.cleanup.loopexit, %entry139 ret void140}141 142; CHECK-LABEL: test_i16_align1143; CHECK-NOT: call void @llvm.masked.store144define void @test_i16_align1(ptr nocapture %A, i32 %n) #0 {145entry:146 %cmp12 = icmp sgt i32 %n, 0147 br i1 %cmp12, label %for.body.preheader, label %for.cond.cleanup148 149for.body.preheader: ; preds = %entry150 br label %for.body151 152for.body: ; preds = %for.body.preheader, %for.inc153 %i.013 = phi i32 [ %inc, %for.inc ], [ 0, %for.body.preheader ]154 %arrayidx = getelementptr inbounds i16, ptr %A, i32 %i.013155 %0 = load i16, ptr %arrayidx, align 1156 %.off = add i16 %0, 9157 %1 = icmp ult i16 %.off, 19158 br i1 %1, label %if.then, label %for.inc159 160if.then: ; preds = %for.body161 store i16 0, ptr %arrayidx, align 1162 br label %for.inc163 164for.inc: ; preds = %for.body, %if.then165 %inc = add nuw nsw i32 %i.013, 1166 %exitcond = icmp eq i32 %inc, %n167 br i1 %exitcond, label %for.cond.cleanup.loopexit, label %for.body168 169for.cond.cleanup.loopexit: ; preds = %for.inc170 br label %for.cond.cleanup171 172for.cond.cleanup: ; preds = %for.cond.cleanup.loopexit, %entry173 ret void174}175 176attributes #0 = { "target-features"="+mve" }177