================ @@ -982,13 +1024,18 @@ ComplexPairTy ComplexExprEmitter::EmitBinDiv(const BinOpInfo &Op) { llvm::Value *OrigLHSi = LHSi; if (!LHSi) LHSi = llvm::Constant::getNullValue(RHSi->getType()); - if (Op.FPFeatures.getComplexRange() == LangOptions::CX_Fortran) + QualType ComplexElementTy = Op.Ty->castAs<ComplexType>()->getElementType(); + const BuiltinType *BT = ComplexElementTy->getAs<BuiltinType>(); + if (Op.FPFeatures.getComplexRange() == LangOptions::CX_Improved || + (Op.FPFeatures.getComplexRange() == LangOptions::CX_Promoted && + BT->getKind() == BuiltinType::Kind::Double)) ---------------- jcranmer-intel wrote:
I still don't think this is the right way to do this logic. It's probably better to have a local effective complex range kind variable, and if promoted is requested but can't be done, have it swap it to improved. (This will definitely break down for decimal floats/hexfloats!) 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