• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1; RUN: opt -basicaa -loop-idiom -S < %s -march=r600 -mcpu=redwood | FileCheck --check-prefix=R600 --check-prefix=FUNC %s
2; RUN: opt -basicaa -loop-idiom -S < %s -march=r600 -mcpu=SI -verify-machineinstrs| FileCheck --check-prefix=SI --check-prefix=FUNC %s
3
4target datalayout = "e-p:32:32-p1:64:64-p2:64:64-p3:32:32-p4:32:32-p5:64:64-i64:64-v16:16-v24:32-v32:32-v48:64-v96:128-v192:256-v256:256-v512:512-v1024:1024-v2048:2048-n32:64"
5target triple = "r600--"
6
7
8
9; Make sure loop-idiom doesn't create memcpy or memset.  There are no library
10; implementations of these for R600.
11
12; FUNC: @no_memcpy
13; R600-NOT: @llvm.memcpy
14; SI-NOT: @llvm.memcpy
15define void @no_memcpy(i8 addrspace(3)* %in, i32 %size) {
16entry:
17  %dest = alloca i8, i32 32
18  br label %for.body
19
20for.body:
21  %0 = phi i32 [0, %entry], [%4, %for.body]
22  %1 = getelementptr i8 addrspace(3)* %in, i32 %0
23  %2 = getelementptr i8* %dest, i32 %0
24  %3 = load i8 addrspace(3)* %1
25  store i8 %3, i8* %2
26  %4 = add i32 %0, 1
27  %5 = icmp eq i32 %4, %size
28  br i1 %5, label %for.end, label %for.body
29
30for.end:
31  ret void
32}
33
34; FUNC: @no_memset
35; R600-NOT: @llvm.memset
36; R600-NOT: @memset_pattern16
37; SI-NOT: @llvm.memset
38; SI-NOT: @memset_pattern16
39define void @no_memset(i32 %size) {
40entry:
41  %dest = alloca i8, i32 32
42  br label %for.body
43
44for.body:
45  %0 = phi i32 [0, %entry], [%2, %for.body]
46  %1 = getelementptr i8* %dest, i32 %0
47  store i8 0, i8* %1
48  %2 = add i32 %0, 1
49  %3 = icmp eq i32 %2, %size
50  br i1 %3, label %for.end, label %for.body
51
52for.end:
53  ret void
54}
55