summaryrefslogtreecommitdiffstats
path: root/tests/language-feature/function-calls/forceinline-basic-block.slang
diff options
context:
space:
mode:
Diffstat (limited to 'tests/language-feature/function-calls/forceinline-basic-block.slang')
-rw-r--r--tests/language-feature/function-calls/forceinline-basic-block.slang37
1 files changed, 37 insertions, 0 deletions
diff --git a/tests/language-feature/function-calls/forceinline-basic-block.slang b/tests/language-feature/function-calls/forceinline-basic-block.slang
new file mode 100644
index 000000000..32e8faef5
--- /dev/null
+++ b/tests/language-feature/function-calls/forceinline-basic-block.slang
@@ -0,0 +1,37 @@
+//TEST:SIMPLE(filecheck=CHECK): -stage compute -entry computeMain -target spirv -O0 -g3
+RWStructuredBuffer<int> outputBuffer;
+
+[ForceInline]
+int inlineSingleBasicBlock1(int value1, int value2)
+{
+ // Simple operation that should be inlined
+ return value1 * 2 + value2;
+}
+
+[ForceInline]
+int inlineSingleBasicBlock2(int value1, int value2)
+{
+ int result1 = inlineSingleBasicBlock1(10, 20);
+ // Simple operation that should be inlined
+ return value1 * 2 + value2 + result1;
+}
+
+
+[numthreads(4, 1, 1)]
+void computeMain(uint3 dispatchThreadID : SV_DispatchThreadID)
+{
+ int i = dispatchThreadID.x;
+
+ // Call the forceinline function
+ int result = inlineSingleBasicBlock2(16, 10);
+
+ outputBuffer[i] = result;
+}
+
+
+// CHECK-COUNT-2: %{{[0-9]+}} = OpExtInst %void %{{[0-9]+}} DebugInlinedAt %uint_{{[0-9]+}} %{{[0-9]+}}
+// CHECK-NOT: %{{[0-9]+}} = OpExtInst %void %{{[0-9]+}} DebugInlinedAt %uint_{{[0-9]+}} %{{[0-9]+}}
+// CHECK-COUNT-3: %{{[0-9]+}} = OpExtInst %void %{{[0-9]+}} DebugScope %{{[0-9]+}} %{{[0-9]+}}
+// CHECK-NOT: %{{[0-9]+}} = OpExtInst %void %{{[0-9]+}} DebugScope %{{[0-9]+}} %{{[0-9]+}}
+// CHECK-COUNT-1: %{{[0-9]+}} = OpExtInst %void %{{[0-9]+}} DebugNoScope
+// CHECK-NOT: %{{[0-9]+}} = OpExtInst %void %{{[0-9]+}} DebugNoScope \ No newline at end of file