Home | History | Annotate | Download | only in Hexagon
      1 ; RUN: llc -march=hexagon -O2 -mno-pairing -mno-compound < %s | FileCheck %s
      2 
      3 ; Test to see if we inline calls to memcpy/memmove when
      4 ; the array size is small.
      5 
      6 target triple = "hexagon-unknown--elf"
      7 
      8 ; CHECK-LABEL: f0:
      9 ; CHECK-DAG: [[REG1:r[0-9]*]] = memw(r{{[0-9]*}}+#0)
     10 ; CHECK-DAG: [[REG2:r[0-9]*]] = memuh(r{{[0-9]*}}+#4)
     11 ; CHECK-DAG: [[REG3:r[0-9]*]] = memub(r{{[0-9]*}}+#6)
     12 ; CHECK-DAG: memw(r{{[0-9]*}}+#0) = [[REG1]]
     13 ; CHECK-DAG: memh(r{{[0-9]*}}+#4) = [[REG2]]
     14 ; CHECK-DAG: memb(r{{[0-9]*}}+#6) = [[REG3]]
     15 
     16 define i32 @f0(i32* %a0) #0 {
     17 b0:
     18   %v0 = alloca [10 x i32], align 8
     19   %v1 = bitcast [10 x i32]* %v0 to i8*
     20   %v2 = bitcast i32* %a0 to i8*
     21   call void @llvm.memcpy.p0i8.p0i8.i32(i8* align 4 %v1, i8* align 4 %v2, i32 7, i1 false)
     22   %v3 = getelementptr inbounds [10 x i32], [10 x i32]* %v0, i32 0, i32 0
     23   call void @f1(i32* %v3, i32* %a0) #0
     24   ret i32 0
     25 }
     26 
     27 declare void @f1(i32*, i32*)
     28 
     29 ; CHECK-LABEL: f2:
     30 ; CHECK-DAG: [[REG4:r[0-9]*]] = memub(r{{[0-9]*}}+#6)
     31 ; CHECK-DAG: [[REG5:r[0-9]*]] = memuh(r{{[0-9]*}}+#4)
     32 ; CHECK-DAG: [[REG6:r[0-9]*]] = memw(r{{[0-9]*}}+#0)
     33 ; CHECK-DAG: memw(r{{[0-9]*}}+#0) = [[REG6]]
     34 ; CHECK-DAG: memh(r{{[0-9]*}}+#4) = [[REG5]]
     35 ; CHECK-DAG: memb(r{{[0-9]*}}+#6) = [[REG4]]
     36 
     37 define i32 @f2(i32* %a0, i32* %a1) #0 {
     38 b0:
     39   %v0 = bitcast i32* %a1 to i8*
     40   %v1 = bitcast i32* %a0 to i8*
     41   call void @llvm.memmove.p0i8.p0i8.i32(i8* align 4 %v0, i8* align 4 %v1, i32 7, i1 false)
     42   tail call void @f1(i32* %a1, i32* %a0) #0
     43   ret i32 0
     44 }
     45 
     46 declare void @llvm.memcpy.p0i8.p0i8.i32(i8* nocapture writeonly, i8* nocapture readonly, i32, i1) #1
     47 declare void @llvm.memmove.p0i8.p0i8.i32(i8* nocapture, i8* nocapture readonly, i32, i1) #1
     48 
     49 attributes #0 = { nounwind }
     50 attributes #1 = { argmemonly nounwind }
     51