diff --git a/mlir/include/mlir/Dialect/SPIRV/IR/SPIRVLogicalOps.td b/mlir/include/mlir/Dialect/SPIRV/IR/SPIRVLogicalOps.td index 9331fc576c7bd4..179219042c8820 100644 --- a/mlir/include/mlir/Dialect/SPIRV/IR/SPIRVLogicalOps.td +++ b/mlir/include/mlir/Dialect/SPIRV/IR/SPIRVLogicalOps.td @@ -27,7 +27,7 @@ class SPIRV_LogicalBinaryOp])> { let assemblyFormat = "$operand1 `,` $operand2 `:` type($operand1) attr-dict"; } @@ -41,7 +41,7 @@ class SPIRV_LogicalUnaryOp])> { let assemblyFormat = "$operand `:` type($operand) attr-dict"; } diff --git a/mlir/lib/Dialect/SPIRV/IR/SPIRVOpDefinition.cpp b/mlir/lib/Dialect/SPIRV/IR/SPIRVOpDefinition.cpp index ba69fa75cf2b89..b9075da95a6173 100644 --- a/mlir/lib/Dialect/SPIRV/IR/SPIRVOpDefinition.cpp +++ b/mlir/lib/Dialect/SPIRV/IR/SPIRVOpDefinition.cpp @@ -49,8 +49,9 @@ static bool isDirectInModuleLikeOp(Operation *op) { return op && op->hasTrait(); } -/// Result of a logical op must be a scalar or vector of boolean type. -static Type getUnaryOpResultType(Type operandType) { +/// Returns a boolean scalar or vector type matching the shape of the given +/// type. Scalar inputs yield i1, vector inputs yield vector. +static Type getMatchingBoolType(Type operandType) { Builder builder(operandType.getContext()); Type resultType = builder.getIntegerType(1); if (auto vecType = dyn_cast(operandType))