Author: rsingh Date: Wed Jun 24 18:39:25 2015 New Revision: 240607 URL: http://llvm.org/viewvc/llvm-project?rev=240607&view=rev Log: [ARM] The bits set in the variable HW_FP could get unset when iterating through the Features vector if we don't keep track of what's already been set. This could lead to the macro __ARM_FP getting the wrong value. This patch fixes this issue by keeping track of the bits that have already been set in the loop.
Differential Revision: http://reviews.llvm.org/D10395 Modified: cfe/trunk/lib/Basic/Targets.cpp Modified: cfe/trunk/lib/Basic/Targets.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/Targets.cpp?rev=240607&r1=240606&r2=240607&view=diff ============================================================================== --- cfe/trunk/lib/Basic/Targets.cpp (original) +++ cfe/trunk/lib/Basic/Targets.cpp Wed Jun 24 18:39:25 2015 @@ -4246,6 +4246,9 @@ public: 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; @@ -4253,19 +4256,19 @@ public: 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") { @@ -4275,9 +4278,10 @@ public: } 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"; _______________________________________________ cfe-commits mailing list cfe-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits