diff --git a/mlir/include/mlir/Dialect/SPIRV/IR/SPIRVCLOps.td b/mlir/include/mlir/Dialect/SPIRV/IR/SPIRVCLOps.td --- a/mlir/include/mlir/Dialect/SPIRV/IR/SPIRVCLOps.td +++ b/mlir/include/mlir/Dialect/SPIRV/IR/SPIRVCLOps.td @@ -78,6 +78,10 @@ list traits = []> : SPIRV_CLOp { + let results = (outs + SPIRV_ScalarOrVectorOf:$result + ); + let hasVerifier = 0; } @@ -806,20 +810,10 @@ - ``` - [TODO] - ``` - #### Example: ```mlir - # TODO - add rest of definitions - # %ptr = OpTypePointer UniformConstant %uchar - # %0 = OpInBoundsPtrAccessChain - # %1 = OpConstant - # %2 = OpConstant - - %2 = spirv.CL.printf %0 %1 %2 : (!spirv.ptr, (i32, i32)) -> i32 + %0 = spirv.CL.printf %0 %1 %2 : (!spirv.ptr, (i32, i32)) -> i32 ``` }]; @@ -829,10 +823,6 @@ Variadic:$arguments ); - let results = (outs - SPIRV_ScalarOrVectorOf:$result - ); - let assemblyFormat = [{ $format `,` $arguments attr-dict `:` `(` type($format) `,` `(` type($arguments) `)` `)` `->` type($result) }]; diff --git a/mlir/test/Dialect/SPIRV/IR/ocl-ops.mlir b/mlir/test/Dialect/SPIRV/IR/ocl-ops.mlir --- a/mlir/test/Dialect/SPIRV/IR/ocl-ops.mlir +++ b/mlir/test/Dialect/SPIRV/IR/ocl-ops.mlir @@ -253,18 +253,10 @@ //===----------------------------------------------------------------------===// // spirv.CL.printf //===----------------------------------------------------------------------===// - -// spirv.GlobalVariable @global_var : !spirv.ptr - -func.func @printf(%ptr : !spirv.ptr, %arg1 : i32) -> () { - // CHECK: spirv.CL.printf {{%.*}}, {{%.*}} : i32 - %0 = spirv.CL.printf %ptr, %arg1 : i32 - return -} - -func.func @printf(%ptr : !spirv.ptr, %arg1 : i32) -> () { - // expected-error @+1 {{op operand #0 must be pointr to constant i8}} - %0 = spirv.CL.printf %ptr, %arg1 : i32 - return +// CHECK-LABEL: func.func @printf( +func.func @printf(%arg0 : !spirv.ptr, %arg1 : i32, %arg2 : i32) -> i32 { + // CHECK: spirv.CL.printf {{%.*}}, {{%.*}}, {{%.*}} : (!spirv.ptr, (i32, i32)) -> i32 + %0 = spirv.CL.printf %arg0, %arg1, %arg2 : (!spirv.ptr, (i32, i32)) -> i32 + return %0 : i32 }