[clang] [HLSL] Implement SV_GroupID semantic (PR #115911)
Zhengxing li via cfe-commits
cfe-commits at lists.llvm.org
Wed Nov 13 14:08:13 PST 2024
================
@@ -0,0 +1,21 @@
+// RUN: %clang_cc1 -triple dxil-pc-shadermodel6.3-library -x hlsl -emit-llvm -finclude-default-header -disable-llvm-passes -o - %s | FileCheck %s
+
+// Make sure SV_GroupID translated into dx.group.id.
+
+// CHECK: define void @foo()
+// CHECK: %[[#ID:]] = call i32 @llvm.dx.group.id(i32 0)
+// CHECK: call void @{{.*}}foo{{.*}}(i32 %[[#ID]])
+[shader("compute")]
+[numthreads(8,8,1)]
+void foo(uint Idx : SV_GroupID) {}
+
+// CHECK: define void @bar()
+// CHECK: %[[#ID_X:]] = call i32 @llvm.dx.group.id(i32 0)
+// CHECK: %[[#ID_X_:]] = insertelement <2 x i32> poison, i32 %[[#ID_X]], i64 0
+// CHECK: %[[#ID_Y:]] = call i32 @llvm.dx.group.id(i32 1)
+// CHECK: %[[#ID_XY:]] = insertelement <2 x i32> %[[#ID_X_]], i32 %[[#ID_Y]], i64 1
+// CHECK: call void @{{.*}}bar{{.*}}(<2 x i32> %[[#ID_XY]])
+[shader("compute")]
+[numthreads(8,8,1)]
+void bar(uint2 Idx : SV_GroupID) {}
----------------
lizhengxing wrote:
Add the unit3 case in the test.
https://github.com/llvm/llvm-project/pull/115911
More information about the cfe-commits
mailing list