[PATCH] D11437: Correct x86_64 fp128 mangled name and return/varargs types
David Majnemer
david.majnemer at gmail.com
Wed Jul 22 16:45:11 PDT 2015
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
More information about the cfe-commits
mailing list