brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.3 KiB · 4304105 Raw
46 lines · plain
1; RUN: opt -S -passes=loop-vectorize -mtriple=aarch64-linux-gnu -mattr=+sve < %s | FileCheck %s2 3; This test is checking that a scalable load inside a loop does not trigger a4; TypeSize error in the loop vectorization legality analysis. It is possible for5; a scalable/vector load to appear inside a loop at vectorization legality6; analysis if, for example, the ACLE are used. If we encounter a scalable/vector7; load, it should not be considered for analysis, and we should not see a8; TypeSize error.9 10; #include <arm_sve.h>11;12; void scalable_load_in_loop(long n, int *a, int *b, svuint32_t *x,13;                            svuint32_t *y) {14;     for (unsigned i = 0; i < n; i++) {15;         if (i % 2 == 0) continue;16;         a[i] = 2 * b[i];17;         *x = *y;18;     }19; }20 21; CHECK-LABEL: @scalable_load_in_loop22; CHECK-NOT: vector.body23define void @scalable_load_in_loop(i64 %n, ptr %x, ptr %y) {24entry:25  br label %for.body26 27for.body:28  %i = phi i32 [ %inc, %for.inc ], [ 0, %entry ]29  %rem = and i32 %i, 130  %cmp = icmp eq i32 %rem, 031  br i1 %cmp, label %for.inc, label %if.end32 33if.end:34  %0 = load <vscale x 4 x i32>, ptr %y35  store <vscale x 4 x i32> %0, ptr %x36  br label %for.inc37 38for.inc:39  %inc = add i32 %i, 140  %cmp2 = icmp slt i64 0, %n41  br i1 %cmp2, label %for.body, label %for.cleanup42 43for.cleanup:44  ret void45}46