From 75481ea3b0654eeb727cabc718258984e7753e02 Mon Sep 17 00:00:00 2001 From: Yong He Date: Wed, 9 Oct 2024 17:15:20 -0700 Subject: Support constant folding for static array access. (#5248) * Support constant folding for static array access. * Fix test. --- .../constants/static-array-indexing.slang | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 tests/language-feature/constants/static-array-indexing.slang (limited to 'tests/language-feature') diff --git a/tests/language-feature/constants/static-array-indexing.slang b/tests/language-feature/constants/static-array-indexing.slang new file mode 100644 index 000000000..0a7963b34 --- /dev/null +++ b/tests/language-feature/constants/static-array-indexing.slang @@ -0,0 +1,18 @@ +//TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK): + +int check() +{ + return v; +} + +//TEST_INPUT:ubuffer(data=[0], stride=4):out,name=outputBuffer +RWStructuredBuffer outputBuffer; + +[numthreads(1, 1, 1)] +void computeMain(int3 dispatchThreadID : SV_DispatchThreadID) +{ + int tid = dispatchThreadID.x; + const int a[] = { 1, 2, 3, 4 }; + // CHECK: 4 + outputBuffer[tid] = check(); +} -- cgit v1.2.3