[llvm] 1c1ecee - [RISCV] Add cost model coverage of store of constant [nfc]
Philip Reames via llvm-commits
llvm-commits at lists.llvm.org
Fri Aug 19 13:12:12 PDT 2022
Author: Philip Reames
Date: 2022-08-19T13:11:53-07:00
New Revision: 1c1ecee8da6075e1d6fd1e13b5c04809b4526386
URL: https://github.com/llvm/llvm-project/commit/1c1ecee8da6075e1d6fd1e13b5c04809b4526386
DIFF: https://github.com/llvm/llvm-project/commit/1c1ecee8da6075e1d6fd1e13b5c04809b4526386.diff
LOG: [RISCV] Add cost model coverage of store of constant [nfc]
Added:
Modified:
llvm/test/Analysis/CostModel/RISCV/rvv-load-store.ll
Removed:
################################################################################
diff --git a/llvm/test/Analysis/CostModel/RISCV/rvv-load-store.ll b/llvm/test/Analysis/CostModel/RISCV/rvv-load-store.ll
index 5ce35a7bf913..5bede7f70b40 100644
--- a/llvm/test/Analysis/CostModel/RISCV/rvv-load-store.ll
+++ b/llvm/test/Analysis/CostModel/RISCV/rvv-load-store.ll
@@ -288,3 +288,49 @@ define void @store(ptr %p) {
ret void
}
+
+; For constants, have to account for cost of materializing the constant itself
+; This test exercises a few interesting constant patterns at VLEN=128
+define void @store_of_constant(ptr %p) {
+; CHECK-LABEL: 'store_of_constant'
+; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: store <4 x i32> poison, ptr %p, align 16
+; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: store <4 x i32> undef, ptr %p, align 16
+; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: store <4 x i32> zeroinitializer, ptr %p, align 16
+; CHECK-NEXT: Cost Model: Found an estimated cost of 3 for instruction: store <4 x i32> <i32 1, i32 1, i32 1, i32 1>, ptr %p, align 16
+; CHECK-NEXT: Cost Model: Found an estimated cost of 3 for instruction: store <4 x i32> <i32 4096, i32 4096, i32 4096, i32 4096>, ptr %p, align 16
+; CHECK-NEXT: Cost Model: Found an estimated cost of 3 for instruction: store <4 x i32> <i32 1, i32 1, i32 2, i32 1>, ptr %p, align 16
+; CHECK-NEXT: Cost Model: Found an estimated cost of 3 for instruction: store <4 x i32> <i32 2, i32 1, i32 1, i32 1>, ptr %p, align 16
+; CHECK-NEXT: Cost Model: Found an estimated cost of 3 for instruction: store <4 x i32> <i32 0, i32 1, i32 2, i32 3>, ptr %p, align 16
+; CHECK-NEXT: Cost Model: Found an estimated cost of 3 for instruction: store <4 x i32> <i32 1, i32 2, i32 3, i32 4>, ptr %p, align 16
+; CHECK-NEXT: Cost Model: Found an estimated cost of 3 for instruction: store <4 x i32> <i32 -1, i32 -2, i32 -3, i32 -4>, ptr %p, align 16
+; CHECK-NEXT: Cost Model: Found an estimated cost of 3 for instruction: store <4 x i32> <i32 2, i32 4, i32 6, i32 8>, ptr %p, align 16
+; CHECK-NEXT: Cost Model: Found an estimated cost of 3 for instruction: store <4 x i32> <i32 -1, i32 0, i32 2, i32 1>, ptr %p, align 16
+; CHECK-NEXT: Cost Model: Found an estimated cost of 3 for instruction: store <4 x i32> <i32 256, i32 4096, i32 57, i32 1>, ptr %p, align 16
+; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: ret void
+;
+
+ ; poison and undef
+ store <4 x i32> poison, ptr %p
+ store <4 x i32> undef, ptr %p
+
+ ; Various splats
+ store <4 x i32> zeroinitializer, ptr %p
+ store <4 x i32> <i32 1, i32 1, i32 1, i32 1>, ptr %p
+ store <4 x i32> <i32 4096, i32 4096, i32 4096, i32 4096>, ptr %p
+
+ ; Nearly splats
+ store <4 x i32> <i32 1, i32 1, i32 2, i32 1>, ptr %p
+ store <4 x i32> <i32 2, i32 1, i32 1, i32 1>, ptr %p
+
+ ; Step vector functions
+ store <4 x i32> <i32 0, i32 1, i32 2, i32 3>, ptr %p
+ store <4 x i32> <i32 1, i32 2, i32 3, i32 4>, ptr %p
+ store <4 x i32> <i32 -1, i32 -2, i32 -3, i32 -4>, ptr %p
+ store <4 x i32> <i32 2, i32 4, i32 6, i32 8>, ptr %p
+
+ ; General case 128 bit constants
+ store <4 x i32> <i32 -1, i32 0, i32 2, i32 1>, ptr %p
+ store <4 x i32> <i32 256, i32 4096, i32 57, i32 1>, ptr %p
+
+ ret void
+}
More information about the llvm-commits
mailing list