[X86] Split multi-line chained assignments into single lines to avoid making clang-format create triangle shaped indentation. Simplify one if statement to remove a bunch of string matches. NFCI

We had an if statement that checked over every avx512* feature to see if it should enabled avx512f. Since they are all prefixed with avx512 just check for that instead.

llvm-svn: 361557
This commit is contained in:
Craig Topper 2019-05-23 21:34:36 +00:00
parent ca6a8ae0bf
commit a85c0fd918
1 changed files with 24 additions and 26 deletions

View File

@ -451,7 +451,9 @@ void X86TargetInfo::setSSELevel(llvm::StringMap<bool> &Features,
if (Enabled) { if (Enabled) {
switch (Level) { switch (Level) {
case AVX512F: case AVX512F:
Features["avx512f"] = Features["fma"] = Features["f16c"] = true; Features["avx512f"] = true;
Features["fma"] = true;
Features["f16c"] = true;
LLVM_FALLTHROUGH; LLVM_FALLTHROUGH;
case AVX2: case AVX2:
Features["avx2"] = true; Features["avx2"] = true;
@ -490,8 +492,8 @@ void X86TargetInfo::setSSELevel(llvm::StringMap<bool> &Features,
Features["sse"] = false; Features["sse"] = false;
LLVM_FALLTHROUGH; LLVM_FALLTHROUGH;
case SSE2: case SSE2:
Features["sse2"] = Features["pclmul"] = Features["aes"] = Features["sha"] = Features["sse2"] = Features["pclmul"] = Features["aes"] = false;
Features["gfni"] = false; Features["sha"] = Features["gfni"] = false;
LLVM_FALLTHROUGH; LLVM_FALLTHROUGH;
case SSE3: case SSE3:
Features["sse3"] = false; Features["sse3"] = false;
@ -507,21 +509,21 @@ void X86TargetInfo::setSSELevel(llvm::StringMap<bool> &Features,
Features["sse4.2"] = false; Features["sse4.2"] = false;
LLVM_FALLTHROUGH; LLVM_FALLTHROUGH;
case AVX: case AVX:
Features["fma"] = Features["avx"] = Features["f16c"] = Features["xsave"] = Features["fma"] = Features["avx"] = Features["f16c"] = false;
Features["xsaveopt"] = Features["vaes"] = Features["vpclmulqdq"] = false; Features["xsave"] = Features["xsaveopt"] = Features["vaes"] = false;
Features["vpclmulqdq"] = false;
setXOPLevel(Features, FMA4, false); setXOPLevel(Features, FMA4, false);
LLVM_FALLTHROUGH; LLVM_FALLTHROUGH;
case AVX2: case AVX2:
Features["avx2"] = false; Features["avx2"] = false;
LLVM_FALLTHROUGH; LLVM_FALLTHROUGH;
case AVX512F: case AVX512F:
Features["avx512f"] = Features["avx512cd"] = Features["avx512er"] = Features["avx512f"] = Features["avx512cd"] = Features["avx512er"] = false;
Features["avx512pf"] = Features["avx512dq"] = Features["avx512bw"] = Features["avx512pf"] = Features["avx512dq"] = Features["avx512bw"] = false;
Features["avx512vl"] = Features["avx512vbmi"] = Features["avx512vl"] = Features["avx512vbmi"] = false;
Features["avx512ifma"] = Features["avx512vpopcntdq"] = Features["avx512ifma"] = Features["avx512vpopcntdq"] = false;
Features["avx512bitalg"] = Features["avx512vnni"] = Features["avx512bitalg"] = Features["avx512vnni"] = false;
Features["avx512vbmi2"] = false; Features["avx512vbmi2"] = Features["avx512bf16"] = false;
Features["avx512bf16"] = false;
break; break;
} }
} }
@ -649,24 +651,20 @@ void X86TargetInfo::setFeatureEnabledImpl(llvm::StringMap<bool> &Features,
setSSELevel(Features, AVX2, Enabled); setSSELevel(Features, AVX2, Enabled);
} else if (Name == "avx512f") { } else if (Name == "avx512f") {
setSSELevel(Features, AVX512F, Enabled); setSSELevel(Features, AVX512F, Enabled);
} else if (Name == "avx512cd" || Name == "avx512er" || Name == "avx512pf" || } else if (Name.startswith("avx512")) {
Name == "avx512dq" || Name == "avx512bw" || Name == "avx512vl" ||
Name == "avx512vbmi" || Name == "avx512ifma" ||
Name == "avx512vpopcntdq" || Name == "avx512bitalg" ||
Name == "avx512bf16" ||
Name == "avx512vnni" || Name == "avx512vbmi2") {
if (Enabled) if (Enabled)
setSSELevel(Features, AVX512F, Enabled); setSSELevel(Features, AVX512F, Enabled);
// Enable BWI instruction if VBMI/VBMI2/BITALG is being enabled. // Enable BWI instruction if certain features are being enabled.
if ((Name.startswith("avx512vbmi") || Name == "avx512bitalg") && Enabled) if ((Name == "avx512vbmi" || Name == "avx512vbmi2" ||
Name == "avx512bitalg" || Name == "avx512bf16") && Enabled)
Features["avx512bw"] = true; Features["avx512bw"] = true;
if (Name == "avx512bf16" && Enabled) // Also disable some features if BWI is being disabled.
Features["avx512bw"] = true; if (Name == "avx512bw" && !Enabled) {
// Also disable VBMI/VBMI2/BITALG if BWI is being disabled. Features["avx512vbmi"] = false;
if (Name == "avx512bw" && !Enabled) Features["avx512vbmi2"] = false;
Features["avx512vbmi"] = Features["avx512vbmi2"] =
Features["avx512bf16"] =
Features["avx512bitalg"] = false; Features["avx512bitalg"] = false;
Features["avx512bf16"] = false;
}
} else if (Name == "fma") { } else if (Name == "fma") {
if (Enabled) if (Enabled)
setSSELevel(Features, AVX, Enabled); setSSELevel(Features, AVX, Enabled);