1 // RUN: mlir-opt -mlir-disable-threading -test-spirv-op-availability %s | FileCheck %s
4 func.func @iadd(%arg: i32) -> i32 {
5 // CHECK: min version: v1.0
6 // CHECK: max version: v1.6
7 // CHECK: extensions: [ ]
8 // CHECK: capabilities: [ ]
9 %0 = spirv.IAdd %arg, %arg: i32
13 // CHECK: atomic_compare_exchange_weak
14 func.func @atomic_compare_exchange_weak(%ptr: !spirv.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 = spirv.AtomicCompareExchangeWeak <Workgroup> <Release> <Acquire> %ptr, %value, %comparator: !spirv.ptr<i32, Workgroup>
23 // CHECK-LABEL: subgroup_ballot
24 func.func @subgroup_ballot(%predicate: i1) -> vector<4xi32> {
25 // CHECK: min version: v1.3
26 // CHECK: max version: v1.6
27 // CHECK: extensions: [ ]
28 // CHECK: capabilities: [ [GroupNonUniformBallot] ]
29 %0 = spirv.GroupNonUniformBallot <Workgroup> %predicate : vector<4xi32>
30 return %0: vector<4xi32>
33 // CHECK-LABEL: module_logical_glsl450
34 func.func @module_logical_glsl450() {
35 // CHECK: spirv.module min version: v1.0
36 // CHECK: spirv.module max version: v1.6
37 // CHECK: spirv.module extensions: [ ]
38 // CHECK: spirv.module capabilities: [ [Shader] ]
39 spirv.module Logical GLSL450 { }
43 // CHECK-LABEL: module_physical_storage_buffer64_vulkan
44 func.func @module_physical_storage_buffer64_vulkan() {
45 // CHECK: spirv.module min version: v1.0
46 // CHECK: spirv.module max version: v1.6
47 // CHECK: spirv.module extensions: [ [SPV_EXT_physical_storage_buffer, SPV_KHR_physical_storage_buffer] [SPV_KHR_vulkan_memory_model] ]
48 // CHECK: spirv.module capabilities: [ [PhysicalStorageBufferAddresses] [VulkanMemoryModel] ]
49 spirv.module PhysicalStorageBuffer64 Vulkan { }
53 //===----------------------------------------------------------------------===//
54 // Integer Dot Product ops
55 //===----------------------------------------------------------------------===//
57 // CHECK-LABEL: sdot_scalar_i32_i32
58 func.func @sdot_scalar_i32_i32(%a: i32) -> i32 {
59 // CHECK: min version: v1.0
60 // CHECK: max version: v1.6
61 // CHECK: extensions: [ [SPV_KHR_integer_dot_product] ]
62 // CHECK: capabilities: [ [DotProduct] [DotProductInput4x8BitPacked] ]
63 %r = spirv.SDot %a, %a, <PackedVectorFormat4x8Bit>: i32 -> i32
67 // CHECK-LABEL: sdot_vector_4xi8_i64
68 func.func @sdot_vector_4xi8_i64(%a: vector<4xi8>) -> i64 {
69 // CHECK: min version: v1.0
70 // CHECK: max version: v1.6
71 // CHECK: extensions: [ [SPV_KHR_integer_dot_product] ]
72 // CHECK: capabilities: [ [DotProduct] [DotProductInput4x8Bit] ]
73 %r = spirv.SDot %a, %a: vector<4xi8> -> i64
77 // CHECK-LABEL: sdot_vector_4xi16_i64
78 func.func @sdot_vector_4xi16_i64(%a: vector<4xi16>) -> i64 {
79 // CHECK: min version: v1.0
80 // CHECK: max version: v1.6
81 // CHECK: extensions: [ [SPV_KHR_integer_dot_product] ]
82 // CHECK: capabilities: [ [DotProduct] [DotProductInputAll] ]
83 %r = spirv.SDot %a, %a: vector<4xi16> -> i64
87 // CHECK-LABEL: sudot_scalar_i32_i32
88 func.func @sudot_scalar_i32_i32(%a: i32) -> i32 {
89 // CHECK: min version: v1.0
90 // CHECK: max version: v1.6
91 // CHECK: extensions: [ [SPV_KHR_integer_dot_product] ]
92 // CHECK: capabilities: [ [DotProduct] [DotProductInput4x8BitPacked] ]
93 %r = spirv.SUDot %a, %a, <PackedVectorFormat4x8Bit>: i32 -> i32
97 // CHECK-LABEL: sudot_vector_4xi8_i64
98 func.func @sudot_vector_4xi8_i64(%a: vector<4xi8>) -> i64 {
99 // CHECK: min version: v1.0
100 // CHECK: max version: v1.6
101 // CHECK: extensions: [ [SPV_KHR_integer_dot_product] ]
102 // CHECK: capabilities: [ [DotProduct] [DotProductInput4x8Bit] ]
103 %r = spirv.SUDot %a, %a: vector<4xi8> -> i64
107 // CHECK-LABEL: sudot_vector_4xi16_i64
108 func.func @sudot_vector_4xi16_i64(%a: vector<4xi16>) -> i64 {
109 // CHECK: min version: v1.0
110 // CHECK: max version: v1.6
111 // CHECK: extensions: [ [SPV_KHR_integer_dot_product] ]
112 // CHECK: capabilities: [ [DotProduct] [DotProductInputAll] ]
113 %r = spirv.SUDot %a, %a: vector<4xi16> -> i64
117 // CHECK-LABEL: udot_scalar_i32_i32
118 func.func @udot_scalar_i32_i32(%a: i32) -> i32 {
119 // CHECK: min version: v1.0
120 // CHECK: max version: v1.6
121 // CHECK: extensions: [ [SPV_KHR_integer_dot_product] ]
122 // CHECK: capabilities: [ [DotProduct] [DotProductInput4x8BitPacked] ]
123 %r = spirv.UDot %a, %a, <PackedVectorFormat4x8Bit>: i32 -> i32
127 // CHECK-LABEL: udot_vector_4xi8_i64
128 func.func @udot_vector_4xi8_i64(%a: vector<4xi8>) -> i64 {
129 // CHECK: min version: v1.0
130 // CHECK: max version: v1.6
131 // CHECK: extensions: [ [SPV_KHR_integer_dot_product] ]
132 // CHECK: capabilities: [ [DotProduct] [DotProductInput4x8Bit] ]
133 %r = spirv.UDot %a, %a: vector<4xi8> -> i64
137 // CHECK-LABEL: udot_vector_4xi16_i64
138 func.func @udot_vector_4xi16_i64(%a: vector<4xi16>) -> i64 {
139 // CHECK: min version: v1.0
140 // CHECK: max version: v1.6
141 // CHECK: extensions: [ [SPV_KHR_integer_dot_product] ]
142 // CHECK: capabilities: [ [DotProduct] [DotProductInputAll] ]
143 %r = spirv.UDot %a, %a: vector<4xi16> -> i64
147 // CHECK-LABEL: sdot_acc_sat_scalar_i32_i32
148 func.func @sdot_acc_sat_scalar_i32_i32(%a: i32) -> i32 {
149 // CHECK: min version: v1.0
150 // CHECK: max version: v1.6
151 // CHECK: extensions: [ [SPV_KHR_integer_dot_product] ]
152 // CHECK: capabilities: [ [DotProduct] [DotProductInput4x8BitPacked] ]
153 %r = spirv.SDotAccSat %a, %a, %a, <PackedVectorFormat4x8Bit>: i32 -> i32
157 // CHECK-LABEL: sdot_acc_sat_vector_4xi8_i64
158 func.func @sdot_acc_sat_vector_4xi8_i64(%a: vector<4xi8>, %acc: i64) -> i64 {
159 // CHECK: min version: v1.0
160 // CHECK: max version: v1.6
161 // CHECK: extensions: [ [SPV_KHR_integer_dot_product] ]
162 // CHECK: capabilities: [ [DotProduct] [DotProductInput4x8Bit] ]
163 %r = spirv.SDotAccSat %a, %a, %acc: vector<4xi8> -> i64
167 // CHECK-LABEL: sdot_acc_sat_vector_4xi16_i64
168 func.func @sdot_acc_sat_vector_4xi16_i64(%a: vector<4xi16>, %acc: i64) -> i64 {
169 // CHECK: min version: v1.0
170 // CHECK: max version: v1.6
171 // CHECK: extensions: [ [SPV_KHR_integer_dot_product] ]
172 // CHECK: capabilities: [ [DotProduct] [DotProductInputAll] ]
173 %r = spirv.SDotAccSat %a, %a, %acc: vector<4xi16> -> i64
177 // CHECK-LABEL: sudot_acc_sat_scalar_i32_i32
178 func.func @sudot_acc_sat_scalar_i32_i32(%a: i32) -> i32 {
179 // CHECK: min version: v1.0
180 // CHECK: max version: v1.6
181 // CHECK: extensions: [ [SPV_KHR_integer_dot_product] ]
182 // CHECK: capabilities: [ [DotProduct] [DotProductInput4x8BitPacked] ]
183 %r = spirv.SUDotAccSat %a, %a, %a, <PackedVectorFormat4x8Bit>: i32 -> i32
187 // CHECK-LABEL: sudot_acc_sat_vector_4xi8_i64
188 func.func @sudot_acc_sat_vector_4xi8_i64(%a: vector<4xi8>, %acc: i64) -> i64 {
189 // CHECK: min version: v1.0
190 // CHECK: max version: v1.6
191 // CHECK: extensions: [ [SPV_KHR_integer_dot_product] ]
192 // CHECK: capabilities: [ [DotProduct] [DotProductInput4x8Bit] ]
193 %r = spirv.SUDotAccSat %a, %a, %acc: vector<4xi8> -> i64
197 // CHECK-LABEL: sudot_acc_sat_vector_4xi16_i64
198 func.func @sudot_acc_sat_vector_4xi16_i64(%a: vector<4xi16>, %acc: i64) -> i64 {
199 // CHECK: min version: v1.0
200 // CHECK: max version: v1.6
201 // CHECK: extensions: [ [SPV_KHR_integer_dot_product] ]
202 // CHECK: capabilities: [ [DotProduct] [DotProductInputAll] ]
203 %r = spirv.SUDotAccSat %a, %a, %acc: vector<4xi16> -> i64
207 // CHECK-LABEL: udot_acc_sat_scalar_i32_i32
208 func.func @udot_acc_sat_scalar_i32_i32(%a: i32) -> i32 {
209 // CHECK: min version: v1.0
210 // CHECK: max version: v1.6
211 // CHECK: extensions: [ [SPV_KHR_integer_dot_product] ]
212 // CHECK: capabilities: [ [DotProduct] [DotProductInput4x8BitPacked] ]
213 %r = spirv.UDotAccSat %a, %a, %a, <PackedVectorFormat4x8Bit>: i32 -> i32
217 // CHECK-LABEL: udot_acc_sat_vector_4xi8_i64
218 func.func @udot_acc_sat_vector_4xi8_i64(%a: vector<4xi8>, %acc: i64) -> i64 {
219 // CHECK: min version: v1.0
220 // CHECK: max version: v1.6
221 // CHECK: extensions: [ [SPV_KHR_integer_dot_product] ]
222 // CHECK: capabilities: [ [DotProduct] [DotProductInput4x8Bit] ]
223 %r = spirv.UDotAccSat %a, %a, %acc: vector<4xi8> -> i64
227 // CHECK-LABEL: udot_acc_sat_vector_4xi16_i64
228 func.func @udot_acc_sat_vector_4xi16_i64(%a: vector<4xi16>, %acc: i64) -> i64 {
229 // CHECK: min version: v1.0
230 // CHECK: max version: v1.6
231 // CHECK: extensions: [ [SPV_KHR_integer_dot_product] ]
232 // CHECK: capabilities: [ [DotProduct] [DotProductInputAll] ]
233 %r = spirv.UDotAccSat %a, %a, %acc: vector<4xi16> -> i64