llvm-project
25 строк · 991.0 Байт
1;; Tag this 'XFAIL' because we need a few more TTIs and ISels.
2; XFAIL: *
3; RUN: opt --mtriple=loongarch64 -mattr=+d --passes=loop-data-prefetch -loongarch-enable-loop-data-prefetch -S < %s | FileCheck %s
4
5define void @foo(ptr %a, ptr %b) {
6entry:
7br label %for.body
8
9; CHECK: for.body:
10for.body: ; preds = %for.body, %entry
11%indvars.iv = phi i64 [ 0, %entry ], [ %indvars.iv.next, %for.body ]
12%arrayidx = getelementptr inbounds double, ptr %b, i64 %indvars.iv
13; CHECK: call void @llvm.prefetch
14%0 = load double, ptr %arrayidx, align 8
15%add = fadd double %0, 1.000000e+00
16%arrayidx2 = getelementptr inbounds double, ptr %a, i64 %indvars.iv
17store double %add, ptr %arrayidx2, align 8
18%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
19%exitcond = icmp eq i64 %indvars.iv.next, 1600
20br i1 %exitcond, label %for.end, label %for.body
21
22; CHECK: for.end:
23for.end: ; preds = %for.body
24ret void
25}
26