From 47a917c964f4fda32d75f200efe863f6d68c737c Mon Sep 17 00:00:00 2001 From: Yong He Date: Fri, 3 May 2024 12:18:47 -0700 Subject: Fix `Ptr::__subscript` to accept any integer index. (#4100) * Fix `Ptr::__subscript` to accept any integer index. * Fix `Ptr::__subscript` to allow 64bit indices. --- tests/spirv/ptr-subscript.slang | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 tests/spirv/ptr-subscript.slang (limited to 'tests/spirv') diff --git a/tests/spirv/ptr-subscript.slang b/tests/spirv/ptr-subscript.slang new file mode 100644 index 000000000..0b30fe98e --- /dev/null +++ b/tests/spirv/ptr-subscript.slang @@ -0,0 +1,12 @@ +//TEST:SIMPLE(filecheck=CHECK): -target spirv -entry main -stage compute -emit-spirv-directly + +// CHECK: OpEntryPoint + +ConstantBuffer> cbPtr; +void main(int id : SV_DispatchThreadID) +{ + // Check that the index operand is translated directly into a 64bit integer + // in th resulting SPIR-V without any truncations. + // CHECK: OpPtrAccessChain %_ptr_PhysicalStorageBuffer_int %{{.*}} %long_123 + cbPtr[123ll] = 4; +} -- cgit v1.2.3