Skip to content

Commit 8d9e14a

Browse files
committed
tests: add test for the OpName of a generic function.
1 parent 75f8181 commit 8d9e14a

File tree

2 files changed

+32
-0
lines changed

2 files changed

+32
-0
lines changed

tests/ui/dis/generic-fn-op-name.rs

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
// Test that generic functions' `OpName` correctly include generic arguments.
2+
3+
// build-pass
4+
// compile-flags: -C llvm-args=--disassemble-globals
5+
// normalize-stderr-test "OpCapability VulkanMemoryModel\n" -> ""
6+
// normalize-stderr-test "OpExtension .SPV_KHR_vulkan_memory_model.\n" -> ""
7+
// normalize-stderr-test "OpMemoryModel Logical Vulkan" -> "OpMemoryModel Logical Simple"
8+
9+
#![feature(const_generics)]
10+
#![allow(incomplete_features)]
11+
12+
use spirv_std::image::Dimensionality;
13+
14+
fn generic<T, const DIM: Dimensionality>() {}
15+
16+
#[spirv(fragment)]
17+
pub fn main() {
18+
generic::<f32, { Dimensionality::TwoD }>();
19+
}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
OpCapability Float64
2+
OpCapability Int16
3+
OpCapability Int64
4+
OpCapability Int8
5+
OpCapability Shader
6+
OpMemoryModel Logical Simple
7+
OpEntryPoint Fragment %1 "main"
8+
OpExecutionMode %1 OriginUpperLeft
9+
%2 = OpString "$OPSTRING_FILENAME/generic-fn-op-name.rs"
10+
OpName %3 "generic_fn_op_name::generic"
11+
OpName %4 "generic_fn_op_name::main"
12+
%5 = OpTypeVoid
13+
%6 = OpTypeFunction %5

0 commit comments

Comments
 (0)