majnemer added inline comments. ================ Comment at: lib/CodeGen/TargetInfo.cpp:1974-1989 @@ -1973,8 +1973,18 @@ Current = SSE; else if (ET == getContext().DoubleTy || (ET == getContext().LongDoubleTy && getTarget().getTriple().isOSNaCl())) Lo = Hi = SSE; - else if (ET == getContext().LongDoubleTy) - Current = ComplexX87; + else if (ET == getContext().LongDoubleTy) { + // AMD64 ABI says that long double should be f80 and + // complex long double should be ComplexX87. + // However, it also defines __float128 as f128 in SSE, + // complex float and complex double like structure. + // So complex __float128 should be like structure, + // which is also implemented by gcc. + if (auto ResType = CGT.ConvertType(ET)) + Current = ResType->isFP128Ty() ? Memory : ComplexX87; + else + Current = ComplexX87; + } ---------------- I'd phrase this as: } else if (ET == getContext().DoubleTy) { Lo = Hi = SSE; } else if (ET == getContext().LongDoubleTy) { const llvm::fltSemantics *LDF = &getTarget().getLongDoubleFormat(); if (LDF == &llvm::APFloat::IEEEquad) Current = Memory; else if (LDF == &llvm::APFloat::x87DoubleExtended) Current = ComplexX87; else if (LDF == &llvm::APFloat::IEEEdouble) Lo = Hi = SSE; else llvm_unreachable("unexpected long double representation!"); }
http://reviews.llvm.org/D11437 _______________________________________________ cfe-commits mailing list cfe-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits