diff options
author | Phoebe Wang <phoebe.wang@intel.com> | 2022-02-14 12:55:43 +0800 |
---|---|---|
committer | Phoebe Wang <phoebe.wang@intel.com> | 2022-02-14 13:32:29 +0800 |
commit | 3e19ba36fca9fa0b6aba0de2767f26dfd463cb5a (patch) | |
tree | 36348ff50d750c71d7cffb29b8648019b3742feb /clang/lib/Frontend/CompilerInvocation.cpp | |
parent | 15dfe03022caf38d173bd2d950711968c6c31d60 (diff) | |
download | llvm-3e19ba36fca9fa0b6aba0de2767f26dfd463cb5a.zip llvm-3e19ba36fca9fa0b6aba0de2767f26dfd463cb5a.tar.gz llvm-3e19ba36fca9fa0b6aba0de2767f26dfd463cb5a.tar.bz2 |
[X86][MS] Add 80bit long double support for Windows
MSVC currently doesn't support 80 bits long double. But ICC does support
it on Windows. Besides, there're also some users asked for this feature.
We can find the discussions from stackoverflow, msdn etc.
Given Clang has already support `-mlong-double-80`, extending it to
support for Windows seems worthwhile.
Reviewed By: rnk, erichkeane
Differential Revision: https://reviews.llvm.org/D115441
Diffstat (limited to 'clang/lib/Frontend/CompilerInvocation.cpp')
-rw-r--r-- | clang/lib/Frontend/CompilerInvocation.cpp | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/clang/lib/Frontend/CompilerInvocation.cpp b/clang/lib/Frontend/CompilerInvocation.cpp index c42cae9..1b7448f 100644 --- a/clang/lib/Frontend/CompilerInvocation.cpp +++ b/clang/lib/Frontend/CompilerInvocation.cpp @@ -3456,6 +3456,8 @@ void CompilerInvocation::GenerateLangArgs(const LangOptions &Opts, GenerateArg(Args, OPT_mlong_double_128, SA); else if (Opts.LongDoubleSize == 64) GenerateArg(Args, OPT_mlong_double_64, SA); + else if (Opts.LongDoubleSize == 80) + GenerateArg(Args, OPT_mlong_double_80, SA); // Not generating '-mrtd', it's just an alias for '-fdefault-calling-conv='. @@ -3838,9 +3840,16 @@ bool CompilerInvocation::ParseLangArgs(LangOptions &Opts, ArgList &Args, Opts.NoBuiltin = Args.hasArg(OPT_fno_builtin) || Opts.Freestanding; if (!Opts.NoBuiltin) getAllNoBuiltinFuncValues(Args, Opts.NoBuiltinFuncs); - Opts.LongDoubleSize = Args.hasArg(OPT_mlong_double_128) - ? 128 - : Args.hasArg(OPT_mlong_double_64) ? 64 : 0; + if (Arg *A = Args.getLastArg(options::OPT_LongDouble_Group)) { + if (A->getOption().matches(options::OPT_mlong_double_64)) + Opts.LongDoubleSize = 64; + else if (A->getOption().matches(options::OPT_mlong_double_80)) + Opts.LongDoubleSize = 80; + else if (A->getOption().matches(options::OPT_mlong_double_128)) + Opts.LongDoubleSize = 128; + else + Opts.LongDoubleSize = 0; + } if (Opts.FastRelaxedMath) Opts.setDefaultFPContractMode(LangOptions::FPM_Fast); llvm::sort(Opts.ModuleFeatures); |