From 22a50672423b2ee53c459b4b983da0faa26c2745 Mon Sep 17 00:00:00 2001 From: AmosLewis Date: Tue, 15 Nov 2022 12:23:39 -0800 Subject: [PATCH] [TOSA] Add more tosa::cast type support --- lib/Conversion/TorchToTosa/TosaLegalizeUtils.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/lib/Conversion/TorchToTosa/TosaLegalizeUtils.cpp b/lib/Conversion/TorchToTosa/TosaLegalizeUtils.cpp index 685a6dd86..eeac27137 100644 --- a/lib/Conversion/TorchToTosa/TosaLegalizeUtils.cpp +++ b/lib/Conversion/TorchToTosa/TosaLegalizeUtils.cpp @@ -222,11 +222,14 @@ llvm::Optional getConstTensor(PatternRewriter &rewriter, } static LogicalResult checkValidityOfCast(Type src, Type dest) { - if ((src.isInteger(64) && dest.isInteger(32)) || - (src.isInteger(32) && dest.isInteger(64)) || + if ((src == dest) || + (src.isInteger(64) && dest.isInteger(32)) || + (src.isInteger(64) && dest.isInteger(8)) || (src.isInteger(64) && dest.isInteger(1)) || + (src.isInteger(32) && dest.isInteger(64)) || (src.isInteger(32) && dest.isInteger(1)) || (src.isInteger(8) && dest.isInteger(1)) || + (src.isF32() && dest.isInteger(8)) || (src.isF32() && dest.isInteger(1))) { return success(); }