================ @@ -283,9 +283,48 @@ class ComplexExprEmitter ComplexPairTy EmitComplexBinOpLibCall(StringRef LibCallName, const BinOpInfo &Op); - QualType getPromotionType(QualType Ty) { + QualType HigherPrecisionTypeForComplexArithmetic(QualType ElementType, + bool IsDivOpCode) { + const TargetInfo &TI = CGF.getContext().getTargetInfo(); + if (const auto *BT = dyn_cast<BuiltinType>(ElementType)) { + switch (BT->getKind()) { + case BuiltinType::Kind::Float16: + case BuiltinType::Kind::BFloat16: { + return CGF.getContext().getComplexType(CGF.getContext().FloatTy); + } + case BuiltinType::Kind::Float: + return CGF.getContext().getComplexType(CGF.getContext().DoubleTy); + case BuiltinType::Kind::Double: + if (TI.hasLongDoubleType()) { + return CGF.getContext().getComplexType(CGF.getContext().LongDoubleTy); + } else { + return QualType(); + } + case BuiltinType::Kind::LongDouble: ---------------- andykaylor wrote:
This is more complicated than what you have here. The C "long double" type may be 64-bit, 80-bit, or 128-bit, depending on the target. You can get the size from LangOpts::LongDoubleSize if that's accessible here. https://github.com/llvm/llvm-project/pull/81514 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits