1// RUN: mlir-translate -test-spirv-roundtrip -split-input-file %s | FileCheck %s 2 3spv.module Logical GLSL450 requires #spv.vce<v1.0, [Shader], []> { 4 // CHECK-LABEL: @atomic_compare_exchange_weak 5 spv.func @atomic_compare_exchange_weak(%ptr: !spv.ptr<i32, Workgroup>, %value: i32, %comparator: i32) -> i32 "None" { 6 // CHECK: spv.AtomicCompareExchangeWeak "Workgroup" "Release" "Acquire" %{{.*}}, %{{.*}}, %{{.*}} : !spv.ptr<i32, Workgroup> 7 %0 = spv.AtomicCompareExchangeWeak "Workgroup" "Release" "Acquire" %ptr, %value, %comparator: !spv.ptr<i32, Workgroup> 8 // CHECK: spv.AtomicAnd "Device" "None" %{{.*}}, %{{.*}} : !spv.ptr<i32, Workgroup> 9 %1 = spv.AtomicAnd "Device" "None" %ptr, %value : !spv.ptr<i32, Workgroup> 10 // CHECK: spv.AtomicIAdd "Workgroup" "Acquire" %{{.*}}, %{{.*}} : !spv.ptr<i32, Workgroup> 11 %2 = spv.AtomicIAdd "Workgroup" "Acquire" %ptr, %value : !spv.ptr<i32, Workgroup> 12 // CHECK: spv.AtomicIDecrement "Workgroup" "Acquire" %{{.*}} : !spv.ptr<i32, Workgroup> 13 %3 = spv.AtomicIDecrement "Workgroup" "Acquire" %ptr : !spv.ptr<i32, Workgroup> 14 // CHECK: spv.AtomicIIncrement "Device" "Release" %{{.*}} : !spv.ptr<i32, Workgroup> 15 %4 = spv.AtomicIIncrement "Device" "Release" %ptr : !spv.ptr<i32, Workgroup> 16 // CHECK: spv.AtomicISub "Workgroup" "Acquire" %{{.*}}, %{{.*}} : !spv.ptr<i32, Workgroup> 17 %5 = spv.AtomicISub "Workgroup" "Acquire" %ptr, %value : !spv.ptr<i32, Workgroup> 18 // CHECK: spv.AtomicOr "Workgroup" "AcquireRelease" %{{.*}}, %{{.*}} : !spv.ptr<i32, Workgroup> 19 %6 = spv.AtomicOr "Workgroup" "AcquireRelease" %ptr, %value : !spv.ptr<i32, Workgroup> 20 // CHECK: spv.AtomicSMax "Subgroup" "None" %{{.*}}, %{{.*}} : !spv.ptr<i32, Workgroup> 21 %7 = spv.AtomicSMax "Subgroup" "None" %ptr, %value : !spv.ptr<i32, Workgroup> 22 // CHECK: spv.AtomicSMin "Device" "Release" %{{.*}}, %{{.*}} : !spv.ptr<i32, Workgroup> 23 %8 = spv.AtomicSMin "Device" "Release" %ptr, %value : !spv.ptr<i32, Workgroup> 24 // CHECK: spv.AtomicUMax "Subgroup" "None" %{{.*}}, %{{.*}} : !spv.ptr<i32, Workgroup> 25 %9 = spv.AtomicUMax "Subgroup" "None" %ptr, %value : !spv.ptr<i32, Workgroup> 26 // CHECK: spv.AtomicUMin "Device" "Release" %{{.*}}, %{{.*}} : !spv.ptr<i32, Workgroup> 27 %10 = spv.AtomicUMin "Device" "Release" %ptr, %value : !spv.ptr<i32, Workgroup> 28 // CHECK: spv.AtomicXor "Workgroup" "AcquireRelease" %{{.*}}, %{{.*}} : !spv.ptr<i32, Workgroup> 29 %11 = spv.AtomicXor "Workgroup" "AcquireRelease" %ptr, %value : !spv.ptr<i32, Workgroup> 30 spv.ReturnValue %0: i32 31 } 32} 33