| 1 |
; RUN: llc -O0 -verify-machineinstrs -mtriple=spirv-vulkan1.3-unknown %s -o - | FileCheck %s |
| 2 |
; RUN: %if spirv-tools %{ llc -O0 -mtriple=spirv-vulkan1.3-unknown %s -o - -filetype=obj | spirv-val --target-env vulkan1.3 %} |
| 3 |
|
| 4 |
; CHECK-DAG: %[[#int:]] = OpTypeInt 32 0 |
| 5 |
; CHECK-DAG: %[[#ptr_Input_int:]] = OpTypePointer Input %[[#int]] |
| 6 |
; CHECK-DAG: %[[#LocalInvocationIndex:]] = OpVariable %[[#ptr_Input_int]] Input |
| 7 |
|
| 8 |
; CHECK-DAG: OpEntryPoint GLCompute {{.*}} %[[#LocalInvocationIndex]] |
| 9 |
; CHECK-DAG: OpName %[[#LocalInvocationIndex]] "__spirv_BuiltInLocalInvocationIndex" |
| 10 |
; CHECK-DAG: OpDecorate %[[#LocalInvocationIndex]] BuiltIn LocalInvocationIndex |
| 11 |
|
| 12 |
target triple = "spirv-unknown-vulkan-library" |
| 13 |
|
| 14 |
define internal void @local_index_user(i32) { |
| 15 |
entry: |
| 16 |
ret void |
| 17 |
} |
| 18 |
|
| 19 |
; Function Attrs: convergent noinline norecurse |
| 20 |
define void @main() #1 { |
| 21 |
entry: |
| 22 |
|
| 23 |
; CHECK: %[[#load:]] = OpLoad %[[#int]] %[[#LocalInvocationIndex]] |
| 24 |
%1 = call i32 @llvm.spv.flattened.thread.id.in.group() |
| 25 |
|
| 26 |
call spir_func void @local_index_user(i32 %1) |
| 27 |
ret void |
| 28 |
} |
| 29 |
|
| 30 |
; Function Attrs: nounwind willreturn memory(none) |
| 31 |
declare i32 @llvm.spv.flattened.thread.id.in.group() #3 |
| 32 |
|
| 33 |
attributes #1 = { convergent noinline norecurse "hlsl.numthreads"="1,1,1" "hlsl.shader"="compute" "no-trapping-math"="true" "stack-protector-buffer-size"="8" } |
| 34 |
attributes #3 = { nounwind willreturn memory(none) } |