[llvm] 1b94261 - [x86] add cost model test for memcpy; NFC

Sanjay Patel via llvm-commits llvm-commits at lists.llvm.org
Tue Oct 13 08:42:55 PDT 2020


Author: Sanjay Patel
Date: 2020-10-13T11:42:44-04:00
New Revision: 1b94261e36f18bdc17097078518df448b67c84ea

URL: https://github.com/llvm/llvm-project/commit/1b94261e36f18bdc17097078518df448b67c84ea
DIFF: https://github.com/llvm/llvm-project/commit/1b94261e36f18bdc17097078518df448b67c84ea.diff

LOG: [x86] add cost model test for memcpy; NFC

This is treated as a special-case in the base class
implementation of getIntrinsicInstrCost().

Added: 
    

Modified: 
    llvm/test/Analysis/CostModel/X86/intrinsic-cost-kinds.ll

Removed: 
    


################################################################################
diff  --git a/llvm/test/Analysis/CostModel/X86/intrinsic-cost-kinds.ll b/llvm/test/Analysis/CostModel/X86/intrinsic-cost-kinds.ll
index 835cc23ce76b..806bf251a107 100644
--- a/llvm/test/Analysis/CostModel/X86/intrinsic-cost-kinds.ll
+++ b/llvm/test/Analysis/CostModel/X86/intrinsic-cost-kinds.ll
@@ -29,6 +29,8 @@ declare <16 x float> @llvm.masked.gather.v16f32.v16p0f32(<16 x float*>, i32, <16
 declare void @llvm.masked.scatter.v16f32.v16p0f32(<16 x float>, <16 x float*>, i32, <16 x i1>)
 declare float @llvm.vector.reduce.fmax.v16f32(<16 x float>)
 
+declare void @llvm.memcpy.p0i8.p0i8.i32(i8*, i8*, i32, i1)
+
 define void @smax(i32 %a, i32 %b, <16 x i32> %va, <16 x i32> %vb) {
 ; THRU-LABEL: 'smax'
 ; THRU-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %s = call i32 @llvm.smax.i32(i32 %a, i32 %b)
@@ -221,3 +223,24 @@ define void @reduce_fmax(<16 x float> %va) {
   %v = call float @llvm.vector.reduce.fmax.v16f32(<16 x float> %va)
   ret void
 }
+
+define void @memcpy(i8* %a, i8* %b, i32 %c) {
+; THRU-LABEL: 'memcpy'
+; THRU-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: call void @llvm.memcpy.p0i8.p0i8.i32(i8* align 1 %a, i8* align 1 %b, i32 32, i1 false)
+; THRU-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret void
+;
+; LATE-LABEL: 'memcpy'
+; LATE-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: call void @llvm.memcpy.p0i8.p0i8.i32(i8* align 1 %a, i8* align 1 %b, i32 32, i1 false)
+; LATE-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret void
+;
+; SIZE-LABEL: 'memcpy'
+; SIZE-NEXT:  Cost Model: Found an estimated cost of 4 for instruction: call void @llvm.memcpy.p0i8.p0i8.i32(i8* align 1 %a, i8* align 1 %b, i32 32, i1 false)
+; SIZE-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret void
+;
+; SIZE_LATE-LABEL: 'memcpy'
+; SIZE_LATE-NEXT:  Cost Model: Found an estimated cost of 4 for instruction: call void @llvm.memcpy.p0i8.p0i8.i32(i8* align 1 %a, i8* align 1 %b, i32 32, i1 false)
+; SIZE_LATE-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret void
+;
+  call void @llvm.memcpy.p0i8.p0i8.i32(i8* align 1 %a, i8* align 1 %b, i32 32, i1 false)
+  ret void
+}


        


More information about the llvm-commits mailing list