From: Daniel Dunbar Date: Wed, 6 May 2009 04:58:14 +0000 (+0000) Subject: Tweak x86 -mcpu defaults. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=500aec477c82660adda912c35b634006017933be;p=clang Tweak x86 -mcpu defaults. - Default to yonah on Darwin (to get SSE3). - Default to Pentium4 (32-bit) and x86-64 (64-bit) on non-Darwin. Welcome to the 21st century. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@71069 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Basic/Targets.cpp b/lib/Basic/Targets.cpp index bb568b149b..d9ae003689 100644 --- a/lib/Basic/Targets.cpp +++ b/lib/Basic/Targets.cpp @@ -565,6 +565,9 @@ void X86TargetInfo::getDefaultFeatures(const std::string &CPU, if (CPU == "core2") Features["ssse3"] = Features["sse3"] = Features["sse2"] = Features["sse"] = Features["mmx"] = true; + else if (CPU == "yonah") + Features["sse3"] = Features["sse2"] = Features["sse"] = + Features["mmx"] = true; else if (CPU == "pentium4") Features["sse2"] = Features["sse"] = Features["mmx"] = true; } diff --git a/lib/Driver/Tools.cpp b/lib/Driver/Tools.cpp index a52498dc95..ad4db49e9b 100644 --- a/lib/Driver/Tools.cpp +++ b/lib/Driver/Tools.cpp @@ -340,6 +340,11 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA, if (memcmp(getToolChain().getOS().c_str(), "darwin", 6) == 0) { if (getToolChain().getArchName() == "x86_64") CmdArgs.push_back("--mcpu=core2"); + else if (getToolChain().getArchName() == "i386") + CmdArgs.push_back("--mcpu=yonah"); + } else { + if (getToolChain().getArchName() == "x86_64") + CmdArgs.push_back("--mcpu=x86-64"); else if (getToolChain().getArchName() == "i386") CmdArgs.push_back("--mcpu=pentium4"); } diff --git a/test/Driver/clang-translation.c b/test/Driver/clang-translation.c index 6d523954c7..ca60a8d8c6 100644 --- a/test/Driver/clang-translation.c +++ b/test/Driver/clang-translation.c @@ -10,7 +10,7 @@ // RUN: grep '"-o" .*clang-translation\.c\.out\.tmp\.s' %t.log && // RUN: grep '"--asm-verbose"' %t.log && // RUN: clang -ccc-host-triple i386-apple-darwin9 -### -S %s -o %t.s 2> %t.log -// RUN: grep '"--mcpu=pentium4"' %t.log && +// RUN: grep '"--mcpu=yonah"' %t.log && // RUN: clang -ccc-host-triple x86_64-apple-darwin9 -### -S %s -o %t.s 2> %t.log // RUN: grep '"--mcpu=core2"' %t.log && // RUN: true