[TOSA] Add more tosa::cast type support

pull/1589/head
AmosLewis 2022-11-15 12:23:39 -08:00 committed by Vivek Khandelwal
parent 4aa1e90b34
commit 22a5067242
1 changed files with 5 additions and 2 deletions

View File

@ -222,11 +222,14 @@ llvm::Optional<Value> getConstTensor<float>(PatternRewriter &rewriter,
} }
static LogicalResult checkValidityOfCast(Type src, Type dest) { static LogicalResult checkValidityOfCast(Type src, Type dest) {
if ((src.isInteger(64) && dest.isInteger(32)) || if ((src == dest) ||
(src.isInteger(32) && dest.isInteger(64)) || (src.isInteger(64) && dest.isInteger(32)) ||
(src.isInteger(64) && dest.isInteger(8)) ||
(src.isInteger(64) && dest.isInteger(1)) || (src.isInteger(64) && dest.isInteger(1)) ||
(src.isInteger(32) && dest.isInteger(64)) ||
(src.isInteger(32) && dest.isInteger(1)) || (src.isInteger(32) && dest.isInteger(1)) ||
(src.isInteger(8) && dest.isInteger(1)) || (src.isInteger(8) && dest.isInteger(1)) ||
(src.isF32() && dest.isInteger(8)) ||
(src.isF32() && dest.isInteger(1))) { (src.isF32() && dest.isInteger(1))) {
return success(); return success();
} }