Index: lib/Basic/Targets.cpp =================================================================== --- lib/Basic/Targets.cpp +++ lib/Basic/Targets.cpp @@ -4239,6 +4239,9 @@ SoftFloat = SoftFloatABI = false; HWDiv = 0; + // This does not diagnose illegal cases like having both + // "+vfpv2" and "+vfpv3" or having "+neon" and "+fp-only-sp". + uint32_t HW_FP_remove = 0; for (const auto &Feature : Features) { if (Feature == "+soft-float") { SoftFloat = true; @@ -4246,19 +4249,19 @@ SoftFloatABI = true; } else if (Feature == "+vfp2") { FPU |= VFP2FPU; - HW_FP = HW_FP_SP | HW_FP_DP; + HW_FP |= HW_FP_SP | HW_FP_DP; } else if (Feature == "+vfp3") { FPU |= VFP3FPU; - HW_FP = HW_FP_SP | HW_FP_DP; + HW_FP |= HW_FP_SP | HW_FP_DP; } else if (Feature == "+vfp4") { FPU |= VFP4FPU; - HW_FP = HW_FP_SP | HW_FP_DP | HW_FP_HP; + HW_FP |= HW_FP_SP | HW_FP_DP | HW_FP_HP; } else if (Feature == "+fp-armv8") { FPU |= FPARMV8; - HW_FP = HW_FP_SP | HW_FP_DP | HW_FP_HP; + HW_FP |= HW_FP_SP | HW_FP_DP | HW_FP_HP; } else if (Feature == "+neon") { FPU |= NeonFPU; - HW_FP = HW_FP_SP | HW_FP_DP; + HW_FP |= HW_FP_SP | HW_FP_DP; } else if (Feature == "+hwdiv") { HWDiv |= HWDivThumb; } else if (Feature == "+hwdiv-arm") { @@ -4268,9 +4271,10 @@ } else if (Feature == "+crypto") { Crypto = 1; } else if (Feature == "+fp-only-sp") { - HW_FP &= ~HW_FP_DP; + HW_FP_remove |= HW_FP_DP | HW_FP_HP; } } + HW_FP &= ~HW_FP_remove; if (!(FPU & NeonFPU) && FPMath == FP_Neon) { Diags.Report(diag::err_target_unsupported_fpmath) << "neon";