From: Craig Topper Date: Thu, 23 May 2019 21:34:36 +0000 (+0000) Subject: [X86] Split multi-line chained assignments into single lines to avoid making clang... X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=2cee20d7778a10ab46f8c2a795023e8696030425;p=clang [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. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@361557 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Basic/Targets/X86.cpp b/lib/Basic/Targets/X86.cpp index 44f5fbf5a7..7bef7ce9c6 100644 --- a/lib/Basic/Targets/X86.cpp +++ b/lib/Basic/Targets/X86.cpp @@ -451,7 +451,9 @@ void X86TargetInfo::setSSELevel(llvm::StringMap &Features, if (Enabled) { switch (Level) { case AVX512F: - Features["avx512f"] = Features["fma"] = Features["f16c"] = true; + Features["avx512f"] = true; + Features["fma"] = true; + Features["f16c"] = true; LLVM_FALLTHROUGH; case AVX2: Features["avx2"] = true; @@ -490,8 +492,8 @@ void X86TargetInfo::setSSELevel(llvm::StringMap &Features, Features["sse"] = false; LLVM_FALLTHROUGH; case SSE2: - Features["sse2"] = Features["pclmul"] = Features["aes"] = Features["sha"] = - Features["gfni"] = false; + Features["sse2"] = Features["pclmul"] = Features["aes"] = false; + Features["sha"] = Features["gfni"] = false; LLVM_FALLTHROUGH; case SSE3: Features["sse3"] = false; @@ -507,21 +509,21 @@ void X86TargetInfo::setSSELevel(llvm::StringMap &Features, Features["sse4.2"] = false; LLVM_FALLTHROUGH; case AVX: - Features["fma"] = Features["avx"] = Features["f16c"] = Features["xsave"] = - Features["xsaveopt"] = Features["vaes"] = Features["vpclmulqdq"] = false; + Features["fma"] = Features["avx"] = Features["f16c"] = false; + Features["xsave"] = Features["xsaveopt"] = Features["vaes"] = false; + Features["vpclmulqdq"] = false; setXOPLevel(Features, FMA4, false); LLVM_FALLTHROUGH; case AVX2: Features["avx2"] = false; LLVM_FALLTHROUGH; case AVX512F: - Features["avx512f"] = Features["avx512cd"] = Features["avx512er"] = - Features["avx512pf"] = Features["avx512dq"] = Features["avx512bw"] = - Features["avx512vl"] = Features["avx512vbmi"] = - Features["avx512ifma"] = Features["avx512vpopcntdq"] = - Features["avx512bitalg"] = Features["avx512vnni"] = - Features["avx512vbmi2"] = false; - Features["avx512bf16"] = false; + Features["avx512f"] = Features["avx512cd"] = Features["avx512er"] = false; + Features["avx512pf"] = Features["avx512dq"] = Features["avx512bw"] = false; + Features["avx512vl"] = Features["avx512vbmi"] = false; + Features["avx512ifma"] = Features["avx512vpopcntdq"] = false; + Features["avx512bitalg"] = Features["avx512vnni"] = false; + Features["avx512vbmi2"] = Features["avx512bf16"] = false; break; } } @@ -649,24 +651,20 @@ void X86TargetInfo::setFeatureEnabledImpl(llvm::StringMap &Features, setSSELevel(Features, AVX2, Enabled); } else if (Name == "avx512f") { setSSELevel(Features, AVX512F, Enabled); - } else if (Name == "avx512cd" || Name == "avx512er" || Name == "avx512pf" || - Name == "avx512dq" || Name == "avx512bw" || Name == "avx512vl" || - Name == "avx512vbmi" || Name == "avx512ifma" || - Name == "avx512vpopcntdq" || Name == "avx512bitalg" || - Name == "avx512bf16" || - Name == "avx512vnni" || Name == "avx512vbmi2") { + } else if (Name.startswith("avx512")) { if (Enabled) setSSELevel(Features, AVX512F, Enabled); - // Enable BWI instruction if VBMI/VBMI2/BITALG is being enabled. - if ((Name.startswith("avx512vbmi") || Name == "avx512bitalg") && Enabled) + // Enable BWI instruction if certain features are being enabled. + if ((Name == "avx512vbmi" || Name == "avx512vbmi2" || + Name == "avx512bitalg" || Name == "avx512bf16") && Enabled) Features["avx512bw"] = true; - if (Name == "avx512bf16" && Enabled) - Features["avx512bw"] = true; - // Also disable VBMI/VBMI2/BITALG if BWI is being disabled. - if (Name == "avx512bw" && !Enabled) - Features["avx512vbmi"] = Features["avx512vbmi2"] = - Features["avx512bf16"] = + // Also disable some features if BWI is being disabled. + if (Name == "avx512bw" && !Enabled) { + Features["avx512vbmi"] = false; + Features["avx512vbmi2"] = false; Features["avx512bitalg"] = false; + Features["avx512bf16"] = false; + } } else if (Name == "fma") { if (Enabled) setSSELevel(Features, AVX, Enabled);