Lines Matching defs:elementTy
53 auto elementTy =
57 if (isa<tosa::AbsOp>(op) && isa<FloatType>(elementTy))
60 if (isa<tosa::AbsOp>(op) && isa<IntegerType>(elementTy)) {
62 loc, rewriter.getZeroAttr(elementTy));
68 if (isa<tosa::AddOp>(op) && isa<FloatType>(elementTy))
71 if (isa<tosa::AddOp>(op) && isa<IntegerType>(elementTy))
75 if (isa<tosa::SubOp>(op) && isa<FloatType>(elementTy))
78 if (isa<tosa::SubOp>(op) && isa<IntegerType>(elementTy))
82 if (isa<tosa::IntDivOp>(op) && isa<IntegerType>(elementTy))
86 if (isa<tosa::ReciprocalOp>(op) && isa<FloatType>(elementTy)) {
88 rewriter.create<arith::ConstantOp>(loc, FloatAttr::get(elementTy, 1));
96 if (isa<FloatType>(elementTy)) {
100 if (isa<IntegerType>(elementTy)) {
124 if (elementTy.isInteger(32))
127 return rewriter.create<arith::TruncIOp>(loc, elementTy, result);
144 if (isa<tosa::NegateOp>(op) && isa<FloatType>(elementTy))
147 if (isa<tosa::NegateOp>(op) && isa<IntegerType>(elementTy)) {
156 int32_t inputBitWidth = elementTy.getIntOrFloatBitWidth();
159 loc, IntegerAttr::get(elementTy, 0));
200 return rewriter.create<arith::TruncIOp>(loc, elementTy, clamp);
204 if (isa<tosa::BitwiseAndOp>(op) && isa<IntegerType>(elementTy))
208 if (isa<tosa::BitwiseOrOp>(op) && isa<IntegerType>(elementTy))
212 if (isa<tosa::BitwiseNotOp>(op) && isa<IntegerType>(elementTy)) {
214 elementTy, APInt::getAllOnes(elementTy.getIntOrFloatBitWidth()));
220 if (isa<tosa::BitwiseXorOp>(op) && isa<IntegerType>(elementTy))
224 if (isa<tosa::LogicalLeftShiftOp>(op) && isa<IntegerType>(elementTy))
228 if (isa<tosa::LogicalRightShiftOp>(op) && isa<IntegerType>(elementTy))
232 if (isa<tosa::ArithmeticRightShiftOp>(op) && isa<IntegerType>(elementTy)) {
241 rewriter.create<arith::ConstantOp>(loc, IntegerAttr::get(elementTy, 1));
243 rewriter.create<arith::ConstantOp>(loc, IntegerAttr::get(elementTy, 0));
270 if (isa<tosa::ClzOp>(op) && isa<IntegerType>(elementTy)) {
271 return rewriter.create<math::CountLeadingZerosOp>(loc, elementTy, args[0]);
275 if (isa<tosa::LogicalAndOp>(op) && elementTy.isInteger(1))
279 if (isa<tosa::LogicalNotOp>(op) && elementTy.isInteger(1)) {
281 loc, rewriter.getIntegerAttr(elementTy, 1));
286 if (isa<tosa::LogicalOrOp>(op) && elementTy.isInteger(1))
290 if (isa<tosa::LogicalXorOp>(op) && elementTy.isInteger(1))
294 if (isa<tosa::PowOp>(op) && isa<FloatType>(elementTy))
298 if (isa<tosa::RsqrtOp>(op) && isa<FloatType>(elementTy))
302 if (isa<tosa::LogOp>(op) && isa<FloatType>(elementTy))
306 if (isa<tosa::ExpOp>(op) && isa<FloatType>(elementTy))
310 if (isa<tosa::SinOp>(op) && isa<FloatType>(elementTy))
314 if (isa<tosa::CosOp>(op) && isa<FloatType>(elementTy))
318 if (isa<tosa::TanhOp>(op) && isa<FloatType>(elementTy))
322 if (isa<tosa::ErfOp>(op) && llvm::isa<FloatType>(elementTy))
326 if (isa<tosa::GreaterOp>(op) && isa<FloatType>(elementTy))
330 if (isa<tosa::GreaterOp>(op) && elementTy.isSignlessInteger())
335 if (isa<tosa::GreaterEqualOp>(op) && isa<FloatType>(elementTy))
339 if (isa<tosa::GreaterEqualOp>(op) && elementTy.isSignlessInteger())
344 if (isa<tosa::EqualOp>(op) && isa<FloatType>(elementTy))
348 if (isa<tosa::EqualOp>(op) && elementTy.isSignlessInteger())
354 elementTy = cast<ShapedType>(op->getOperand(1).getType()).getElementType();
355 if (isa<FloatType>(elementTy) || isa<IntegerType>(elementTy))
360 if (isa<tosa::MaximumOp>(op) && isa<FloatType>(elementTy)) {
364 if (isa<tosa::MaximumOp>(op) && elementTy.isSignlessInteger()) {
369 if (isa<tosa::MinimumOp>(op) && isa<FloatType>(elementTy)) {
373 if (isa<tosa::MinimumOp>(op) && elementTy.isSignlessInteger()) {
378 if (isa<tosa::CeilOp>(op) && isa<FloatType>(elementTy))
382 if (isa<tosa::FloorOp>(op) && isa<FloatType>(elementTy))
386 if (isa<tosa::ClampOp>(op) && isa<FloatType>(elementTy)) {
390 minApf.convert(cast<FloatType>(elementTy).getFloatSemantics(),
392 maxApf.convert(cast<FloatType>(elementTy).getFloatSemantics(),
395 loc, elementTy, rewriter.getFloatAttr(elementTy, minApf));
397 loc, elementTy, rewriter.getFloatAttr(elementTy, maxApf));
401 if (isa<tosa::ClampOp>(op) && isa<IntegerType>(elementTy)) {
402 auto intTy = cast<IntegerType>(elementTy);
440 if (isa<tosa::SigmoidOp>(op) && isa<FloatType>(elementTy)) {
442 rewriter.create<arith::ConstantOp>(loc, FloatAttr::get(elementTy, 1));
451 Type srcTy = elementTy;
971 static TypedAttr createInitialValueForReduceOp(Operation *op, Type elementTy,
973 if (isa<tosa::ReduceSumOp>(op) && isa<FloatType>(elementTy))
974 return rewriter.getFloatAttr(elementTy, 0.0);
976 if (isa<tosa::ReduceSumOp>(op) && isa<IntegerType>(elementTy))
977 return rewriter.getIntegerAttr(elementTy, 0);
979 if (isa<tosa::ReduceProdOp>(op) && isa<FloatType>(elementTy))
980 return rewriter.getFloatAttr(elementTy, 1.0);
982 if (isa<tosa::ReduceProdOp>(op) && isa<IntegerType>(elementTy))
983 return rewriter.getIntegerAttr(elementTy, 1);
985 if (isa<tosa::ReduceMinOp>(op) && isa<FloatType>(elementTy))
987 elementTy, APFloat::getLargest(
988 cast<FloatType>(elementTy).getFloatSemantics(), false));
990 if (isa<tosa::ReduceMinOp>(op) && isa<IntegerType>(elementTy))
992 elementTy, APInt::getSignedMaxValue(elementTy.getIntOrFloatBitWidth()));
994 if (isa<tosa::ReduceMaxOp>(op) && isa<FloatType>(elementTy))
996 elementTy, APFloat::getLargest(
997 cast<FloatType>(elementTy).getFloatSemantics(), true));
999 if (isa<tosa::ReduceMaxOp>(op) && isa<IntegerType>(elementTy))
1001 elementTy, APInt::getSignedMinValue(elementTy.getIntOrFloatBitWidth()));
1003 if (isa<tosa::ReduceAllOp>(op) && elementTy.isInteger(1))
1004 return rewriter.getIntegerAttr(elementTy, APInt::getAllOnes(1));
1006 if (isa<tosa::ReduceAnyOp>(op) && elementTy.isInteger(1))
1007 return rewriter.getIntegerAttr(elementTy, APInt::getZero(1));
1009 if (isa<tosa::ArgMaxOp>(op) && isa<FloatType>(elementTy))
1011 elementTy, APFloat::getLargest(
1012 cast<FloatType>(elementTy).getFloatSemantics(), true));
1014 if (isa<tosa::ArgMaxOp>(op) && isa<IntegerType>(elementTy))
1016 elementTy, APInt::getSignedMinValue(elementTy.getIntOrFloatBitWidth()));
1025 Type elementTy,
1028 if (isa<tosa::ReduceSumOp>(op) && isa<FloatType>(elementTy)) {
1032 if (isa<tosa::ReduceSumOp>(op) && isa<IntegerType>(elementTy)) {
1036 if (isa<tosa::ReduceProdOp>(op) && isa<FloatType>(elementTy)) {
1040 if (isa<tosa::ReduceProdOp>(op) && isa<IntegerType>(elementTy)) {
1044 if (isa<tosa::ReduceMinOp>(op) && isa<FloatType>(elementTy)) {
1048 if (isa<tosa::ReduceMinOp>(op) && isa<IntegerType>(elementTy)) {
1052 if (isa<tosa::ReduceMaxOp>(op) && isa<FloatType>(elementTy)) {
1056 if (isa<tosa::ReduceMaxOp>(op) && isa<IntegerType>(elementTy)) {
1060 if (isa<tosa::ReduceAllOp>(op) && elementTy.isInteger(1))
1063 if (isa<tosa::ReduceAnyOp>(op) && elementTy.isInteger(1))
1077 auto elementTy = resultTy.getElementType();
1097 auto fillValueAttr = createInitialValueForReduceOp(op, elementTy, rewriter);
1113 op, blockArgs, elementTy, rewriter);
1909 auto elementTy = inputTy.getElementType();
1932 op.getLoc(), genericShape, elementTy, dynDims);
1948 loc, RankedTensorType::get(genericShape, elementTy), input,