1 ; RUN: opt -S -dxil-op-lower %s | FileCheck %s
3 ; Make sure dxil operation function calls for all ComputeID dxil operations are generated.
5 target datalayout = "e-m:e-p:32:32-i1:32-i8:8-i16:16-i32:32-i64:64-f16:16-f32:32-f64:64-n8:16:32:64"
6 target triple = "dxil-pc-shadermodel6.7-compute"
8 ; CHECK-LABEL: @test_thread_id(
9 ; Function Attrs: noinline nounwind optnone
10 define i32 @test_thread_id(i32 %a) #0 {
12 ; CHECK:call i32 @dx.op.threadId.i32(i32 93, i32 %{{.*}})
13 %0 = call i32 @llvm.dx.thread.id(i32 %a)
17 ; CHECK-LABEL: @test_group_id(
18 ; Function Attrs: noinline nounwind optnone
19 define i32 @test_group_id(i32 %a) #0 {
21 ; CHECK: call i32 @dx.op.groupId.i32(i32 94, i32 %{{.*}})
22 %0 = call i32 @llvm.dx.group.id(i32 %a)
26 ; CHECK-LABEL: @test_thread_id_in_group(
27 ; Function Attrs: noinline nounwind optnone
28 define i32 @test_thread_id_in_group(i32 %a) #0 {
30 ; CHECK: call i32 @dx.op.threadIdInGroup.i32(i32 95, i32 %{{.*}})
31 %0 = call i32 @llvm.dx.thread.id.in.group(i32 %a)
35 ; CHECK-LABEL: @test_flattened_thread_id_in_group(
36 ; Function Attrs: noinline nounwind optnone
37 define i32 @test_flattened_thread_id_in_group() #0 {
39 ; CHECK: call i32 @dx.op.flattenedThreadIdInGroup.i32(i32 96)
40 %0 = call i32 @llvm.dx.flattened.thread.id.in.group()
44 ; Function Attrs: nounwind readnone willreturn
45 declare i32 @llvm.dx.thread.id(i32) #1
46 declare i32 @llvm.dx.group.id(i32) #1
47 declare i32 @llvm.dx.flattened.thread.id.in.group() #1
48 declare i32 @llvm.dx.thread.id.in.group(i32) #1
50 attributes #0 = { noinline nounwind }
51 attributes #1 = { nounwind readnone willreturn }