summaryrefslogtreecommitdiffstats
path: root/tests/spirv/ptr-subscript.slang
diff options
context:
space:
mode:
authorYong He <yonghe@outlook.com>2024-05-03 12:18:47 -0700
committerGitHub <noreply@github.com>2024-05-03 12:18:47 -0700
commit47a917c964f4fda32d75f200efe863f6d68c737c (patch)
tree0957d915e937113af1322e5c0179012074fa7976 /tests/spirv/ptr-subscript.slang
parent13250ffa4d54c4e51b0a6473927e50a5da351ab3 (diff)
Fix `Ptr::__subscript` to accept any integer index. (#4100)
* Fix `Ptr::__subscript` to accept any integer index. * Fix `Ptr::__subscript` to allow 64bit indices.
Diffstat (limited to 'tests/spirv/ptr-subscript.slang')
-rw-r--r--tests/spirv/ptr-subscript.slang12
1 files changed, 12 insertions, 0 deletions
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<Ptr<int>> 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;
+}