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=amdgcn -mcpu=tahiti -verify-machineinstrs| FileCheck --check-prefix=SI --check-prefix=FUNC %s 3; RUN: opt -basicaa -loop-idiom -S < %s -march=amdgcn -mcpu=tonga -verify-machineinstrs| FileCheck --check-prefix=SI --check-prefix=FUNC %s 4 5 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 10; R600-NOT: {{^}}llvm.memcpy 11; SI-NOT: {{^}}llvm.memcpy 12define amdgpu_kernel 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] 19 %1 = getelementptr i8, i8 addrspace(3)* %in, i32 %0 20 %2 = getelementptr i8, i8* %dest, i32 %0 21 %3 = load i8, i8 addrspace(3)* %1 22 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 32; R600-NOT: {{^}}llvm.memset 33; R600-NOT: {{^}}memset_pattern16: 34; SI-NOT: {{^}}llvm.memset 35; SI-NOT: {{^}}memset_pattern16: 36define amdgpu_kernel 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] 43 %1 = getelementptr i8, i8* %dest, i32 %0 44 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} 52