1// RUN: mlir-opt -mlir-disable-threading -test-spirv-op-availability %s | FileCheck %s
2
3// CHECK-LABEL: iadd
4func @iadd(%arg: i32) -> i32 {
5  // CHECK: min version: v1.0
6  // CHECK: max version: v1.5
7  // CHECK: extensions: [ ]
8  // CHECK: capabilities: [ ]
9  %0 = spv.IAdd %arg, %arg: i32
10  return %0: i32
11}
12
13// CHECK: atomic_compare_exchange_weak
14func @atomic_compare_exchange_weak(%ptr: !spv.ptr<i32, Workgroup>, %value: i32, %comparator: i32) -> i32 {
15  // CHECK: min version: v1.0
16  // CHECK: max version: v1.3
17  // CHECK: extensions: [ ]
18  // CHECK: capabilities: [ [Kernel] ]
19  %0 = spv.AtomicCompareExchangeWeak "Workgroup" "Release" "Acquire" %ptr, %value, %comparator: !spv.ptr<i32, Workgroup>
20  return %0: i32
21}
22
23// CHECK-LABEL: subgroup_ballot
24func @subgroup_ballot(%predicate: i1) -> vector<4xi32> {
25  // CHECK: min version: v1.3
26  // CHECK: max version: v1.5
27  // CHECK: extensions: [ ]
28  // CHECK: capabilities: [ [GroupNonUniformBallot] ]
29  %0 = spv.GroupNonUniformBallot Workgroup %predicate : vector<4xi32>
30  return %0: vector<4xi32>
31}
32
33// CHECK-LABEL: module_logical_glsl450
34func @module_logical_glsl450() {
35  // CHECK: spv.module min version: v1.0
36  // CHECK: spv.module max version: v1.5
37  // CHECK: spv.module extensions: [ ]
38  // CHECK: spv.module capabilities: [ [Shader] ]
39  spv.module Logical GLSL450 { }
40  return
41}
42
43// CHECK-LABEL: module_physical_storage_buffer64_vulkan
44func @module_physical_storage_buffer64_vulkan() {
45  // CHECK: spv.module min version: v1.0
46  // CHECK: spv.module max version: v1.5
47  // CHECK: spv.module extensions: [ [SPV_EXT_physical_storage_buffer, SPV_KHR_physical_storage_buffer] [SPV_KHR_vulkan_memory_model] ]
48  // CHECK: spv.module capabilities: [ [PhysicalStorageBufferAddresses] [VulkanMemoryModel] ]
49  spv.module PhysicalStorageBuffer64 Vulkan { }
50  return
51}
52