69 lines · plain
1; RUN: llc -O0 -verify-machineinstrs -mtriple=spirv-vulkan-unknown %s -o - | FileCheck %s2; 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-compute -x hlsl -emit-llvm -finclude-default-header -o - - <<EOF6; [numthreads(1, 1, 1)]7; void main() {8; int idx = WaveGetLaneIndex();9; }10; EOF11 12; CHECK-DAG: OpCapability Shader13; CHECK-DAG: OpCapability GroupNonUniform14; CHECK-DAG: OpDecorate %[[#var:]] BuiltIn SubgroupLocalInvocationId15; CHECK-DAG: %[[#int:]] = OpTypeInt 32 016; CHECK-DAG: %[[#ptri:]] = OpTypePointer Input %[[#int]]17; CHECK-DAG: %[[#ptrf:]] = OpTypePointer Function %[[#int]]18; CHECK-DAG: %[[#var]] = OpVariable %[[#ptri]] Input19 20; CHECK-NOT: OpDecorate %[[#var]] LinkageAttributes21 22 23; ModuleID = '-'24source_filename = "-"25target datalayout = "e-i64:64-v16:16-v24:32-v32:32-v48:64-v96:128-v192:256-v256:256-v512:512-v1024:1024"26target triple = "spirv-unknown-vulkan-compute"27 28; Function Attrs: convergent noinline norecurse nounwind optnone29define internal spir_func void @main() #0 {30entry:31 %0 = call token @llvm.experimental.convergence.entry()32 %idx = alloca i32, align 433; CHECK: %[[#idx:]] = OpVariable %[[#ptrf]] Function34 35 %1 = call i32 @__hlsl_wave_get_lane_index() [ "convergencectrl"(token %0) ]36; CHECK: %[[#tmp:]] = OpLoad %[[#int]] %[[#var]]37 38 store i32 %1, ptr %idx, align 439; CHECK: OpStore %[[#idx]] %[[#tmp]]40 41 ret void42}43 44; Function Attrs: norecurse45define void @main.1() #1 {46entry:47 call void @main()48 ret void49}50 51; Function Attrs: convergent52declare i32 @__hlsl_wave_get_lane_index() #253 54; Function Attrs: convergent nocallback nofree nosync nounwind willreturn memory(none)55declare token @llvm.experimental.convergence.entry() #356 57attributes #0 = { convergent noinline norecurse nounwind optnone "no-trapping-math"="true" "stack-protector-buffer-size"="8" }58attributes #1 = { norecurse "hlsl.numthreads"="1,1,1" "hlsl.shader"="compute" "no-trapping-math"="true" "stack-protector-buffer-size"="8" }59attributes #2 = { convergent }60attributes #3 = { convergent nocallback nofree nosync nounwind willreturn memory(none) }61 62!llvm.module.flags = !{!0, !1}63!llvm.ident = !{!2}64 65!0 = !{i32 1, !"wchar_size", i32 4}66!1 = !{i32 4, !"dx.disable_optimizations", i32 1}67!2 = !{!"clang version 19.0.0git (/usr/local/google/home/nathangauer/projects/llvm-project/clang bc6fd04b73a195981ee77823cf1382d04ab96c44)"}68 69