blob: 5fd9806813cd6207188c07db5d4d744439157c0e [file] [log] [blame]
Tom Stellard36a03182014-04-02 19:53:29 +00001; RUN: opt -basicaa -loop-idiom -S < %s -march=r600 -mcpu=redwood | FileCheck --check-prefix=R600 --check-prefix=FUNC %s
Tom Stellard49f8bfd2015-01-06 18:00:21 +00002; RUN: opt -basicaa -loop-idiom -S < %s -march=amdgcn -mcpu=SI -verify-machineinstrs| FileCheck --check-prefix=SI --check-prefix=FUNC %s
Marek Olsak75170772015-01-27 17:27:15 +00003; RUN: opt -basicaa -loop-idiom -S < %s -march=amdgcn -mcpu=tonga -verify-machineinstrs| FileCheck --check-prefix=SI --check-prefix=FUNC %s
Tom Stellard36a03182014-04-02 19:53:29 +00004
Tom Stellard36a03182014-04-02 19:53:29 +00005
6; Make sure loop-idiom doesn't create memcpy or memset. There are no library
7; implementations of these for R600.
8
9; FUNC: @no_memcpy
Tom Stellard79243d92014-10-01 17:15:17 +000010; R600-NOT: {{^}}llvm.memcpy
11; SI-NOT: {{^}}llvm.memcpy
Tom Stellard36a03182014-04-02 19:53:29 +000012define void @no_memcpy(i8 addrspace(3)* %in, i32 %size) {
13entry:
14 %dest = alloca i8, i32 32
15 br label %for.body
16
17for.body:
18 %0 = phi i32 [0, %entry], [%4, %for.body]
David Blaikie79e6c742015-02-27 19:29:02 +000019 %1 = getelementptr i8, i8 addrspace(3)* %in, i32 %0
20 %2 = getelementptr i8, i8* %dest, i32 %0
David Blaikiea79ac142015-02-27 21:17:42 +000021 %3 = load i8, i8 addrspace(3)* %1
Tom Stellard36a03182014-04-02 19:53:29 +000022 store i8 %3, i8* %2
23 %4 = add i32 %0, 1
24 %5 = icmp eq i32 %4, %size
25 br i1 %5, label %for.end, label %for.body
26
27for.end:
28 ret void
29}
30
31; FUNC: @no_memset
Tom Stellard79243d92014-10-01 17:15:17 +000032; R600-NOT: {{^}}llvm.memset
33; R600-NOT: {{^}}memset_pattern16:
34; SI-NOT: {{^}}llvm.memset
35; SI-NOT: {{^}}memset_pattern16:
Tom Stellard36a03182014-04-02 19:53:29 +000036define void @no_memset(i32 %size) {
37entry:
38 %dest = alloca i8, i32 32
39 br label %for.body
40
41for.body:
42 %0 = phi i32 [0, %entry], [%2, %for.body]
David Blaikie79e6c742015-02-27 19:29:02 +000043 %1 = getelementptr i8, i8* %dest, i32 %0
Tom Stellard36a03182014-04-02 19:53:29 +000044 store i8 0, i8* %1
45 %2 = add i32 %0, 1
46 %3 = icmp eq i32 %2, %size
47 br i1 %3, label %for.end, label %for.body
48
49for.end:
50 ret void
51}