diff --git a/flang/include/flang/Optimizer/Builder/Runtime/RTBuilder.h b/flang/include/flang/Optimizer/Builder/Runtime/RTBuilder.h index 09b49b95fefe5..225326f441bc7 100644 --- a/flang/include/flang/Optimizer/Builder/Runtime/RTBuilder.h +++ b/flang/include/flang/Optimizer/Builder/Runtime/RTBuilder.h @@ -320,7 +320,7 @@ constexpr TypeBuilderFunc getModel() { template <> constexpr TypeBuilderFunc getModel() { return [](mlir::MLIRContext *context) -> mlir::Type { - return mlir::FloatType::getF64(context); + return mlir::Float64Type::get(context); }; } template <> @@ -347,11 +347,11 @@ constexpr TypeBuilderFunc getModel() { static_assert(size == 16 || size == 10 || size == 8, "unsupported long double size"); if constexpr (size == 16) - return mlir::FloatType::getF128(context); + return mlir::Float128Type::get(context); if constexpr (size == 10) - return mlir::FloatType::getF80(context); + return mlir::Float80Type::get(context); if constexpr (size == 8) - return mlir::FloatType::getF64(context); + return mlir::Float64Type::get(context); llvm_unreachable("failed static assert"); }; } @@ -369,7 +369,7 @@ constexpr TypeBuilderFunc getModel() { template <> constexpr TypeBuilderFunc getModel() { return [](mlir::MLIRContext *context) -> mlir::Type { - return mlir::FloatType::getF32(context); + return mlir::Float32Type::get(context); }; } template <> diff --git a/flang/lib/Lower/ConvertType.cpp b/flang/lib/Lower/ConvertType.cpp index 037d4335fedf1..2fab520e6c475 100644 --- a/flang/lib/Lower/ConvertType.cpp +++ b/flang/lib/Lower/ConvertType.cpp @@ -36,17 +36,17 @@ static mlir::Type genRealType(mlir::MLIRContext *context, int kind) { Fortran::common::TypeCategory::Real, kind)) { switch (kind) { case 2: - return mlir::FloatType::getF16(context); + return mlir::Float16Type::get(context); case 3: - return mlir::FloatType::getBF16(context); + return mlir::BFloat16Type::get(context); case 4: - return mlir::FloatType::getF32(context); + return mlir::Float32Type::get(context); case 8: - return mlir::FloatType::getF64(context); + return mlir::Float64Type::get(context); case 10: - return mlir::FloatType::getF80(context); + return mlir::Float80Type::get(context); case 16: - return mlir::FloatType::getF128(context); + return mlir::Float128Type::get(context); } } llvm_unreachable("REAL type translation not implemented"); diff --git a/flang/lib/Optimizer/Builder/FIRBuilder.cpp b/flang/lib/Optimizer/Builder/FIRBuilder.cpp index d01becfe80093..08d4726a539f7 100644 --- a/flang/lib/Optimizer/Builder/FIRBuilder.cpp +++ b/flang/lib/Optimizer/Builder/FIRBuilder.cpp @@ -105,17 +105,17 @@ mlir::Type fir::FirOpBuilder::getVarLenSeqTy(mlir::Type eleTy, unsigned rank) { mlir::Type fir::FirOpBuilder::getRealType(int kind) { switch (kindMap.getRealTypeID(kind)) { case llvm::Type::TypeID::HalfTyID: - return mlir::FloatType::getF16(getContext()); + return mlir::Float16Type::get(getContext()); case llvm::Type::TypeID::BFloatTyID: - return mlir::FloatType::getBF16(getContext()); + return mlir::BFloat16Type::get(getContext()); case llvm::Type::TypeID::FloatTyID: - return mlir::FloatType::getF32(getContext()); + return mlir::Float32Type::get(getContext()); case llvm::Type::TypeID::DoubleTyID: - return mlir::FloatType::getF64(getContext()); + return mlir::Float64Type::get(getContext()); case llvm::Type::TypeID::X86_FP80TyID: - return mlir::FloatType::getF80(getContext()); + return mlir::Float80Type::get(getContext()); case llvm::Type::TypeID::FP128TyID: - return mlir::FloatType::getF128(getContext()); + return mlir::Float128Type::get(getContext()); default: fir::emitFatalError(mlir::UnknownLoc::get(getContext()), "unsupported type !fir.real"); diff --git a/flang/lib/Optimizer/Builder/IntrinsicCall.cpp b/flang/lib/Optimizer/Builder/IntrinsicCall.cpp index e6d0f044dcf84..d52dc8292326b 100644 --- a/flang/lib/Optimizer/Builder/IntrinsicCall.cpp +++ b/flang/lib/Optimizer/Builder/IntrinsicCall.cpp @@ -2362,7 +2362,7 @@ mlir::Value IntrinsicLibrary::genAcosd(mlir::Type resultType, mlir::FunctionType::get(context, {resultType}, {args[0].getType()}); llvm::APFloat pi = llvm::APFloat(llvm::numbers::pi); mlir::Value dfactor = builder.createRealConstant( - loc, mlir::FloatType::getF64(context), pi / llvm::APFloat(180.0)); + loc, mlir::Float64Type::get(context), pi / llvm::APFloat(180.0)); mlir::Value factor = builder.createConvert(loc, args[0].getType(), dfactor); mlir::Value arg = builder.create(loc, args[0], factor); return getRuntimeCallGenerator("acos", ftype)(builder, loc, {arg}); @@ -2513,7 +2513,7 @@ mlir::Value IntrinsicLibrary::genAsind(mlir::Type resultType, mlir::FunctionType::get(context, {resultType}, {args[0].getType()}); llvm::APFloat pi = llvm::APFloat(llvm::numbers::pi); mlir::Value dfactor = builder.createRealConstant( - loc, mlir::FloatType::getF64(context), pi / llvm::APFloat(180.0)); + loc, mlir::Float64Type::get(context), pi / llvm::APFloat(180.0)); mlir::Value factor = builder.createConvert(loc, args[0].getType(), dfactor); mlir::Value arg = builder.create(loc, args[0], factor); return getRuntimeCallGenerator("asin", ftype)(builder, loc, {arg}); @@ -2539,7 +2539,7 @@ mlir::Value IntrinsicLibrary::genAtand(mlir::Type resultType, } llvm::APFloat pi = llvm::APFloat(llvm::numbers::pi); mlir::Value dfactor = builder.createRealConstant( - loc, mlir::FloatType::getF64(context), llvm::APFloat(180.0) / pi); + loc, mlir::Float64Type::get(context), llvm::APFloat(180.0) / pi); mlir::Value factor = builder.createConvert(loc, resultType, dfactor); return builder.create(loc, atan, factor); } @@ -2564,7 +2564,7 @@ mlir::Value IntrinsicLibrary::genAtanpi(mlir::Type resultType, } llvm::APFloat inv_pi = llvm::APFloat(llvm::numbers::inv_pi); mlir::Value dfactor = - builder.createRealConstant(loc, mlir::FloatType::getF64(context), inv_pi); + builder.createRealConstant(loc, mlir::Float64Type::get(context), inv_pi); mlir::Value factor = builder.createConvert(loc, resultType, dfactor); return builder.create(loc, atan, factor); } @@ -3119,7 +3119,7 @@ mlir::Value IntrinsicLibrary::genCosd(mlir::Type resultType, mlir::FunctionType::get(context, {resultType}, {args[0].getType()}); llvm::APFloat pi = llvm::APFloat(llvm::numbers::pi); mlir::Value dfactor = builder.createRealConstant( - loc, mlir::FloatType::getF64(context), pi / llvm::APFloat(180.0)); + loc, mlir::Float64Type::get(context), pi / llvm::APFloat(180.0)); mlir::Value factor = builder.createConvert(loc, args[0].getType(), dfactor); mlir::Value arg = builder.create(loc, args[0], factor); return getRuntimeCallGenerator("cos", ftype)(builder, loc, {arg}); @@ -4412,12 +4412,12 @@ IntrinsicLibrary::genIeeeCopySign(mlir::Type resultType, mlir::FloatType yRealType = mlir::dyn_cast(yRealVal.getType()); - if (yRealType == mlir::FloatType::getBF16(builder.getContext())) { + if (yRealType == mlir::BFloat16Type::get(builder.getContext())) { // Workaround: CopySignOp and BitcastOp don't work for kind 3 arg Y. // This conversion should always preserve the sign bit. yRealVal = builder.createConvert( - loc, mlir::FloatType::getF32(builder.getContext()), yRealVal); - yRealType = mlir::FloatType::getF32(builder.getContext()); + loc, mlir::Float32Type::get(builder.getContext()), yRealVal); + yRealType = mlir::Float32Type::get(builder.getContext()); } // Args have the same type. @@ -4940,7 +4940,7 @@ mlir::Value IntrinsicLibrary::genIeeeReal(mlir::Type resultType, assert(args.size() == 2); mlir::Type i1Ty = builder.getI1Type(); - mlir::Type f32Ty = mlir::FloatType::getF32(builder.getContext()); + mlir::Type f32Ty = mlir::Float32Type::get(builder.getContext()); mlir::Value a = args[0]; mlir::Type aType = a.getType(); @@ -5140,7 +5140,7 @@ mlir::Value IntrinsicLibrary::genIeeeRem(mlir::Type resultType, mlir::Value x = args[0]; mlir::Value y = args[1]; if (mlir::dyn_cast(resultType).getWidth() < 32) { - mlir::Type f32Ty = mlir::FloatType::getF32(builder.getContext()); + mlir::Type f32Ty = mlir::Float32Type::get(builder.getContext()); x = builder.create(loc, f32Ty, x); y = builder.create(loc, f32Ty, y); } else { @@ -5174,7 +5174,7 @@ mlir::Value IntrinsicLibrary::genIeeeRint(mlir::Type resultType, } if (mlir::cast(resultType).getWidth() == 16) a = builder.create( - loc, mlir::FloatType::getF32(builder.getContext()), a); + loc, mlir::Float32Type::get(builder.getContext()), a); mlir::Value result = builder.create( loc, resultType, genRuntimeCall("nearbyint", a.getType(), a)); if (isStaticallyPresent(args[1])) { @@ -5259,10 +5259,10 @@ mlir::Value IntrinsicLibrary::genIeeeSignbit(mlir::Type resultType, mlir::Value realVal = args[0]; mlir::FloatType realType = mlir::dyn_cast(realVal.getType()); int bitWidth = realType.getWidth(); - if (realType == mlir::FloatType::getBF16(builder.getContext())) { + if (realType == mlir::BFloat16Type::get(builder.getContext())) { // Workaround: can't bitcast or convert real(3) to integer(2) or real(2). realVal = builder.createConvert( - loc, mlir::FloatType::getF32(builder.getContext()), realVal); + loc, mlir::Float32Type::get(builder.getContext()), realVal); bitWidth = 32; } mlir::Type intType = builder.getIntegerType(bitWidth); @@ -6026,7 +6026,7 @@ mlir::Value IntrinsicLibrary::genModulo(mlir::Type resultType, auto fastMathFlags = builder.getFastMathFlags(); // F128 arith::RemFOp may be lowered to a runtime call that may be unsupported // on the target, so generate a call to Fortran Runtime's ModuloReal16. - if (resultType == mlir::FloatType::getF128(builder.getContext()) || + if (resultType == mlir::Float128Type::get(builder.getContext()) || (fastMathFlags & mlir::arith::FastMathFlags::ninf) == mlir::arith::FastMathFlags::none) return builder.createConvert( @@ -6215,7 +6215,7 @@ mlir::Value IntrinsicLibrary::genNearest(mlir::Type resultType, mlir::FloatType yType = mlir::dyn_cast(args[1].getType()); const unsigned yBitWidth = yType.getWidth(); if (xType != yType) { - mlir::Type f32Ty = mlir::FloatType::getF32(builder.getContext()); + mlir::Type f32Ty = mlir::Float32Type::get(builder.getContext()); if (xBitWidth < 32) x1 = builder.createConvert(loc, f32Ty, x1); if (yBitWidth > 32 && yBitWidth > xBitWidth) @@ -7166,7 +7166,7 @@ mlir::Value IntrinsicLibrary::genSind(mlir::Type resultType, mlir::FunctionType::get(context, {resultType}, {args[0].getType()}); llvm::APFloat pi = llvm::APFloat(llvm::numbers::pi); mlir::Value dfactor = builder.createRealConstant( - loc, mlir::FloatType::getF64(context), pi / llvm::APFloat(180.0)); + loc, mlir::Float64Type::get(context), pi / llvm::APFloat(180.0)); mlir::Value factor = builder.createConvert(loc, args[0].getType(), dfactor); mlir::Value arg = builder.create(loc, args[0], factor); return getRuntimeCallGenerator("sin", ftype)(builder, loc, {arg}); @@ -7247,7 +7247,7 @@ mlir::Value IntrinsicLibrary::genTand(mlir::Type resultType, mlir::FunctionType::get(context, {resultType}, {args[0].getType()}); llvm::APFloat pi = llvm::APFloat(llvm::numbers::pi); mlir::Value dfactor = builder.createRealConstant( - loc, mlir::FloatType::getF64(context), pi / llvm::APFloat(180.0)); + loc, mlir::Float64Type::get(context), pi / llvm::APFloat(180.0)); mlir::Value factor = builder.createConvert(loc, args[0].getType(), dfactor); mlir::Value arg = builder.create(loc, args[0], factor); return getRuntimeCallGenerator("tan", ftype)(builder, loc, {arg}); diff --git a/flang/lib/Optimizer/Builder/PPCIntrinsicCall.cpp b/flang/lib/Optimizer/Builder/PPCIntrinsicCall.cpp index b3b07d18a956b..fcc91752552c3 100644 --- a/flang/lib/Optimizer/Builder/PPCIntrinsicCall.cpp +++ b/flang/lib/Optimizer/Builder/PPCIntrinsicCall.cpp @@ -1579,7 +1579,7 @@ PPCIntrinsicLibrary::genVecConvert(mlir::Type resultType, return callOp.getResult(0); } else if (width == 64) { - auto fTy{mlir::FloatType::getF64(context)}; + auto fTy{mlir::Float64Type::get(context)}; auto ty{mlir::VectorType::get(2, fTy)}; // vec_vtf(arg1, arg2) = fmul(1.0 / (1 << arg2), llvm.sitofp(arg1)) @@ -1639,7 +1639,7 @@ PPCIntrinsicLibrary::genVecConvert(mlir::Type resultType, newArgs[0] = builder.create(loc, funcOp, newArgs).getResult(0); auto fvf32Ty{newArgs[0].getType()}; - auto f32type{mlir::FloatType::getF32(context)}; + auto f32type{mlir::Float32Type::get(context)}; auto mvf32Ty{mlir::VectorType::get(4, f32type)}; newArgs[0] = builder.createConvert(loc, mvf32Ty, newArgs[0]); @@ -1949,7 +1949,7 @@ PPCIntrinsicLibrary::genVecLdCallGrp(mlir::Type resultType, fname = isBEVecElemOrderOnLE() ? "llvm.ppc.vsx.lxvd2x.be" : "llvm.ppc.vsx.lxvd2x"; // llvm.ppc.altivec.lxvd2x* returns <2 x double> - intrinResTy = mlir::VectorType::get(2, mlir::FloatType::getF64(context)); + intrinResTy = mlir::VectorType::get(2, mlir::Float64Type::get(context)); } break; case VecOp::Xlw4: fname = isBEVecElemOrderOnLE() ? "llvm.ppc.vsx.lxvw4x.be" @@ -2092,7 +2092,7 @@ PPCIntrinsicLibrary::genVecPerm(mlir::Type resultType, auto mlirTy{vecTyInfo.toMlirVectorType(context)}; auto vi32Ty{mlir::VectorType::get(4, mlir::IntegerType::get(context, 32))}; - auto vf64Ty{mlir::VectorType::get(2, mlir::FloatType::getF64(context))}; + auto vf64Ty{mlir::VectorType::get(2, mlir::Float64Type::get(context))}; auto mArg0{builder.createConvert(loc, mlirTy, argBases[0])}; auto mArg1{builder.createConvert(loc, mlirTy, argBases[1])}; diff --git a/flang/lib/Optimizer/Builder/Runtime/Numeric.cpp b/flang/lib/Optimizer/Builder/Runtime/Numeric.cpp index d0092add0118f..4ff7c86bb0a24 100644 --- a/flang/lib/Optimizer/Builder/Runtime/Numeric.cpp +++ b/flang/lib/Optimizer/Builder/Runtime/Numeric.cpp @@ -27,7 +27,7 @@ struct ForcedErfcScaled10 { static constexpr const char *name = ExpandAndQuoteKey(RTNAME(ErfcScaled10)); static constexpr fir::runtime::FuncTypeBuilderFunc getTypeModel() { return [](mlir::MLIRContext *ctx) { - auto ty = mlir::FloatType::getF80(ctx); + auto ty = mlir::Float80Type::get(ctx); return mlir::FunctionType::get(ctx, {ty}, {ty}); }; } @@ -38,7 +38,7 @@ struct ForcedErfcScaled16 { static constexpr const char *name = ExpandAndQuoteKey(RTNAME(ErfcScaled16)); static constexpr fir::runtime::FuncTypeBuilderFunc getTypeModel() { return [](mlir::MLIRContext *ctx) { - auto ty = mlir::FloatType::getF128(ctx); + auto ty = mlir::Float128Type::get(ctx); return mlir::FunctionType::get(ctx, {ty}, {ty}); }; } @@ -49,7 +49,7 @@ struct ForcedExponent10_4 { static constexpr const char *name = ExpandAndQuoteKey(RTNAME(Exponent10_4)); static constexpr fir::runtime::FuncTypeBuilderFunc getTypeModel() { return [](mlir::MLIRContext *ctx) { - auto fltTy = mlir::FloatType::getF80(ctx); + auto fltTy = mlir::Float80Type::get(ctx); auto intTy = mlir::IntegerType::get(ctx, 32); return mlir::FunctionType::get(ctx, fltTy, intTy); }; @@ -60,7 +60,7 @@ struct ForcedExponent10_8 { static constexpr const char *name = ExpandAndQuoteKey(RTNAME(Exponent10_8)); static constexpr fir::runtime::FuncTypeBuilderFunc getTypeModel() { return [](mlir::MLIRContext *ctx) { - auto fltTy = mlir::FloatType::getF80(ctx); + auto fltTy = mlir::Float80Type::get(ctx); auto intTy = mlir::IntegerType::get(ctx, 64); return mlir::FunctionType::get(ctx, fltTy, intTy); }; @@ -72,7 +72,7 @@ struct ForcedExponent16_4 { static constexpr const char *name = ExpandAndQuoteKey(RTNAME(Exponent16_4)); static constexpr fir::runtime::FuncTypeBuilderFunc getTypeModel() { return [](mlir::MLIRContext *ctx) { - auto fltTy = mlir::FloatType::getF128(ctx); + auto fltTy = mlir::Float128Type::get(ctx); auto intTy = mlir::IntegerType::get(ctx, 32); return mlir::FunctionType::get(ctx, fltTy, intTy); }; @@ -83,7 +83,7 @@ struct ForcedExponent16_8 { static constexpr const char *name = ExpandAndQuoteKey(RTNAME(Exponent16_8)); static constexpr fir::runtime::FuncTypeBuilderFunc getTypeModel() { return [](mlir::MLIRContext *ctx) { - auto fltTy = mlir::FloatType::getF128(ctx); + auto fltTy = mlir::Float128Type::get(ctx); auto intTy = mlir::IntegerType::get(ctx, 64); return mlir::FunctionType::get(ctx, fltTy, intTy); }; @@ -95,7 +95,7 @@ struct ForcedFraction10 { static constexpr const char *name = ExpandAndQuoteKey(RTNAME(Fraction10)); static constexpr fir::runtime::FuncTypeBuilderFunc getTypeModel() { return [](mlir::MLIRContext *ctx) { - auto ty = mlir::FloatType::getF80(ctx); + auto ty = mlir::Float80Type::get(ctx); return mlir::FunctionType::get(ctx, {ty}, {ty}); }; } @@ -106,7 +106,7 @@ struct ForcedFraction16 { static constexpr const char *name = ExpandAndQuoteKey(RTNAME(Fraction16)); static constexpr fir::runtime::FuncTypeBuilderFunc getTypeModel() { return [](mlir::MLIRContext *ctx) { - auto ty = mlir::FloatType::getF128(ctx); + auto ty = mlir::Float128Type::get(ctx); return mlir::FunctionType::get(ctx, {ty}, {ty}); }; } @@ -117,7 +117,7 @@ struct ForcedMod10 { static constexpr const char *name = ExpandAndQuoteKey(RTNAME(ModReal10)); static constexpr fir::runtime::FuncTypeBuilderFunc getTypeModel() { return [](mlir::MLIRContext *ctx) { - auto fltTy = mlir::FloatType::getF80(ctx); + auto fltTy = mlir::Float80Type::get(ctx); auto strTy = fir::ReferenceType::get(mlir::IntegerType::get(ctx, 8)); auto intTy = mlir::IntegerType::get(ctx, 8 * sizeof(int)); return mlir::FunctionType::get(ctx, {fltTy, fltTy, strTy, intTy}, @@ -131,7 +131,7 @@ struct ForcedMod16 { static constexpr const char *name = ExpandAndQuoteKey(RTNAME(ModReal16)); static constexpr fir::runtime::FuncTypeBuilderFunc getTypeModel() { return [](mlir::MLIRContext *ctx) { - auto fltTy = mlir::FloatType::getF128(ctx); + auto fltTy = mlir::Float128Type::get(ctx); auto strTy = fir::ReferenceType::get(mlir::IntegerType::get(ctx, 8)); auto intTy = mlir::IntegerType::get(ctx, 8 * sizeof(int)); return mlir::FunctionType::get(ctx, {fltTy, fltTy, strTy, intTy}, @@ -145,7 +145,7 @@ struct ForcedModulo10 { static constexpr const char *name = ExpandAndQuoteKey(RTNAME(ModuloReal10)); static constexpr fir::runtime::FuncTypeBuilderFunc getTypeModel() { return [](mlir::MLIRContext *ctx) { - auto fltTy = mlir::FloatType::getF80(ctx); + auto fltTy = mlir::Float80Type::get(ctx); auto strTy = fir::ReferenceType::get(mlir::IntegerType::get(ctx, 8)); auto intTy = mlir::IntegerType::get(ctx, 8 * sizeof(int)); return mlir::FunctionType::get(ctx, {fltTy, fltTy, strTy, intTy}, @@ -159,7 +159,7 @@ struct ForcedModulo16 { static constexpr const char *name = ExpandAndQuoteKey(RTNAME(ModuloReal16)); static constexpr fir::runtime::FuncTypeBuilderFunc getTypeModel() { return [](mlir::MLIRContext *ctx) { - auto fltTy = mlir::FloatType::getF128(ctx); + auto fltTy = mlir::Float128Type::get(ctx); auto strTy = fir::ReferenceType::get(mlir::IntegerType::get(ctx, 8)); auto intTy = mlir::IntegerType::get(ctx, 8 * sizeof(int)); return mlir::FunctionType::get(ctx, {fltTy, fltTy, strTy, intTy}, @@ -173,7 +173,7 @@ struct ForcedNearest10 { static constexpr const char *name = ExpandAndQuoteKey(RTNAME(Nearest10)); static constexpr fir::runtime::FuncTypeBuilderFunc getTypeModel() { return [](mlir::MLIRContext *ctx) { - auto fltTy = mlir::FloatType::getF80(ctx); + auto fltTy = mlir::Float80Type::get(ctx); auto boolTy = mlir::IntegerType::get(ctx, 1); return mlir::FunctionType::get(ctx, {fltTy, boolTy}, {fltTy}); }; @@ -185,7 +185,7 @@ struct ForcedNearest16 { static constexpr const char *name = ExpandAndQuoteKey(RTNAME(Nearest16)); static constexpr fir::runtime::FuncTypeBuilderFunc getTypeModel() { return [](mlir::MLIRContext *ctx) { - auto fltTy = mlir::FloatType::getF128(ctx); + auto fltTy = mlir::Float128Type::get(ctx); auto boolTy = mlir::IntegerType::get(ctx, 1); return mlir::FunctionType::get(ctx, {fltTy, boolTy}, {fltTy}); }; @@ -197,7 +197,7 @@ struct ForcedRRSpacing10 { static constexpr const char *name = ExpandAndQuoteKey(RTNAME(RRSpacing10)); static constexpr fir::runtime::FuncTypeBuilderFunc getTypeModel() { return [](mlir::MLIRContext *ctx) { - auto ty = mlir::FloatType::getF80(ctx); + auto ty = mlir::Float80Type::get(ctx); return mlir::FunctionType::get(ctx, {ty}, {ty}); }; } @@ -208,7 +208,7 @@ struct ForcedRRSpacing16 { static constexpr const char *name = ExpandAndQuoteKey(RTNAME(RRSpacing16)); static constexpr fir::runtime::FuncTypeBuilderFunc getTypeModel() { return [](mlir::MLIRContext *ctx) { - auto ty = mlir::FloatType::getF128(ctx); + auto ty = mlir::Float128Type::get(ctx); return mlir::FunctionType::get(ctx, {ty}, {ty}); }; } @@ -219,7 +219,7 @@ struct ForcedScale10 { static constexpr const char *name = ExpandAndQuoteKey(RTNAME(Scale10)); static constexpr fir::runtime::FuncTypeBuilderFunc getTypeModel() { return [](mlir::MLIRContext *ctx) { - auto fltTy = mlir::FloatType::getF80(ctx); + auto fltTy = mlir::Float80Type::get(ctx); auto intTy = mlir::IntegerType::get(ctx, 64); return mlir::FunctionType::get(ctx, {fltTy, intTy}, {fltTy}); }; @@ -231,7 +231,7 @@ struct ForcedScale16 { static constexpr const char *name = ExpandAndQuoteKey(RTNAME(Scale16)); static constexpr fir::runtime::FuncTypeBuilderFunc getTypeModel() { return [](mlir::MLIRContext *ctx) { - auto fltTy = mlir::FloatType::getF128(ctx); + auto fltTy = mlir::Float128Type::get(ctx); auto intTy = mlir::IntegerType::get(ctx, 64); return mlir::FunctionType::get(ctx, {fltTy, intTy}, {fltTy}); }; @@ -243,7 +243,7 @@ struct ForcedSetExponent10 { static constexpr const char *name = ExpandAndQuoteKey(RTNAME(SetExponent10)); static constexpr fir::runtime::FuncTypeBuilderFunc getTypeModel() { return [](mlir::MLIRContext *ctx) { - auto fltTy = mlir::FloatType::getF80(ctx); + auto fltTy = mlir::Float80Type::get(ctx); auto intTy = mlir::IntegerType::get(ctx, 64); return mlir::FunctionType::get(ctx, {fltTy, intTy}, {fltTy}); }; @@ -255,7 +255,7 @@ struct ForcedSetExponent16 { static constexpr const char *name = ExpandAndQuoteKey(RTNAME(SetExponent16)); static constexpr fir::runtime::FuncTypeBuilderFunc getTypeModel() { return [](mlir::MLIRContext *ctx) { - auto fltTy = mlir::FloatType::getF128(ctx); + auto fltTy = mlir::Float128Type::get(ctx); auto intTy = mlir::IntegerType::get(ctx, 64); return mlir::FunctionType::get(ctx, {fltTy, intTy}, {fltTy}); }; @@ -267,7 +267,7 @@ struct ForcedSpacing10 { static constexpr const char *name = ExpandAndQuoteKey(RTNAME(Spacing10)); static constexpr fir::runtime::FuncTypeBuilderFunc getTypeModel() { return [](mlir::MLIRContext *ctx) { - auto ty = mlir::FloatType::getF80(ctx); + auto ty = mlir::Float80Type::get(ctx); return mlir::FunctionType::get(ctx, {ty}, {ty}); }; } @@ -278,7 +278,7 @@ struct ForcedSpacing16 { static constexpr const char *name = ExpandAndQuoteKey(RTNAME(Spacing16)); static constexpr fir::runtime::FuncTypeBuilderFunc getTypeModel() { return [](mlir::MLIRContext *ctx) { - auto ty = mlir::FloatType::getF128(ctx); + auto ty = mlir::Float128Type::get(ctx); return mlir::FunctionType::get(ctx, {ty}, {ty}); }; } diff --git a/flang/lib/Optimizer/Builder/Runtime/Reduction.cpp b/flang/lib/Optimizer/Builder/Runtime/Reduction.cpp index 1aa941bd2131c..3cc094ee64784 100644 --- a/flang/lib/Optimizer/Builder/Runtime/Reduction.cpp +++ b/flang/lib/Optimizer/Builder/Runtime/Reduction.cpp @@ -27,7 +27,7 @@ struct ForcedMaxvalReal10 { static constexpr const char *name = ExpandAndQuoteKey(RTNAME(MaxvalReal10)); static constexpr fir::runtime::FuncTypeBuilderFunc getTypeModel() { return [](mlir::MLIRContext *ctx) { - auto ty = mlir::FloatType::getF80(ctx); + auto ty = mlir::Float80Type::get(ctx); auto boxTy = fir::runtime::getModel()(ctx); auto strTy = fir::ReferenceType::get(mlir::IntegerType::get(ctx, 8)); @@ -43,7 +43,7 @@ struct ForcedMaxvalReal16 { static constexpr const char *name = ExpandAndQuoteKey(RTNAME(MaxvalReal16)); static constexpr fir::runtime::FuncTypeBuilderFunc getTypeModel() { return [](mlir::MLIRContext *ctx) { - auto ty = mlir::FloatType::getF128(ctx); + auto ty = mlir::Float128Type::get(ctx); auto boxTy = fir::runtime::getModel()(ctx); auto strTy = fir::ReferenceType::get(mlir::IntegerType::get(ctx, 8)); @@ -94,7 +94,7 @@ struct ForcedMinvalReal10 { static constexpr const char *name = ExpandAndQuoteKey(RTNAME(MinvalReal10)); static constexpr fir::runtime::FuncTypeBuilderFunc getTypeModel() { return [](mlir::MLIRContext *ctx) { - auto ty = mlir::FloatType::getF80(ctx); + auto ty = mlir::Float80Type::get(ctx); auto boxTy = fir::runtime::getModel()(ctx); auto strTy = fir::ReferenceType::get(mlir::IntegerType::get(ctx, 8)); @@ -110,7 +110,7 @@ struct ForcedMinvalReal16 { static constexpr const char *name = ExpandAndQuoteKey(RTNAME(MinvalReal16)); static constexpr fir::runtime::FuncTypeBuilderFunc getTypeModel() { return [](mlir::MLIRContext *ctx) { - auto ty = mlir::FloatType::getF128(ctx); + auto ty = mlir::Float128Type::get(ctx); auto boxTy = fir::runtime::getModel()(ctx); auto strTy = fir::ReferenceType::get(mlir::IntegerType::get(ctx, 8)); @@ -173,7 +173,7 @@ struct ForcedNorm2Real10 { static constexpr const char *name = ExpandAndQuoteKey(RTNAME(Norm2_10)); static constexpr fir::runtime::FuncTypeBuilderFunc getTypeModel() { return [](mlir::MLIRContext *ctx) { - auto ty = mlir::FloatType::getF80(ctx); + auto ty = mlir::Float80Type::get(ctx); auto boxTy = fir::runtime::getModel()(ctx); auto strTy = fir::ReferenceType::get(mlir::IntegerType::get(ctx, 8)); @@ -188,7 +188,7 @@ struct ForcedNorm2Real16 { static constexpr const char *name = ExpandAndQuoteKey(RTNAME(Norm2_16)); static constexpr fir::runtime::FuncTypeBuilderFunc getTypeModel() { return [](mlir::MLIRContext *ctx) { - auto ty = mlir::FloatType::getF128(ctx); + auto ty = mlir::Float128Type::get(ctx); auto boxTy = fir::runtime::getModel()(ctx); auto strTy = fir::ReferenceType::get(mlir::IntegerType::get(ctx, 8)); @@ -219,7 +219,7 @@ struct ForcedProductReal10 { static constexpr const char *name = ExpandAndQuoteKey(RTNAME(ProductReal10)); static constexpr fir::runtime::FuncTypeBuilderFunc getTypeModel() { return [](mlir::MLIRContext *ctx) { - auto ty = mlir::FloatType::getF80(ctx); + auto ty = mlir::Float80Type::get(ctx); auto boxTy = fir::runtime::getModel()(ctx); auto strTy = fir::ReferenceType::get(mlir::IntegerType::get(ctx, 8)); @@ -235,7 +235,7 @@ struct ForcedProductReal16 { static constexpr const char *name = ExpandAndQuoteKey(RTNAME(ProductReal16)); static constexpr fir::runtime::FuncTypeBuilderFunc getTypeModel() { return [](mlir::MLIRContext *ctx) { - auto ty = mlir::FloatType::getF128(ctx); + auto ty = mlir::Float128Type::get(ctx); auto boxTy = fir::runtime::getModel()(ctx); auto strTy = fir::ReferenceType::get(mlir::IntegerType::get(ctx, 8)); @@ -287,7 +287,7 @@ struct ForcedProductComplex10 { ExpandAndQuoteKey(RTNAME(CppProductComplex10)); static constexpr fir::runtime::FuncTypeBuilderFunc getTypeModel() { return [](mlir::MLIRContext *ctx) { - auto ty = mlir::ComplexType::get(mlir::FloatType::getF80(ctx)); + auto ty = mlir::ComplexType::get(mlir::Float80Type::get(ctx)); auto boxTy = fir::runtime::getModel()(ctx); auto strTy = fir::ReferenceType::get(mlir::IntegerType::get(ctx, 8)); @@ -305,7 +305,7 @@ struct ForcedProductComplex16 { ExpandAndQuoteKey(RTNAME(CppProductComplex16)); static constexpr fir::runtime::FuncTypeBuilderFunc getTypeModel() { return [](mlir::MLIRContext *ctx) { - auto ty = mlir::ComplexType::get(mlir::FloatType::getF128(ctx)); + auto ty = mlir::ComplexType::get(mlir::Float128Type::get(ctx)); auto boxTy = fir::runtime::getModel()(ctx); auto strTy = fir::ReferenceType::get(mlir::IntegerType::get(ctx, 8)); @@ -323,7 +323,7 @@ struct ForcedDotProductReal10 { ExpandAndQuoteKey(RTNAME(DotProductReal10)); static constexpr fir::runtime::FuncTypeBuilderFunc getTypeModel() { return [](mlir::MLIRContext *ctx) { - auto ty = mlir::FloatType::getF80(ctx); + auto ty = mlir::Float80Type::get(ctx); auto boxTy = fir::runtime::getModel()(ctx); auto strTy = fir::ReferenceType::get(mlir::IntegerType::get(ctx, 8)); @@ -339,7 +339,7 @@ struct ForcedDotProductReal16 { ExpandAndQuoteKey(RTNAME(DotProductReal16)); static constexpr fir::runtime::FuncTypeBuilderFunc getTypeModel() { return [](mlir::MLIRContext *ctx) { - auto ty = mlir::FloatType::getF128(ctx); + auto ty = mlir::Float128Type::get(ctx); auto boxTy = fir::runtime::getModel()(ctx); auto strTy = fir::ReferenceType::get(mlir::IntegerType::get(ctx, 8)); @@ -355,7 +355,7 @@ struct ForcedDotProductComplex10 { ExpandAndQuoteKey(RTNAME(CppDotProductComplex10)); static constexpr fir::runtime::FuncTypeBuilderFunc getTypeModel() { return [](mlir::MLIRContext *ctx) { - auto ty = mlir::ComplexType::get(mlir::FloatType::getF80(ctx)); + auto ty = mlir::ComplexType::get(mlir::Float80Type::get(ctx)); auto boxTy = fir::runtime::getModel()(ctx); auto strTy = fir::ReferenceType::get(mlir::IntegerType::get(ctx, 8)); @@ -373,7 +373,7 @@ struct ForcedDotProductComplex16 { ExpandAndQuoteKey(RTNAME(CppDotProductComplex16)); static constexpr fir::runtime::FuncTypeBuilderFunc getTypeModel() { return [](mlir::MLIRContext *ctx) { - auto ty = mlir::ComplexType::get(mlir::FloatType::getF128(ctx)); + auto ty = mlir::ComplexType::get(mlir::Float128Type::get(ctx)); auto boxTy = fir::runtime::getModel()(ctx); auto strTy = fir::ReferenceType::get(mlir::IntegerType::get(ctx, 8)); @@ -423,7 +423,7 @@ struct ForcedSumReal10 { static constexpr const char *name = ExpandAndQuoteKey(RTNAME(SumReal10)); static constexpr fir::runtime::FuncTypeBuilderFunc getTypeModel() { return [](mlir::MLIRContext *ctx) { - auto ty = mlir::FloatType::getF80(ctx); + auto ty = mlir::Float80Type::get(ctx); auto boxTy = fir::runtime::getModel()(ctx); auto strTy = fir::ReferenceType::get(mlir::IntegerType::get(ctx, 8)); @@ -439,7 +439,7 @@ struct ForcedSumReal16 { static constexpr const char *name = ExpandAndQuoteKey(RTNAME(SumReal16)); static constexpr fir::runtime::FuncTypeBuilderFunc getTypeModel() { return [](mlir::MLIRContext *ctx) { - auto ty = mlir::FloatType::getF128(ctx); + auto ty = mlir::Float128Type::get(ctx); auto boxTy = fir::runtime::getModel()(ctx); auto strTy = fir::ReferenceType::get(mlir::IntegerType::get(ctx, 8)); @@ -489,7 +489,7 @@ struct ForcedSumComplex10 { ExpandAndQuoteKey(RTNAME(CppSumComplex10)); static constexpr fir::runtime::FuncTypeBuilderFunc getTypeModel() { return [](mlir::MLIRContext *ctx) { - auto ty = mlir::ComplexType::get(mlir::FloatType::getF80(ctx)); + auto ty = mlir::ComplexType::get(mlir::Float80Type::get(ctx)); auto boxTy = fir::runtime::getModel()(ctx); auto strTy = fir::ReferenceType::get(mlir::IntegerType::get(ctx, 8)); @@ -507,7 +507,7 @@ struct ForcedSumComplex16 { ExpandAndQuoteKey(RTNAME(CppSumComplex16)); static constexpr fir::runtime::FuncTypeBuilderFunc getTypeModel() { return [](mlir::MLIRContext *ctx) { - auto ty = mlir::ComplexType::get(mlir::FloatType::getF128(ctx)); + auto ty = mlir::ComplexType::get(mlir::Float128Type::get(ctx)); auto boxTy = fir::runtime::getModel()(ctx); auto strTy = fir::ReferenceType::get(mlir::IntegerType::get(ctx, 8)); @@ -573,7 +573,7 @@ struct ForcedReduceReal10Ref { ExpandAndQuoteKey(RTNAME(ReduceReal10Ref)); static constexpr fir::runtime::FuncTypeBuilderFunc getTypeModel() { return [](mlir::MLIRContext *ctx) { - auto ty = mlir::FloatType::getF80(ctx); + auto ty = mlir::Float80Type::get(ctx); auto boxTy = fir::runtime::getModel()(ctx); auto refTy = fir::ReferenceType::get(ty); @@ -593,7 +593,7 @@ struct ForcedReduceReal10Value { ExpandAndQuoteKey(RTNAME(ReduceReal10Value)); static constexpr fir::runtime::FuncTypeBuilderFunc getTypeModel() { return [](mlir::MLIRContext *ctx) { - auto ty = mlir::FloatType::getF80(ctx); + auto ty = mlir::Float80Type::get(ctx); auto boxTy = fir::runtime::getModel()(ctx); auto refTy = fir::ReferenceType::get(ty); @@ -613,7 +613,7 @@ struct ForcedReduceReal16Ref { ExpandAndQuoteKey(RTNAME(ReduceReal16Ref)); static constexpr fir::runtime::FuncTypeBuilderFunc getTypeModel() { return [](mlir::MLIRContext *ctx) { - auto ty = mlir::FloatType::getF128(ctx); + auto ty = mlir::Float128Type::get(ctx); auto boxTy = fir::runtime::getModel()(ctx); auto refTy = fir::ReferenceType::get(ty); @@ -633,7 +633,7 @@ struct ForcedReduceReal16Value { ExpandAndQuoteKey(RTNAME(ReduceReal16Value)); static constexpr fir::runtime::FuncTypeBuilderFunc getTypeModel() { return [](mlir::MLIRContext *ctx) { - auto ty = mlir::FloatType::getF128(ctx); + auto ty = mlir::Float128Type::get(ctx); auto boxTy = fir::runtime::getModel()(ctx); auto refTy = fir::ReferenceType::get(ty); @@ -653,7 +653,7 @@ struct ForcedReduceReal10DimRef { ExpandAndQuoteKey(RTNAME(ReduceReal10DimRef)); static constexpr fir::runtime::FuncTypeBuilderFunc getTypeModel() { return [](mlir::MLIRContext *ctx) { - auto ty = mlir::FloatType::getF80(ctx); + auto ty = mlir::Float80Type::get(ctx); auto boxTy = fir::runtime::getModel()(ctx); auto refTy = fir::ReferenceType::get(ty); @@ -675,7 +675,7 @@ struct ForcedReduceReal10DimValue { ExpandAndQuoteKey(RTNAME(ReduceReal10DimValue)); static constexpr fir::runtime::FuncTypeBuilderFunc getTypeModel() { return [](mlir::MLIRContext *ctx) { - auto ty = mlir::FloatType::getF80(ctx); + auto ty = mlir::Float80Type::get(ctx); auto boxTy = fir::runtime::getModel()(ctx); auto refTy = fir::ReferenceType::get(ty); @@ -697,7 +697,7 @@ struct ForcedReduceReal16DimRef { ExpandAndQuoteKey(RTNAME(ReduceReal16DimRef)); static constexpr fir::runtime::FuncTypeBuilderFunc getTypeModel() { return [](mlir::MLIRContext *ctx) { - auto ty = mlir::FloatType::getF128(ctx); + auto ty = mlir::Float128Type::get(ctx); auto boxTy = fir::runtime::getModel()(ctx); auto refTy = fir::ReferenceType::get(ty); @@ -719,7 +719,7 @@ struct ForcedReduceReal16DimValue { ExpandAndQuoteKey(RTNAME(ReduceReal16DimValue)); static constexpr fir::runtime::FuncTypeBuilderFunc getTypeModel() { return [](mlir::MLIRContext *ctx) { - auto ty = mlir::FloatType::getF128(ctx); + auto ty = mlir::Float128Type::get(ctx); auto boxTy = fir::runtime::getModel()(ctx); auto refTy = fir::ReferenceType::get(ty); @@ -911,7 +911,7 @@ struct ForcedReduceComplex10Ref { ExpandAndQuoteKey(RTNAME(CppReduceComplex10Ref)); static constexpr fir::runtime::FuncTypeBuilderFunc getTypeModel() { return [](mlir::MLIRContext *ctx) { - auto ty = mlir::ComplexType::get(mlir::FloatType::getF80(ctx)); + auto ty = mlir::ComplexType::get(mlir::Float80Type::get(ctx)); auto boxTy = fir::runtime::getModel()(ctx); auto refTy = fir::ReferenceType::get(ty); @@ -932,7 +932,7 @@ struct ForcedReduceComplex10Value { ExpandAndQuoteKey(RTNAME(CppReduceComplex10Value)); static constexpr fir::runtime::FuncTypeBuilderFunc getTypeModel() { return [](mlir::MLIRContext *ctx) { - auto ty = mlir::ComplexType::get(mlir::FloatType::getF80(ctx)); + auto ty = mlir::ComplexType::get(mlir::Float80Type::get(ctx)); auto boxTy = fir::runtime::getModel()(ctx); auto refTy = fir::ReferenceType::get(ty); @@ -953,7 +953,7 @@ struct ForcedReduceComplex10DimRef { ExpandAndQuoteKey(RTNAME(CppReduceComplex10DimRef)); static constexpr fir::runtime::FuncTypeBuilderFunc getTypeModel() { return [](mlir::MLIRContext *ctx) { - auto ty = mlir::ComplexType::get(mlir::FloatType::getF80(ctx)); + auto ty = mlir::ComplexType::get(mlir::Float80Type::get(ctx)); auto boxTy = fir::runtime::getModel()(ctx); auto refTy = fir::ReferenceType::get(ty); @@ -975,7 +975,7 @@ struct ForcedReduceComplex10DimValue { ExpandAndQuoteKey(RTNAME(CppReduceComplex10DimValue)); static constexpr fir::runtime::FuncTypeBuilderFunc getTypeModel() { return [](mlir::MLIRContext *ctx) { - auto ty = mlir::ComplexType::get(mlir::FloatType::getF80(ctx)); + auto ty = mlir::ComplexType::get(mlir::Float80Type::get(ctx)); auto boxTy = fir::runtime::getModel()(ctx); auto refTy = fir::ReferenceType::get(ty); @@ -997,7 +997,7 @@ struct ForcedReduceComplex16Ref { ExpandAndQuoteKey(RTNAME(CppReduceComplex16Ref)); static constexpr fir::runtime::FuncTypeBuilderFunc getTypeModel() { return [](mlir::MLIRContext *ctx) { - auto ty = mlir::ComplexType::get(mlir::FloatType::getF128(ctx)); + auto ty = mlir::ComplexType::get(mlir::Float128Type::get(ctx)); auto boxTy = fir::runtime::getModel()(ctx); auto refTy = fir::ReferenceType::get(ty); @@ -1018,7 +1018,7 @@ struct ForcedReduceComplex16Value { ExpandAndQuoteKey(RTNAME(CppReduceComplex16Value)); static constexpr fir::runtime::FuncTypeBuilderFunc getTypeModel() { return [](mlir::MLIRContext *ctx) { - auto ty = mlir::ComplexType::get(mlir::FloatType::getF128(ctx)); + auto ty = mlir::ComplexType::get(mlir::Float128Type::get(ctx)); auto boxTy = fir::runtime::getModel()(ctx); auto refTy = fir::ReferenceType::get(ty); @@ -1039,7 +1039,7 @@ struct ForcedReduceComplex16DimRef { ExpandAndQuoteKey(RTNAME(CppReduceComplex16DimRef)); static constexpr fir::runtime::FuncTypeBuilderFunc getTypeModel() { return [](mlir::MLIRContext *ctx) { - auto ty = mlir::ComplexType::get(mlir::FloatType::getF128(ctx)); + auto ty = mlir::ComplexType::get(mlir::Float128Type::get(ctx)); auto boxTy = fir::runtime::getModel()(ctx); auto refTy = fir::ReferenceType::get(ty); @@ -1061,7 +1061,7 @@ struct ForcedReduceComplex16DimValue { ExpandAndQuoteKey(RTNAME(CppReduceComplex16DimValue)); static constexpr fir::runtime::FuncTypeBuilderFunc getTypeModel() { return [](mlir::MLIRContext *ctx) { - auto ty = mlir::ComplexType::get(mlir::FloatType::getF128(ctx)); + auto ty = mlir::ComplexType::get(mlir::Float128Type::get(ctx)); auto boxTy = fir::runtime::getModel()(ctx); auto refTy = fir::ReferenceType::get(ty); diff --git a/flang/lib/Optimizer/Builder/Runtime/Transformational.cpp b/flang/lib/Optimizer/Builder/Runtime/Transformational.cpp index 517ba3799798f..9492d2d456852 100644 --- a/flang/lib/Optimizer/Builder/Runtime/Transformational.cpp +++ b/flang/lib/Optimizer/Builder/Runtime/Transformational.cpp @@ -25,7 +25,7 @@ struct ForcedBesselJn_10 { static constexpr const char *name = ExpandAndQuoteKey(RTNAME(BesselJn_10)); static constexpr fir::runtime::FuncTypeBuilderFunc getTypeModel() { return [](mlir::MLIRContext *ctx) { - auto ty = mlir::FloatType::getF80(ctx); + auto ty = mlir::Float80Type::get(ctx); auto boxTy = fir::runtime::getModel()(ctx); auto strTy = fir::ReferenceType::get(mlir::IntegerType::get(ctx, 8)); @@ -42,7 +42,7 @@ struct ForcedBesselJn_16 { static constexpr const char *name = ExpandAndQuoteKey(RTNAME(BesselJn_16)); static constexpr fir::runtime::FuncTypeBuilderFunc getTypeModel() { return [](mlir::MLIRContext *ctx) { - auto ty = mlir::FloatType::getF128(ctx); + auto ty = mlir::Float128Type::get(ctx); auto boxTy = fir::runtime::getModel()(ctx); auto strTy = fir::ReferenceType::get(mlir::IntegerType::get(ctx, 8)); @@ -91,7 +91,7 @@ struct ForcedBesselYn_10 { static constexpr const char *name = ExpandAndQuoteKey(RTNAME(BesselYn_10)); static constexpr fir::runtime::FuncTypeBuilderFunc getTypeModel() { return [](mlir::MLIRContext *ctx) { - auto ty = mlir::FloatType::getF80(ctx); + auto ty = mlir::Float80Type::get(ctx); auto boxTy = fir::runtime::getModel()(ctx); auto strTy = fir::ReferenceType::get(mlir::IntegerType::get(ctx, 8)); @@ -108,7 +108,7 @@ struct ForcedBesselYn_16 { static constexpr const char *name = ExpandAndQuoteKey(RTNAME(BesselYn_16)); static constexpr fir::runtime::FuncTypeBuilderFunc getTypeModel() { return [](mlir::MLIRContext *ctx) { - auto ty = mlir::FloatType::getF128(ctx); + auto ty = mlir::Float128Type::get(ctx); auto boxTy = fir::runtime::getModel()(ctx); auto strTy = fir::ReferenceType::get(mlir::IntegerType::get(ctx, 8)); diff --git a/flang/lib/Optimizer/CodeGen/Target.cpp b/flang/lib/Optimizer/CodeGen/Target.cpp index c332493eb8072..1bc673bb34e32 100644 --- a/flang/lib/Optimizer/CodeGen/Target.cpp +++ b/flang/lib/Optimizer/CodeGen/Target.cpp @@ -572,12 +572,12 @@ struct TargetX86_64 : public GenericTarget { // select an fp type of the right size, and it makes things simpler // here. if (partByteSize > 8) - return mlir::FloatType::getF128(context); + return mlir::Float128Type::get(context); if (partByteSize > 4) - return mlir::FloatType::getF64(context); + return mlir::Float64Type::get(context); if (partByteSize > 2) - return mlir::FloatType::getF32(context); - return mlir::FloatType::getF16(context); + return mlir::Float32Type::get(context); + return mlir::Float16Type::get(context); } assert(partByteSize <= 8 && "expect integer part of aggregate argument to fit into eight bytes"); diff --git a/flang/lib/Optimizer/Dialect/FIRType.cpp b/flang/lib/Optimizer/Dialect/FIRType.cpp index d25e5651f1142..d8ce231d1b5a7 100644 --- a/flang/lib/Optimizer/Dialect/FIRType.cpp +++ b/flang/lib/Optimizer/Dialect/FIRType.cpp @@ -1249,17 +1249,17 @@ mlir::Type fir::fromRealTypeID(mlir::MLIRContext *context, llvm::Type::TypeID typeID, fir::KindTy kind) { switch (typeID) { case llvm::Type::TypeID::HalfTyID: - return mlir::FloatType::getF16(context); + return mlir::Float16Type::get(context); case llvm::Type::TypeID::BFloatTyID: - return mlir::FloatType::getBF16(context); + return mlir::BFloat16Type::get(context); case llvm::Type::TypeID::FloatTyID: - return mlir::FloatType::getF32(context); + return mlir::Float32Type::get(context); case llvm::Type::TypeID::DoubleTyID: - return mlir::FloatType::getF64(context); + return mlir::Float64Type::get(context); case llvm::Type::TypeID::X86_FP80TyID: - return mlir::FloatType::getF80(context); + return mlir::Float80Type::get(context); case llvm::Type::TypeID::FP128TyID: - return mlir::FloatType::getF128(context); + return mlir::Float128Type::get(context); default: mlir::emitError(mlir::UnknownLoc::get(context)) << "unsupported type: !fir.real<" << kind << ">"; diff --git a/flang/unittests/Optimizer/Builder/ComplexTest.cpp b/flang/unittests/Optimizer/Builder/ComplexTest.cpp index eefab118e255a..689af4642b0b6 100644 --- a/flang/unittests/Optimizer/Builder/ComplexTest.cpp +++ b/flang/unittests/Optimizer/Builder/ComplexTest.cpp @@ -34,7 +34,7 @@ struct ComplexTest : public testing::Test { helper = std::make_unique(*firBuilder, loc); // Init commonly used types - realTy1 = mlir::FloatType::getF32(&context); + realTy1 = mlir::Float32Type::get(&context); complexTy1 = mlir::ComplexType::get(realTy1); integerTy1 = mlir::IntegerType::get(&context, 32); diff --git a/flang/unittests/Optimizer/Builder/FIRBuilderTest.cpp b/flang/unittests/Optimizer/Builder/FIRBuilderTest.cpp index 05407d96998a2..3e2af24c47b96 100644 --- a/flang/unittests/Optimizer/Builder/FIRBuilderTest.cpp +++ b/flang/unittests/Optimizer/Builder/FIRBuilderTest.cpp @@ -146,7 +146,7 @@ TEST_F(FIRBuilderTest, createRealZeroConstant) { auto builder = getBuilder(); auto ctx = builder.getContext(); auto loc = builder.getUnknownLoc(); - auto realTy = mlir::FloatType::getF64(ctx); + auto realTy = mlir::Float64Type::get(ctx); auto cst = builder.createRealZeroConstant(loc, realTy); EXPECT_TRUE(mlir::isa(cst.getDefiningOp())); auto cstOp = dyn_cast(cst.getDefiningOp()); @@ -434,7 +434,7 @@ TEST_F(FIRBuilderTest, createZeroValue) { auto intAttr = mlir::dyn_cast(cst.getValue()); EXPECT_TRUE(intAttr && intAttr.getInt() == 0); - mlir::Type f32Ty = mlir::FloatType::getF32(builder.getContext()); + mlir::Type f32Ty = mlir::Float32Type::get(builder.getContext()); mlir::Value zeroFloat = fir::factory::createZeroValue(builder, loc, f32Ty); EXPECT_TRUE(zeroFloat.getType() == f32Ty); auto cst2 = mlir::dyn_cast_or_null( @@ -494,7 +494,7 @@ TEST_F(FIRBuilderTest, getBaseTypeOf) { return {scalars, arrays}; }; - auto f32Ty = mlir::FloatType::getF32(builder.getContext()); + auto f32Ty = mlir::Float32Type::get(builder.getContext()); mlir::Type f32SeqTy = builder.getVarLenSeqTy(f32Ty); auto [f32Scalars, f32Arrays] = makeExv(f32Ty, f32SeqTy); for (const auto &scalar : f32Scalars) { @@ -537,7 +537,7 @@ TEST_F(FIRBuilderTest, genArithFastMath) { auto ctx = builder.getContext(); auto loc = builder.getUnknownLoc(); - auto realTy = mlir::FloatType::getF32(ctx); + auto realTy = mlir::Float32Type::get(ctx); auto arg = builder.create(loc, realTy); // Test that FastMathFlags is 'none' by default. diff --git a/flang/unittests/Optimizer/Builder/HLFIRToolsTest.cpp b/flang/unittests/Optimizer/Builder/HLFIRToolsTest.cpp index 640b7ecc1e565..29700d2d3dbff 100644 --- a/flang/unittests/Optimizer/Builder/HLFIRToolsTest.cpp +++ b/flang/unittests/Optimizer/Builder/HLFIRToolsTest.cpp @@ -59,7 +59,7 @@ struct HLFIRToolsTest : public testing::Test { TEST_F(HLFIRToolsTest, testScalarRoundTrip) { auto &builder = getBuilder(); mlir::Location loc = getLoc(); - mlir::Type f32Type = mlir::FloatType::getF32(&context); + mlir::Type f32Type = mlir::Float32Type::get(&context); mlir::Type scalarf32Type = builder.getRefType(f32Type); mlir::Value scalarf32Addr = builder.create(loc, scalarf32Type); fir::ExtendedValue scalarf32{scalarf32Addr}; @@ -82,7 +82,7 @@ TEST_F(HLFIRToolsTest, testArrayRoundTrip) { llvm::SmallVector lbounds{ createConstant(-1), createConstant(-2)}; - mlir::Type f32Type = mlir::FloatType::getF32(&context); + mlir::Type f32Type = mlir::Float32Type::get(&context); mlir::Type seqf32Type = builder.getVarLenSeqTy(f32Type, 2); mlir::Type arrayf32Type = builder.getRefType(seqf32Type); mlir::Value arrayf32Addr = builder.create(loc, arrayf32Type); diff --git a/flang/unittests/Optimizer/FIRTypesTest.cpp b/flang/unittests/Optimizer/FIRTypesTest.cpp index a07c018a8afd5..b3151b4aa7efb 100644 --- a/flang/unittests/Optimizer/FIRTypesTest.cpp +++ b/flang/unittests/Optimizer/FIRTypesTest.cpp @@ -227,7 +227,7 @@ TEST_F(FIRTypesTest, updateTypeForUnlimitedPolymorphic) { mlir::Type ptrArrNone = fir::PointerType::get(arrNone); mlir::Type i32Ty = mlir::IntegerType::get(&context, 32); - mlir::Type f32Ty = mlir::FloatType::getF32(&context); + mlir::Type f32Ty = mlir::Float32Type::get(&context); mlir::Type l1Ty = fir::LogicalType::get(&context, 1); mlir::Type cplx32Ty = mlir::ComplexType::get(f32Ty); mlir::Type char1Ty = fir::CharacterType::get(&context, 1, 10); @@ -268,12 +268,12 @@ TEST_F(FIRTypesTest, getTypeAsString) { fir::ReferenceType::get(mlir::IntegerType::get(&context, 32)), *kindMap)); EXPECT_EQ( - "f64", fir::getTypeAsString(mlir::FloatType::getF64(&context), *kindMap)); + "f64", fir::getTypeAsString(mlir::Float64Type::get(&context), *kindMap)); EXPECT_EQ( "l8", fir::getTypeAsString(fir::LogicalType::get(&context, 1), *kindMap)); EXPECT_EQ("z32", fir::getTypeAsString( - mlir::ComplexType::get(mlir::FloatType::getF32(&context)), *kindMap)); + mlir::ComplexType::get(mlir::Float32Type::get(&context)), *kindMap)); EXPECT_EQ("c8", fir::getTypeAsString(fir::CharacterType::get(&context, 1, 1), *kindMap)); EXPECT_EQ("c8x10", diff --git a/flang/unittests/Optimizer/FortranVariableTest.cpp b/flang/unittests/Optimizer/FortranVariableTest.cpp index 4ba9359a07e4d..30c23b63b4d56 100644 --- a/flang/unittests/Optimizer/FortranVariableTest.cpp +++ b/flang/unittests/Optimizer/FortranVariableTest.cpp @@ -45,7 +45,7 @@ struct FortranVariableTest : public testing::Test { TEST_F(FortranVariableTest, SimpleScalar) { mlir::Location loc = getLoc(); - mlir::Type eleType = mlir::FloatType::getF32(&context); + mlir::Type eleType = mlir::Float32Type::get(&context); mlir::Value addr = builder->create(loc, eleType); auto name = mlir::StringAttr::get(&context, "x"); auto declare = builder->create(loc, addr.getType(), addr, @@ -96,7 +96,7 @@ TEST_F(FortranVariableTest, CharacterScalar) { TEST_F(FortranVariableTest, SimpleArray) { mlir::Location loc = getLoc(); - mlir::Type eleType = mlir::FloatType::getF32(&context); + mlir::Type eleType = mlir::Float32Type::get(&context); llvm::SmallVector extents{ createConstant(10), createConstant(20), createConstant(30)}; fir::SequenceType::Shape typeShape( diff --git a/flang/unittests/Optimizer/RTBuilder.cpp b/flang/unittests/Optimizer/RTBuilder.cpp index 35b9f1a6d5dcb..00960801928f7 100644 --- a/flang/unittests/Optimizer/RTBuilder.cpp +++ b/flang/unittests/Optimizer/RTBuilder.cpp @@ -31,7 +31,7 @@ TEST(RTBuilderTest, ComplexRuntimeInterface) { auto c99_cacosf_funcTy = mlir::cast(c99_cacosf_signature); EXPECT_EQ(c99_cacosf_funcTy.getNumInputs(), 1u); EXPECT_EQ(c99_cacosf_funcTy.getNumResults(), 1u); - auto cplx_ty = mlir::ComplexType::get(mlir::FloatType::getF32(&ctx)); + auto cplx_ty = mlir::ComplexType::get(mlir::Float32Type::get(&ctx)); EXPECT_EQ(c99_cacosf_funcTy.getInput(0), cplx_ty); EXPECT_EQ(c99_cacosf_funcTy.getResult(0), cplx_ty); } diff --git a/mlir/include/mlir/IR/BuiltinTypeInterfaces.td b/mlir/include/mlir/IR/BuiltinTypeInterfaces.td index c36b738e38f42..8aa2c55570153 100644 --- a/mlir/include/mlir/IR/BuiltinTypeInterfaces.td +++ b/mlir/include/mlir/IR/BuiltinTypeInterfaces.td @@ -46,26 +46,6 @@ def FloatTypeInterface : TypeInterface<"FloatType"> { ]; let extraClassDeclaration = [{ - // Convenience factories. - static FloatType getBF16(MLIRContext *ctx); - static FloatType getF16(MLIRContext *ctx); - static FloatType getF32(MLIRContext *ctx); - static FloatType getTF32(MLIRContext *ctx); - static FloatType getF64(MLIRContext *ctx); - static FloatType getF80(MLIRContext *ctx); - static FloatType getF128(MLIRContext *ctx); - static FloatType getFloat8E5M2(MLIRContext *ctx); - static FloatType getFloat8E4M3(MLIRContext *ctx); - static FloatType getFloat8E4M3FN(MLIRContext *ctx); - static FloatType getFloat8E5M2FNUZ(MLIRContext *ctx); - static FloatType getFloat8E4M3FNUZ(MLIRContext *ctx); - static FloatType getFloat8E4M3B11FNUZ(MLIRContext *ctx); - static FloatType getFloat8E3M4(MLIRContext *ctx); - static FloatType getFloat4E2M1FN(MLIRContext *ctx); - static FloatType getFloat6E2M3FN(MLIRContext *ctx); - static FloatType getFloat6E3M2FN(MLIRContext *ctx); - static FloatType getFloat8E8M0FNU(MLIRContext *ctx); - /// Return the bitwidth of this float type. unsigned getWidth(); diff --git a/mlir/include/mlir/IR/BuiltinTypes.h b/mlir/include/mlir/IR/BuiltinTypes.h index 2b3c2b6d1753d..19c5361124aac 100644 --- a/mlir/include/mlir/IR/BuiltinTypes.h +++ b/mlir/include/mlir/IR/BuiltinTypes.h @@ -401,78 +401,6 @@ inline bool BaseMemRefType::isValidElementType(Type type) { llvm::isa(type); } -inline FloatType FloatType::getFloat4E2M1FN(MLIRContext *ctx) { - return Float4E2M1FNType::get(ctx); -} - -inline FloatType FloatType::getFloat6E2M3FN(MLIRContext *ctx) { - return Float6E2M3FNType::get(ctx); -} - -inline FloatType FloatType::getFloat6E3M2FN(MLIRContext *ctx) { - return Float6E3M2FNType::get(ctx); -} - -inline FloatType FloatType::getFloat8E5M2(MLIRContext *ctx) { - return Float8E5M2Type::get(ctx); -} - -inline FloatType FloatType::getFloat8E4M3(MLIRContext *ctx) { - return Float8E4M3Type::get(ctx); -} - -inline FloatType FloatType::getFloat8E4M3FN(MLIRContext *ctx) { - return Float8E4M3FNType::get(ctx); -} - -inline FloatType FloatType::getFloat8E5M2FNUZ(MLIRContext *ctx) { - return Float8E5M2FNUZType::get(ctx); -} - -inline FloatType FloatType::getFloat8E4M3FNUZ(MLIRContext *ctx) { - return Float8E4M3FNUZType::get(ctx); -} - -inline FloatType FloatType::getFloat8E4M3B11FNUZ(MLIRContext *ctx) { - return Float8E4M3B11FNUZType::get(ctx); -} - -inline FloatType FloatType::getFloat8E3M4(MLIRContext *ctx) { - return Float8E3M4Type::get(ctx); -} - -inline FloatType FloatType::getFloat8E8M0FNU(MLIRContext *ctx) { - return Float8E8M0FNUType::get(ctx); -} - -inline FloatType FloatType::getBF16(MLIRContext *ctx) { - return BFloat16Type::get(ctx); -} - -inline FloatType FloatType::getF16(MLIRContext *ctx) { - return Float16Type::get(ctx); -} - -inline FloatType FloatType::getTF32(MLIRContext *ctx) { - return FloatTF32Type::get(ctx); -} - -inline FloatType FloatType::getF32(MLIRContext *ctx) { - return Float32Type::get(ctx); -} - -inline FloatType FloatType::getF64(MLIRContext *ctx) { - return Float64Type::get(ctx); -} - -inline FloatType FloatType::getF80(MLIRContext *ctx) { - return Float80Type::get(ctx); -} - -inline FloatType FloatType::getF128(MLIRContext *ctx) { - return Float128Type::get(ctx); -} - inline bool TensorType::classof(Type type) { return llvm::isa(type); } diff --git a/mlir/lib/CAPI/IR/BuiltinTypes.cpp b/mlir/lib/CAPI/IR/BuiltinTypes.cpp index 252ff54afe0c5..250e4a6bbf8df 100644 --- a/mlir/lib/CAPI/IR/BuiltinTypes.cpp +++ b/mlir/lib/CAPI/IR/BuiltinTypes.cpp @@ -94,7 +94,7 @@ bool mlirTypeIsAFloat4E2M1FN(MlirType type) { } MlirType mlirFloat4E2M1FNTypeGet(MlirContext ctx) { - return wrap(FloatType::getFloat4E2M1FN(unwrap(ctx))); + return wrap(Float4E2M1FNType::get(unwrap(ctx))); } MlirTypeID mlirFloat6E2M3FNTypeGetTypeID() { @@ -106,7 +106,7 @@ bool mlirTypeIsAFloat6E2M3FN(MlirType type) { } MlirType mlirFloat6E2M3FNTypeGet(MlirContext ctx) { - return wrap(FloatType::getFloat6E2M3FN(unwrap(ctx))); + return wrap(Float6E2M3FNType::get(unwrap(ctx))); } MlirTypeID mlirFloat6E3M2FNTypeGetTypeID() { @@ -118,7 +118,7 @@ bool mlirTypeIsAFloat6E3M2FN(MlirType type) { } MlirType mlirFloat6E3M2FNTypeGet(MlirContext ctx) { - return wrap(FloatType::getFloat6E3M2FN(unwrap(ctx))); + return wrap(Float6E3M2FNType::get(unwrap(ctx))); } MlirTypeID mlirFloat8E5M2TypeGetTypeID() { @@ -130,7 +130,7 @@ bool mlirTypeIsAFloat8E5M2(MlirType type) { } MlirType mlirFloat8E5M2TypeGet(MlirContext ctx) { - return wrap(FloatType::getFloat8E5M2(unwrap(ctx))); + return wrap(Float8E5M2Type::get(unwrap(ctx))); } MlirTypeID mlirFloat8E4M3TypeGetTypeID() { @@ -142,7 +142,7 @@ bool mlirTypeIsAFloat8E4M3(MlirType type) { } MlirType mlirFloat8E4M3TypeGet(MlirContext ctx) { - return wrap(FloatType::getFloat8E4M3(unwrap(ctx))); + return wrap(Float8E4M3Type::get(unwrap(ctx))); } MlirTypeID mlirFloat8E4M3FNTypeGetTypeID() { @@ -154,7 +154,7 @@ bool mlirTypeIsAFloat8E4M3FN(MlirType type) { } MlirType mlirFloat8E4M3FNTypeGet(MlirContext ctx) { - return wrap(FloatType::getFloat8E4M3FN(unwrap(ctx))); + return wrap(Float8E4M3FNType::get(unwrap(ctx))); } MlirTypeID mlirFloat8E5M2FNUZTypeGetTypeID() { @@ -166,7 +166,7 @@ bool mlirTypeIsAFloat8E5M2FNUZ(MlirType type) { } MlirType mlirFloat8E5M2FNUZTypeGet(MlirContext ctx) { - return wrap(FloatType::getFloat8E5M2FNUZ(unwrap(ctx))); + return wrap(Float8E5M2FNUZType::get(unwrap(ctx))); } MlirTypeID mlirFloat8E4M3FNUZTypeGetTypeID() { @@ -178,7 +178,7 @@ bool mlirTypeIsAFloat8E4M3FNUZ(MlirType type) { } MlirType mlirFloat8E4M3FNUZTypeGet(MlirContext ctx) { - return wrap(FloatType::getFloat8E4M3FNUZ(unwrap(ctx))); + return wrap(Float8E4M3FNUZType::get(unwrap(ctx))); } MlirTypeID mlirFloat8E4M3B11FNUZTypeGetTypeID() { @@ -190,7 +190,7 @@ bool mlirTypeIsAFloat8E4M3B11FNUZ(MlirType type) { } MlirType mlirFloat8E4M3B11FNUZTypeGet(MlirContext ctx) { - return wrap(FloatType::getFloat8E4M3B11FNUZ(unwrap(ctx))); + return wrap(Float8E4M3B11FNUZType::get(unwrap(ctx))); } MlirTypeID mlirFloat8E3M4TypeGetTypeID() { @@ -202,7 +202,7 @@ bool mlirTypeIsAFloat8E3M4(MlirType type) { } MlirType mlirFloat8E3M4TypeGet(MlirContext ctx) { - return wrap(FloatType::getFloat8E3M4(unwrap(ctx))); + return wrap(Float8E3M4Type::get(unwrap(ctx))); } MlirTypeID mlirFloat8E8M0FNUTypeGetTypeID() { @@ -214,7 +214,7 @@ bool mlirTypeIsAFloat8E8M0FNU(MlirType type) { } MlirType mlirFloat8E8M0FNUTypeGet(MlirContext ctx) { - return wrap(FloatType::getFloat8E8M0FNU(unwrap(ctx))); + return wrap(Float8E8M0FNUType::get(unwrap(ctx))); } MlirTypeID mlirBFloat16TypeGetTypeID() { @@ -224,7 +224,7 @@ MlirTypeID mlirBFloat16TypeGetTypeID() { bool mlirTypeIsABF16(MlirType type) { return unwrap(type).isBF16(); } MlirType mlirBF16TypeGet(MlirContext ctx) { - return wrap(FloatType::getBF16(unwrap(ctx))); + return wrap(BFloat16Type::get(unwrap(ctx))); } MlirTypeID mlirFloat16TypeGetTypeID() { return wrap(Float16Type::getTypeID()); } @@ -232,7 +232,7 @@ MlirTypeID mlirFloat16TypeGetTypeID() { return wrap(Float16Type::getTypeID()); } bool mlirTypeIsAF16(MlirType type) { return unwrap(type).isF16(); } MlirType mlirF16TypeGet(MlirContext ctx) { - return wrap(FloatType::getF16(unwrap(ctx))); + return wrap(Float16Type::get(unwrap(ctx))); } MlirTypeID mlirFloatTF32TypeGetTypeID() { @@ -242,7 +242,7 @@ MlirTypeID mlirFloatTF32TypeGetTypeID() { bool mlirTypeIsATF32(MlirType type) { return unwrap(type).isTF32(); } MlirType mlirTF32TypeGet(MlirContext ctx) { - return wrap(FloatType::getTF32(unwrap(ctx))); + return wrap(FloatTF32Type::get(unwrap(ctx))); } MlirTypeID mlirFloat32TypeGetTypeID() { return wrap(Float32Type::getTypeID()); } @@ -250,7 +250,7 @@ MlirTypeID mlirFloat32TypeGetTypeID() { return wrap(Float32Type::getTypeID()); } bool mlirTypeIsAF32(MlirType type) { return unwrap(type).isF32(); } MlirType mlirF32TypeGet(MlirContext ctx) { - return wrap(FloatType::getF32(unwrap(ctx))); + return wrap(Float32Type::get(unwrap(ctx))); } MlirTypeID mlirFloat64TypeGetTypeID() { return wrap(Float64Type::getTypeID()); } @@ -258,7 +258,7 @@ MlirTypeID mlirFloat64TypeGetTypeID() { return wrap(Float64Type::getTypeID()); } bool mlirTypeIsAF64(MlirType type) { return unwrap(type).isF64(); } MlirType mlirF64TypeGet(MlirContext ctx) { - return wrap(FloatType::getF64(unwrap(ctx))); + return wrap(Float64Type::get(unwrap(ctx))); } //===----------------------------------------------------------------------===// diff --git a/mlir/lib/IR/Builders.cpp b/mlir/lib/IR/Builders.cpp index edc4709ec3c6e..8439b063f2634 100644 --- a/mlir/lib/IR/Builders.cpp +++ b/mlir/lib/IR/Builders.cpp @@ -35,62 +35,56 @@ Location Builder::getFusedLoc(ArrayRef locs, Attribute metadata) { //===----------------------------------------------------------------------===// FloatType Builder::getFloat4E2M1FNType() { - return FloatType::getFloat4E2M1FN(context); + return Float4E2M1FNType::get(context); } FloatType Builder::getFloat6E2M3FNType() { - return FloatType::getFloat6E2M3FN(context); + return Float6E2M3FNType::get(context); } FloatType Builder::getFloat6E3M2FNType() { - return FloatType::getFloat6E3M2FN(context); + return Float6E3M2FNType::get(context); } -FloatType Builder::getFloat8E5M2Type() { - return FloatType::getFloat8E5M2(context); -} +FloatType Builder::getFloat8E5M2Type() { return Float8E5M2Type::get(context); } -FloatType Builder::getFloat8E4M3Type() { - return FloatType::getFloat8E4M3(context); -} +FloatType Builder::getFloat8E4M3Type() { return Float8E4M3Type::get(context); } FloatType Builder::getFloat8E4M3FNType() { - return FloatType::getFloat8E4M3FN(context); + return Float8E4M3FNType::get(context); } FloatType Builder::getFloat8E5M2FNUZType() { - return FloatType::getFloat8E5M2FNUZ(context); + return Float8E5M2FNUZType::get(context); } FloatType Builder::getFloat8E4M3FNUZType() { - return FloatType::getFloat8E4M3FNUZ(context); + return Float8E4M3FNUZType::get(context); } FloatType Builder::getFloat8E4M3B11FNUZType() { - return FloatType::getFloat8E4M3B11FNUZ(context); + return Float8E4M3B11FNUZType::get(context); } -FloatType Builder::getFloat8E3M4Type() { - return FloatType::getFloat8E3M4(context); -} +FloatType Builder::getFloat8E3M4Type() { return Float8E3M4Type::get(context); } FloatType Builder::getFloat8E8M0FNUType() { - return FloatType::getFloat8E8M0FNU(context); + return Float8E8M0FNUType::get(context); } -FloatType Builder::getBF16Type() { return FloatType::getBF16(context); } +FloatType Builder::getBF16Type() { return BFloat16Type::get(context); } -FloatType Builder::getF16Type() { return FloatType::getF16(context); } +FloatType Builder::getF16Type() { return Float16Type::get(context); } -FloatType Builder::getTF32Type() { return FloatType::getTF32(context); } +FloatType Builder::getTF32Type() { return FloatTF32Type::get(context); } -FloatType Builder::getF32Type() { return FloatType::getF32(context); } +FloatType Builder::getF32Type() { return Float32Type::get(context); } -FloatType Builder::getF64Type() { return FloatType::getF64(context); } +FloatType Builder::getF64Type() { return Float64Type::get(context); } -FloatType Builder::getF80Type() { return FloatType::getF80(context); } +FloatType Builder::getF80Type() { return Float80Type::get(context); } -FloatType Builder::getF128Type() { return FloatType::getF128(context); } +FloatType Builder::getF128Type() { return Float128Type::get(context); } IndexType Builder::getIndexType() { return IndexType::get(context); } diff --git a/mlir/lib/IR/BuiltinTypes.cpp b/mlir/lib/IR/BuiltinTypes.cpp index 41b794bc0aec5..bd1163bddf7ee 100644 --- a/mlir/lib/IR/BuiltinTypes.cpp +++ b/mlir/lib/IR/BuiltinTypes.cpp @@ -117,23 +117,23 @@ FLOAT_TYPE_SEMANTICS(Float128Type, IEEEquad) FloatType Float16Type::scaleElementBitwidth(unsigned scale) const { if (scale == 2) - return FloatType::getF32(getContext()); + return Float32Type::get(getContext()); if (scale == 4) - return FloatType::getF64(getContext()); + return Float64Type::get(getContext()); return FloatType(); } FloatType BFloat16Type::scaleElementBitwidth(unsigned scale) const { if (scale == 2) - return FloatType::getF32(getContext()); + return Float32Type::get(getContext()); if (scale == 4) - return FloatType::getF64(getContext()); + return Float64Type::get(getContext()); return FloatType(); } FloatType Float32Type::scaleElementBitwidth(unsigned scale) const { if (scale == 2) - return FloatType::getF64(getContext()); + return Float64Type::get(getContext()); return FloatType(); } diff --git a/mlir/lib/Target/LLVMIR/DataLayoutImporter.cpp b/mlir/lib/Target/LLVMIR/DataLayoutImporter.cpp index 35001757f214e..35fdbc0be22c3 100644 --- a/mlir/lib/Target/LLVMIR/DataLayoutImporter.cpp +++ b/mlir/lib/Target/LLVMIR/DataLayoutImporter.cpp @@ -29,15 +29,15 @@ FloatType mlir::LLVM::detail::getFloatType(MLIRContext *context, unsigned width) { switch (width) { case 16: - return FloatType::getF16(context); + return Float16Type::get(context); case 32: - return FloatType::getF32(context); + return Float32Type::get(context); case 64: - return FloatType::getF64(context); + return Float64Type::get(context); case 80: - return FloatType::getF80(context); + return Float80Type::get(context); case 128: - return FloatType::getF128(context); + return Float128Type::get(context); default: return {}; } diff --git a/mlir/lib/Target/LLVMIR/ModuleImport.cpp b/mlir/lib/Target/LLVMIR/ModuleImport.cpp index eba86f06d0905..f6826a2362bfd 100644 --- a/mlir/lib/Target/LLVMIR/ModuleImport.cpp +++ b/mlir/lib/Target/LLVMIR/ModuleImport.cpp @@ -816,7 +816,7 @@ static TypedAttr getScalarConstantAsAttr(OpBuilder &builder, llvm::Type *type = constFloat->getType(); FloatType floatType = type->isBFloatTy() - ? FloatType::getBF16(context) + ? BFloat16Type::get(context) : LLVM::detail::getFloatType(context, type->getScalarSizeInBits()); if (!floatType) { emitError(UnknownLoc::get(builder.getContext())) diff --git a/mlir/test/lib/Dialect/Affine/TestVectorizationUtils.cpp b/mlir/test/lib/Dialect/Affine/TestVectorizationUtils.cpp index 598678f64cb46..c32bd24014215 100644 --- a/mlir/test/lib/Dialect/Affine/TestVectorizationUtils.cpp +++ b/mlir/test/lib/Dialect/Affine/TestVectorizationUtils.cpp @@ -101,8 +101,7 @@ void VectorizerTestPass::testVectorShapeRatio(llvm::raw_ostream &outs) { using affine::matcher::Op; SmallVector shape(clTestVectorShapeRatio.begin(), clTestVectorShapeRatio.end()); - auto subVectorType = - VectorType::get(shape, FloatType::getF32(f.getContext())); + auto subVectorType = VectorType::get(shape, Float32Type::get(f.getContext())); // Only filter operations that operate on a strict super-vector and have one // return. This makes testing easier. auto filter = [&](Operation &op) { diff --git a/mlir/test/lib/Dialect/Test/TestPatterns.cpp b/mlir/test/lib/Dialect/Test/TestPatterns.cpp index 5b7c36c9b97bf..b20e0816bd17c 100644 --- a/mlir/test/lib/Dialect/Test/TestPatterns.cpp +++ b/mlir/test/lib/Dialect/Test/TestPatterns.cpp @@ -1286,7 +1286,7 @@ struct TestTypeConverter : public TypeConverter { // Convert I64 to F64. if (t.isSignlessInteger(64)) { - results.push_back(FloatType::getF64(t.getContext())); + results.push_back(Float64Type::get(t.getContext())); return success(); } @@ -1298,7 +1298,7 @@ struct TestTypeConverter : public TypeConverter { // Split F32 into F16,F16. if (t.isF32()) { - results.assign(2, FloatType::getF16(t.getContext())); + results.assign(2, Float16Type::get(t.getContext())); return success(); } @@ -1826,7 +1826,7 @@ struct TestTypeConversionDriver return type; // Allow converting BF16/F16/F32 to F64. if (type.isBF16() || type.isF16() || type.isF32()) - return FloatType::getF64(type.getContext()); + return Float64Type::get(type.getContext()); // Otherwise, the type is illegal. return nullptr; }); diff --git a/mlir/test/lib/Transforms/TestDialectConversion.cpp b/mlir/test/lib/Transforms/TestDialectConversion.cpp index a03bf0a1023d5..8278937a1014c 100644 --- a/mlir/test/lib/Transforms/TestDialectConversion.cpp +++ b/mlir/test/lib/Transforms/TestDialectConversion.cpp @@ -34,7 +34,7 @@ struct PDLLTypeConverter : public TypeConverter { static LogicalResult convertType(Type t, SmallVectorImpl &results) { // Convert I64 to F64. if (t.isSignlessInteger(64)) { - results.push_back(FloatType::getF64(t.getContext())); + results.push_back(Float64Type::get(t.getContext())); return success(); } diff --git a/mlir/tools/tblgen-to-irdl/OpDefinitionsGen.cpp b/mlir/tools/tblgen-to-irdl/OpDefinitionsGen.cpp index a763105fa0fd6..4e354e535dd3a 100644 --- a/mlir/tools/tblgen-to-irdl/OpDefinitionsGen.cpp +++ b/mlir/tools/tblgen-to-irdl/OpDefinitionsGen.cpp @@ -107,15 +107,15 @@ std::optional recordToType(MLIRContext *ctx, const Record &predRec) { auto width = predRec.getValueAsInt("bitwidth"); switch (width) { case 16: - return FloatType::getF16(ctx); + return Float16Type::get(ctx); case 32: - return FloatType::getF32(ctx); + return Float32Type::get(ctx); case 64: - return FloatType::getF64(ctx); + return Float64Type::get(ctx); case 80: - return FloatType::getF80(ctx); + return Float80Type::get(ctx); case 128: - return FloatType::getF128(ctx); + return Float128Type::get(ctx); } } @@ -124,39 +124,39 @@ std::optional recordToType(MLIRContext *ctx, const Record &predRec) { } if (predRec.getName() == "BF16") { - return FloatType::getBF16(ctx); + return BFloat16Type::get(ctx); } if (predRec.getName() == "TF32") { - return FloatType::getTF32(ctx); + return FloatTF32Type::get(ctx); } if (predRec.getName() == "F8E4M3FN") { - return FloatType::getFloat8E4M3FN(ctx); + return Float8E4M3FNType::get(ctx); } if (predRec.getName() == "F8E5M2") { - return FloatType::getFloat8E5M2(ctx); + return Float8E5M2Type::get(ctx); } if (predRec.getName() == "F8E4M3") { - return FloatType::getFloat8E4M3(ctx); + return Float8E4M3Type::get(ctx); } if (predRec.getName() == "F8E4M3FNUZ") { - return FloatType::getFloat8E4M3FNUZ(ctx); + return Float8E4M3FNUZType::get(ctx); } if (predRec.getName() == "F8E4M3B11FNUZ") { - return FloatType::getFloat8E4M3B11FNUZ(ctx); + return Float8E4M3B11FNUZType::get(ctx); } if (predRec.getName() == "F8E5M2FNUZ") { - return FloatType::getFloat8E5M2FNUZ(ctx); + return Float8E5M2FNUZType::get(ctx); } if (predRec.getName() == "F8E3M4") { - return FloatType::getFloat8E3M4(ctx); + return Float8E3M4Type::get(ctx); } if (predRec.isSubClassOf("Complex")) { diff --git a/mlir/unittests/IR/AttributeTest.cpp b/mlir/unittests/IR/AttributeTest.cpp index 2b2ec05673943..a55592db7132d 100644 --- a/mlir/unittests/IR/AttributeTest.cpp +++ b/mlir/unittests/IR/AttributeTest.cpp @@ -154,7 +154,7 @@ TEST(DenseSplatTest, IntAttrSplat) { TEST(DenseSplatTest, F32Splat) { MLIRContext context; - FloatType floatTy = FloatType::getF32(&context); + FloatType floatTy = Float32Type::get(&context); float value = 10.0; testSplat(floatTy, value); @@ -162,7 +162,7 @@ TEST(DenseSplatTest, F32Splat) { TEST(DenseSplatTest, F64Splat) { MLIRContext context; - FloatType floatTy = FloatType::getF64(&context); + FloatType floatTy = Float64Type::get(&context); double value = 10.0; testSplat(floatTy, APFloat(value)); @@ -170,7 +170,7 @@ TEST(DenseSplatTest, F64Splat) { TEST(DenseSplatTest, FloatAttrSplat) { MLIRContext context; - FloatType floatTy = FloatType::getF32(&context); + FloatType floatTy = Float32Type::get(&context); Attribute value = FloatAttr::get(floatTy, 10.0); testSplat(floatTy, value); @@ -178,7 +178,7 @@ TEST(DenseSplatTest, FloatAttrSplat) { TEST(DenseSplatTest, BF16Splat) { MLIRContext context; - FloatType floatTy = FloatType::getBF16(&context); + FloatType floatTy = BFloat16Type::get(&context); Attribute value = FloatAttr::get(floatTy, 10.0); testSplat(floatTy, value); @@ -204,7 +204,7 @@ TEST(DenseSplatTest, StringAttrSplat) { TEST(DenseComplexTest, ComplexFloatSplat) { MLIRContext context; - ComplexType complexType = ComplexType::get(FloatType::getF32(&context)); + ComplexType complexType = ComplexType::get(Float32Type::get(&context)); std::complex value(10.0, 15.0); testSplat(complexType, value); } @@ -218,7 +218,7 @@ TEST(DenseComplexTest, ComplexIntSplat) { TEST(DenseComplexTest, ComplexAPFloatSplat) { MLIRContext context; - ComplexType complexType = ComplexType::get(FloatType::getF32(&context)); + ComplexType complexType = ComplexType::get(Float32Type::get(&context)); std::complex value(APFloat(10.0f), APFloat(15.0f)); testSplat(complexType, value); } @@ -409,7 +409,7 @@ TEST(SparseElementsAttrTest, GetZero) { context.allowUnregisteredDialects(); IntegerType intTy = IntegerType::get(&context, 32); - FloatType floatTy = FloatType::getF32(&context); + FloatType floatTy = Float32Type::get(&context); Type stringTy = OpaqueType::get(StringAttr::get(&context, "test"), "string"); ShapedType tensorI32 = RankedTensorType::get({2, 2}, intTy); diff --git a/mlir/unittests/IR/ShapedTypeTest.cpp b/mlir/unittests/IR/ShapedTypeTest.cpp index 7a5b0722a03ba..c2900b5aaeeeb 100644 --- a/mlir/unittests/IR/ShapedTypeTest.cpp +++ b/mlir/unittests/IR/ShapedTypeTest.cpp @@ -24,7 +24,7 @@ TEST(ShapedTypeTest, CloneMemref) { MLIRContext context; Type i32 = IntegerType::get(&context, 32); - Type f32 = FloatType::getF32(&context); + Type f32 = Float32Type::get(&context); Attribute memSpace = IntegerAttr::get(IntegerType::get(&context, 64), 7); Type memrefOriginalType = i32; llvm::SmallVector memrefOriginalShape({10, 20}); @@ -71,7 +71,7 @@ TEST(ShapedTypeTest, CloneTensor) { MLIRContext context; Type i32 = IntegerType::get(&context, 32); - Type f32 = FloatType::getF32(&context); + Type f32 = Float32Type::get(&context); Type tensorOriginalType = i32; llvm::SmallVector tensorOriginalShape({10, 20}); @@ -111,7 +111,7 @@ TEST(ShapedTypeTest, CloneVector) { MLIRContext context; Type i32 = IntegerType::get(&context, 32); - Type f32 = FloatType::getF32(&context); + Type f32 = Float32Type::get(&context); Type vectorOriginalType = i32; llvm::SmallVector vectorOriginalShape({10, 20}); @@ -134,7 +134,7 @@ TEST(ShapedTypeTest, CloneVector) { TEST(ShapedTypeTest, VectorTypeBuilder) { MLIRContext context; - Type f32 = FloatType::getF32(&context); + Type f32 = Float32Type::get(&context); SmallVector shape{2, 4, 8, 9, 1}; SmallVector scalableDims{true, false, true, false, false}; @@ -192,7 +192,7 @@ TEST(ShapedTypeTest, VectorTypeBuilder) { TEST(ShapedTypeTest, RankedTensorTypeBuilder) { MLIRContext context; - Type f32 = FloatType::getF32(&context); + Type f32 = Float32Type::get(&context); SmallVector shape{2, 4, 8, 16, 32}; RankedTensorType tensorType = RankedTensorType::get(shape, f32); @@ -254,7 +254,7 @@ class TensorWithString : public RankedTensorType { TEST(ShapedTypeTest, RankedTensorTypeView) { MLIRContext context; - Type f32 = FloatType::getF32(&context); + Type f32 = Float32Type::get(&context); Type noEncodingRankedTensorType = RankedTensorType::get({10, 20}, f32);