| 1 |
; RUN: llc -O0 -verify-machineinstrs -mtriple=spirv-vulkan-unknown %s -o - | FileCheck %s |
| 2 |
; RUN: %if spirv-tools %{ llc -O0 -mtriple=spirv-vulkan-unknown %s -o - -filetype=obj | spirv-val %} |
| 3 |
|
| 4 |
; This file generated from the following command: |
| 5 |
; clang -cc1 -triple spirv-vulkan-library -x hlsl -emit-llvm -disable-llvm-passes -finclude-default-header - -o - <<EOF |
| 6 |
; [shader("compute")] |
| 7 |
; [numthreads(1,1,1)] |
| 8 |
; void main(uint3 ID : SV_GroupThreadID) {} |
| 9 |
; EOF |
| 10 |
|
| 11 |
; CHECK-DAG: %[[#int:]] = OpTypeInt 32 0 |
| 12 |
; CHECK-DAG: %[[#v3int:]] = OpTypeVector %[[#int]] 3 |
| 13 |
; CHECK-DAG: %[[#ptr_Input_v3int:]] = OpTypePointer Input %[[#v3int]] |
| 14 |
; CHECK-DAG: %[[#tempvar:]] = OpUndef %[[#v3int]] |
| 15 |
; CHECK-DAG: %[[#LocalInvocationId:]] = OpVariable %[[#ptr_Input_v3int]] Input |
| 16 |
|
| 17 |
; CHECK-DAG: OpEntryPoint GLCompute {{.*}} %[[#LocalInvocationId]] |
| 18 |
; CHECK-DAG: OpName %[[#LocalInvocationId]] "__spirv_BuiltInLocalInvocationId" |
| 19 |
; CHECK-DAG: OpDecorate %[[#LocalInvocationId]] BuiltIn LocalInvocationId |
| 20 |
|
| 21 |
; ModuleID = '-' |
| 22 |
source_filename = "-" |
| 23 |
target datalayout = "e-i64:64-v16:16-v24:32-v32:32-v48:64-v96:128-v192:256-v256:256-v512:512-v1024:1024" |
| 24 |
target triple = "spirv-unknown-vulkan-library" |
| 25 |
|
| 26 |
; Function Attrs: noinline norecurse nounwind optnone |
| 27 |
define internal spir_func void @main(<3 x i32> noundef %ID) #0 { |
| 28 |
entry: |
| 29 |
%ID.addr = alloca <3 x i32>, align 16 |
| 30 |
store <3 x i32> %ID, ptr %ID.addr, align 16 |
| 31 |
ret void |
| 32 |
} |
| 33 |
|
| 34 |
; Function Attrs: norecurse |
| 35 |
define void @main.1() #1 { |
| 36 |
entry: |
| 37 |
|
| 38 |
; CHECK: %[[#load:]] = OpLoad %[[#v3int]] %[[#LocalInvocationId]] |
| 39 |
; CHECK: %[[#load0:]] = OpCompositeExtract %[[#int]] %[[#load]] 0 |
| 40 |
%0 = call i32 @llvm.spv.thread.id.in.group.i32(i32 0) |
| 41 |
|
| 42 |
; CHECK: %[[#tempvar:]] = OpCompositeInsert %[[#v3int]] %[[#load0]] %[[#tempvar]] 0 |
| 43 |
%1 = insertelement <3 x i32> poison, i32 %0, i64 0 |
| 44 |
|
| 45 |
; CHECK: %[[#load:]] = OpLoad %[[#v3int]] %[[#LocalInvocationId]] |
| 46 |
; CHECK: %[[#load1:]] = OpCompositeExtract %[[#int]] %[[#load]] 1 |
| 47 |
%2 = call i32 @llvm.spv.thread.id.in.group.i32(i32 1) |
| 48 |
|
| 49 |
; CHECK: %[[#tempvar:]] = OpCompositeInsert %[[#v3int]] %[[#load1]] %[[#tempvar]] 1 |
| 50 |
%3 = insertelement <3 x i32> %1, i32 %2, i64 1 |
| 51 |
|
| 52 |
; CHECK: %[[#load:]] = OpLoad %[[#v3int]] %[[#LocalInvocationId]] |
| 53 |
; CHECK: %[[#load2:]] = OpCompositeExtract %[[#int]] %[[#load]] 2 |
| 54 |
%4 = call i32 @llvm.spv.thread.id.in.group.i32(i32 2) |
| 55 |
|
| 56 |
; CHECK: %[[#tempvar:]] = OpCompositeInsert %[[#v3int]] %[[#load2]] %[[#tempvar]] 2 |
| 57 |
%5 = insertelement <3 x i32> %3, i32 %4, i64 2 |
| 58 |
|
| 59 |
call void @main(<3 x i32> %5) |
| 60 |
ret void |
| 61 |
} |
| 62 |
|
| 63 |
; Function Attrs: nounwind willreturn memory(none) |
| 64 |
declare i32 @llvm.spv.thread.id.in.group.i32(i32) #2 |
| 65 |
|
| 66 |
attributes #0 = { noinline norecurse nounwind optnone "no-trapping-math"="true" "stack-protector-buffer-size"="8" } |
| 67 |
attributes #1 = { norecurse "hlsl.numthreads"="1,1,1" "hlsl.shader"="compute" "no-trapping-math"="true" "stack-protector-buffer-size"="8" } |
| 68 |
attributes #2 = { nounwind willreturn memory(none) } |
| 69 |
|
| 70 |
!llvm.module.flags = !{!0, !1} |
| 71 |
!llvm.ident = !{!2} |
| 72 |
|
| 73 |
!0 = !{i32 1, !"wchar_size", i32 4} |
| 74 |
!1 = !{i32 4, !"dx.disable_optimizations", i32 1} |
| 75 |
!2 = !{!"clang version 19.0.0git ([email protected]:llvm/llvm-project.git 91600507765679e92434ec7c5edb883bf01f847f)"} |