Home | History | Annotate | Download | only in AMDGPU
      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=SI -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
     12 define void @no_memcpy(i8 addrspace(3)* %in, i32 %size) {
     13 entry:
     14   %dest = alloca i8, i32 32
     15   br label %for.body
     16 
     17 for.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 
     27 for.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:
     36 define void @no_memset(i32 %size) {
     37 entry:
     38   %dest = alloca i8, i32 32
     39   br label %for.body
     40 
     41 for.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 
     49 for.end:
     50   ret void
     51 }
     52