forked from OSchip/llvm-project
[mlir][StandardToSPIRV] Extend support for lowering cmpi to SPIRV.
The logic of vector on boolean was missed. This patch adds the logic and test on it. Reviewed By: mravishankar Differential Revision: https://reviews.llvm.org/D91403
This commit is contained in:
parent
02bdbdc760
commit
47fd19f22e
|
@ -767,8 +767,7 @@ BoolCmpIOpPattern::matchAndRewrite(CmpIOp cmpIOp, ArrayRef<Value> operands,
|
|||
CmpIOpAdaptor cmpIOpOperands(operands);
|
||||
|
||||
Type operandType = cmpIOp.lhs().getType();
|
||||
if (!operandType.isa<IntegerType>() ||
|
||||
operandType.cast<IntegerType>().getWidth() != 1)
|
||||
if (!isBoolScalarOrVector(operandType))
|
||||
return failure();
|
||||
|
||||
switch (cmpIOp.getPredicate()) {
|
||||
|
@ -794,8 +793,7 @@ CmpIOpPattern::matchAndRewrite(CmpIOp cmpIOp, ArrayRef<Value> operands,
|
|||
CmpIOpAdaptor cmpIOpOperands(operands);
|
||||
|
||||
Type operandType = cmpIOp.lhs().getType();
|
||||
if (operandType.isa<IntegerType>() &&
|
||||
operandType.cast<IntegerType>().getWidth() == 1)
|
||||
if (isBoolScalarOrVector(operandType))
|
||||
return failure();
|
||||
|
||||
switch (cmpIOp.getPredicate()) {
|
||||
|
|
|
@ -327,6 +327,15 @@ func @boolcmpi(%arg0 : i1, %arg1 : i1) {
|
|||
return
|
||||
}
|
||||
|
||||
// CHECK-LABEL: @vecboolcmpi
|
||||
func @vecboolcmpi(%arg0 : vector<4xi1>, %arg1 : vector<4xi1>) {
|
||||
// CHECK: spv.LogicalEqual
|
||||
%0 = cmpi "eq", %arg0, %arg1 : vector<4xi1>
|
||||
// CHECK: spv.LogicalNotEqual
|
||||
%1 = cmpi "ne", %arg0, %arg1 : vector<4xi1>
|
||||
return
|
||||
}
|
||||
|
||||
} // end module
|
||||
|
||||
// -----
|
||||
|
|
Loading…
Reference in New Issue