1 // RUN: %clang_cc1 -triple dxil-pc-shadermodel6.3-library -x hlsl -emit-llvm -finclude-default-header -disable-llvm-passes -o - %s
\r
3 // Make sure SV_DispatchThreadID translated into dx.thread.id.
\r
5 const RWBuffer<float> In;
\r
8 // CHECK: define void @foo()
\r
9 // CHECK: %[[ID:[0-9a-zA-Z]+]] = call i32 @llvm.dx.thread.id(i32 0)
\r
10 // CHECK: call void @"?foo@@YAXH@Z"(i32 %[[ID]])
\r
13 void foo(uint Idx : SV_DispatchThreadID) {
\r
17 // CHECK: define void @bar()
\r
18 // CHECK: %[[ID_X:[0-9a-zA-Z]+]] = call i32 @llvm.dx.thread.id(i32 0)
\r
19 // CHECK: %[[ID_X_:[0-9a-zA-Z]+]] = insertelement <2 x i32> poison, i32 %[[ID_X]], i64 0
\r
20 // CHECK: %[[ID_Y:[0-9a-zA-Z]+]] = call i32 @llvm.dx.thread.id(i32 1)
\r
21 // CHECK: %[[ID_XY:[0-9a-zA-Z]+]] = insertelement <2 x i32> %[[ID_X_]], i32 %[[ID_Y]], i64 1
\r
22 // CHECK: call void @"?bar@@YAXT?$__vector@H$01@__clang@@@Z"(<2 x i32> %[[ID_XY]])
\r
25 void bar(uint2 Idx : SV_DispatchThreadID) {
\r
26 Out[Idx.y] = In[Idx.x];
\r