summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Support
diff options
context:
space:
mode:
authorSimon Pilgrim <llvm-dev@redking.me.uk>2018-10-20 13:16:31 +0000
committerSimon Pilgrim <llvm-dev@redking.me.uk>2018-10-20 13:16:31 +0000
commita7d1a7ce0d907885a8dadc498f338d8257940bda (patch)
tree14b320783d6e9d9e330422c05033ca433682505d /llvm/lib/Support
parent39adc6df0d0a8367653c178cbafcd3cba35c24b1 (diff)
downloadbcm5719-llvm-a7d1a7ce0d907885a8dadc498f338d8257940bda.tar.gz
bcm5719-llvm-a7d1a7ce0d907885a8dadc498f338d8257940bda.zip
Replace setFeature macro with lambda to fix MSVC "shift count negative or too big" warnings. NFCI.
llvm-svn: 344843
Diffstat (limited to 'llvm/lib/Support')
-rw-r--r--llvm/lib/Support/Host.cpp20
1 files changed, 10 insertions, 10 deletions
diff --git a/llvm/lib/Support/Host.cpp b/llvm/lib/Support/Host.cpp
index ebf03cc176f..91e98a33b37 100644
--- a/llvm/lib/Support/Host.cpp
+++ b/llvm/lib/Support/Host.cpp
@@ -884,15 +884,16 @@ static void getAvailableFeatures(unsigned ECX, unsigned EDX, unsigned MaxLeaf,
unsigned Features3 = 0;
unsigned EAX, EBX;
-#define setFeature(F) \
- do { \
- if (F < 32) \
- Features |= 1 << F; \
- else if (F < 64) \
- Features2 |= 1 << (F - 32); \
- else if (F < 96) \
- Features3 |= 1 << (F - 64); \
- } while (0)
+ auto setFeature = [&](unsigned F) {
+ if (F < 32)
+ Features |= 1 << F;
+ else if (F < 64)
+ Features2 |= 1 << (F - 32);
+ else if (F < 96)
+ Features3 |= 1 << (F - 64);
+ else
+ llvm_unreachable("Unexpected FeatureBit");
+ };
if ((EDX >> 15) & 1)
setFeature(X86::FEATURE_CMOV);
@@ -1004,7 +1005,6 @@ static void getAvailableFeatures(unsigned ECX, unsigned EDX, unsigned MaxLeaf,
*FeaturesOut = Features;
*Features2Out = Features2;
*Features3Out = Features3;
-#undef setFeature
}
StringRef sys::getHostCPUName() {
OpenPOWER on IntegriCloud