Fix a bug where -msse followed by -mno-sse would leave MMX enabled.

llvm-svn: 190496
This commit is contained in:
Craig Topper 2013-09-11 06:48:53 +00:00
parent 0ad114c446
commit c0070a4320
2 changed files with 16 additions and 2 deletions

View File

@ -2143,8 +2143,6 @@ void X86TargetInfo::setSSELevel(llvm::StringMap<bool> &Features,
case SSE2:
Features["sse2"] = true;
case SSE1:
if (!Features.count("mmx"))
setMMXLevel(Features, MMX, Enabled);
Features["sse"] = true;
case NoSSE:
break;
@ -2427,10 +2425,14 @@ bool X86TargetInfo::HandleTargetFeatures(std::vector<std::string> &Features,
// Don't tell the backend if we're turning off mmx; it will end up disabling
// SSE, which we don't want.
// Additionally, if SSE is enabled and mmx is not explicitly disabled,
// then enable MMX.
std::vector<std::string>::iterator it;
it = std::find(Features.begin(), Features.end(), "-mmx");
if (it != Features.end())
Features.erase(it);
else if (SSELevel > NoSSE)
MMX3DNowLevel = std::max(MMX3DNowLevel, MMX);
return true;
}

View File

@ -140,3 +140,15 @@
// RUN: %clang -target i386-unknown-unknown -march=atom -mpopcnt -mno-sse4.2 -x c -E -dM -o - %s | FileCheck --check-prefix=NOSSE42POPCNT %s
// NOSSE42POPCNT: #define __POPCNT__ 1
// RUN: %clang -target i386-unknown-unknown -march=atom -msse -x c -E -dM -o - %s | FileCheck --check-prefix=SSEMMX %s
// SSEMMX: #define __MMX__ 1
// RUN: %clang -target i386-unknown-unknown -march=atom -msse -mno-sse -x c -E -dM -o - %s | FileCheck --check-prefix=SSENOSSEMMX %s
// SSENOSSEMMX-NOT: #define __MMX__ 1
// RUN: %clang -target i386-unknown-unknown -march=atom -msse -mno-mmx -x c -E -dM -o - %s | FileCheck --check-prefix=SSENOMMX %s
// SSENOMMX-NOT: #define __MMX__ 1