diff --git a/llvm/test/Analysis/CostModel/RISCV/rvv-load-store.ll b/llvm/test/Analysis/CostModel/RISCV/rvv-load-store.ll index 5ce35a7bf913a..5bede7f70b40a 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> , ptr %p, align 16 +; CHECK-NEXT: Cost Model: Found an estimated cost of 3 for instruction: store <4 x i32> , ptr %p, align 16 +; CHECK-NEXT: Cost Model: Found an estimated cost of 3 for instruction: store <4 x i32> , ptr %p, align 16 +; CHECK-NEXT: Cost Model: Found an estimated cost of 3 for instruction: store <4 x i32> , ptr %p, align 16 +; CHECK-NEXT: Cost Model: Found an estimated cost of 3 for instruction: store <4 x i32> , ptr %p, align 16 +; CHECK-NEXT: Cost Model: Found an estimated cost of 3 for instruction: store <4 x i32> , ptr %p, align 16 +; CHECK-NEXT: Cost Model: Found an estimated cost of 3 for instruction: store <4 x i32> , ptr %p, align 16 +; CHECK-NEXT: Cost Model: Found an estimated cost of 3 for instruction: store <4 x i32> , ptr %p, align 16 +; CHECK-NEXT: Cost Model: Found an estimated cost of 3 for instruction: store <4 x i32> , ptr %p, align 16 +; CHECK-NEXT: Cost Model: Found an estimated cost of 3 for instruction: store <4 x i32> , 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> , ptr %p + store <4 x i32> , ptr %p + + ; Nearly splats + store <4 x i32> , ptr %p + store <4 x i32> , ptr %p + + ; Step vector functions + store <4 x i32> , ptr %p + store <4 x i32> , ptr %p + store <4 x i32> , ptr %p + store <4 x i32> , ptr %p + + ; General case 128 bit constants + store <4 x i32> , ptr %p + store <4 x i32> , ptr %p + + ret void +}