Author: Joshua Batista Date: 2026-08-11T19:47:44Z New Revision: 495cb64816593b2f170d6fa68455e79b26a03f35
URL: https://github.com/llvm/llvm-project/commit/495cb64816593b2f170d6fa68455e79b26a03f35 DIFF: https://github.com/llvm/llvm-project/commit/495cb64816593b2f170d6fa68455e79b26a03f35.diff LOG: Add spirv backend registration guard to syncscope test (#215634) This PR is just a hotfix for a test that assumed the spirv backend was registered, introduced here: https://github.com/llvm/llvm-project/pull/214592 Now we add a guard, so the test will be unsupported and not raise errors on machines that don't have that backend registered. Also improves a check pattern that could mismatch unintentionally. Added: llvm/test/CodeGen/SPIRV/hlsl-intrinsics/InterlockedOr-scope.ll Modified: Removed: clang/test/CodeGenHLSL/builtins/InterlockedOr-SPIRV-scope.hlsl ################################################################################ diff --git a/clang/test/CodeGenHLSL/builtins/InterlockedOr-SPIRV-scope.hlsl b/clang/test/CodeGenHLSL/builtins/InterlockedOr-SPIRV-scope.hlsl deleted file mode 100644 index ea58258bdf701..0000000000000 --- a/clang/test/CodeGenHLSL/builtins/InterlockedOr-SPIRV-scope.hlsl +++ /dev/null @@ -1,17 +0,0 @@ -// RUN: %clang_cc1 -std=hlsl2021 -finclude-default-header -triple \ -// RUN: spirv1.6-unknown-vulkan1.3-compute %s -S -o - | FileCheck %s - -// An Interlocked op on a groupshared destination must use the Workgroup scope -// (2), not CrossDevice (which the backend emits as OpConstantNull). - -groupshared uint gs; - -// CHECK-DAG: %[[#UINT:]] = OpTypeInt 32 0 -// CHECK-DAG: %[[#WORKGROUP:]] = OpConstant %[[#UINT]] 2 -// CHECK: OpAtomicOr %[[#UINT]] %[[#]] %[[#WORKGROUP]] %[[#]] %[[#]] -// CHECK-NOT: OpConstantNull - -[numthreads(1,1,1)] -void main() { - InterlockedOr(gs, 1); -} diff --git a/llvm/test/CodeGen/SPIRV/hlsl-intrinsics/InterlockedOr-scope.ll b/llvm/test/CodeGen/SPIRV/hlsl-intrinsics/InterlockedOr-scope.ll new file mode 100644 index 0000000000000..372ce884aa3e6 --- /dev/null +++ b/llvm/test/CodeGen/SPIRV/hlsl-intrinsics/InterlockedOr-scope.ll @@ -0,0 +1,20 @@ +; RUN: llc -O0 -verify-machineinstrs -mtriple=spirv1.6-unknown-vulkan1.3-compute %s -o - | FileCheck %s +; RUN: %if spirv-tools %{ llc -O0 -mtriple=spirv1.6-unknown-vulkan1.3-compute %s -o - -filetype=obj | spirv-val --target-env vulkan1.3 %} + +; An Interlocked op on a groupshared destination must use the Workgroup scope +; (2), not CrossDevice (which the backend emits as OpConstantNull). + +@gs = external hidden addrspace(3) global i32, align 4 + +; CHECK-DAG: %[[#UINT:]] = OpTypeInt 32 0 +; CHECK-DAG: %[[#WORKGROUP:]] = OpConstant %[[#UINT]] 2{{$}} +; CHECK: OpAtomicOr %[[#UINT]] %[[#]] %[[#WORKGROUP]] %[[#]] %[[#]] +; CHECK-NOT: OpConstantNull + +define void @main() #0 { +entry: + %0 = atomicrmw or ptr addrspace(3) @gs, i32 1 syncscope("workgroup") monotonic, align 4 + ret void +} + +attributes #0 = { convergent noinline norecurse "hlsl.numthreads"="1,1,1" "hlsl.shader"="compute" } _______________________________________________ cfe-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
