File: sve-scalable-load-in-loop.ll

package info (click to toggle)
llvm-toolchain-19 1%3A19.1.7-3~deb12u1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm-proposed-updates
  • size: 1,998,492 kB
  • sloc: cpp: 6,951,680; ansic: 1,486,157; asm: 913,598; python: 232,024; f90: 80,126; objc: 75,281; lisp: 37,276; pascal: 16,990; sh: 10,009; ml: 5,058; perl: 4,724; awk: 3,523; makefile: 3,167; javascript: 2,504; xml: 892; fortran: 664; cs: 573
file content (45 lines) | stat: -rw-r--r-- 1,334 bytes parent folder | download | duplicates (12)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
; RUN: opt -S -passes=loop-vectorize -mtriple=aarch64-linux-gnu -mattr=+sve < %s | FileCheck %s

; This test is checking that a scalable load inside a loop does not trigger a
; TypeSize error in the loop vectorization legality analysis. It is possible for
; a scalable/vector load to appear inside a loop at vectorization legality
; analysis if, for example, the ACLE are used. If we encounter a scalable/vector
; load, it should not be considered for analysis, and we should not see a
; TypeSize error.

; #include <arm_sve.h>
;
; void scalable_load_in_loop(long n, int *a, int *b, svuint32_t *x,
;                            svuint32_t *y) {
;     for (unsigned i = 0; i < n; i++) {
;         if (i % 2 == 0) continue;
;         a[i] = 2 * b[i];
;         *x = *y;
;     }
; }

; CHECK-LABEL: @scalable_load_in_loop
; CHECK-NOT: vector.body
define void @scalable_load_in_loop(i64 %n, ptr %x, ptr %y) {
entry:
  br label %for.body

for.body:
  %i = phi i32 [ %inc, %for.inc ], [ 0, %entry ]
  %rem = and i32 %i, 1
  %cmp = icmp eq i32 %rem, 0
  br i1 %cmp, label %for.inc, label %if.end

if.end:
  %0 = load <vscale x 4 x i32>, ptr %y
  store <vscale x 4 x i32> %0, ptr %x
  br label %for.inc

for.inc:
  %inc = add i32 %i, 1
  %cmp2 = icmp slt i64 0, %n
  br i1 %cmp2, label %for.body, label %for.cleanup

for.cleanup:
  ret void
}