Index: lib/Basic/Targets.cpp =================================================================== --- lib/Basic/Targets.cpp +++ lib/Basic/Targets.cpp @@ -6186,9 +6186,8 @@ unsigned CRC; unsigned Crypto; unsigned Unaligned; - unsigned V8_1A; - unsigned V8_2A; unsigned HasFullFP16; + unsigned ArchKind; static const Builtin::Info BuiltinInfo[]; @@ -6254,6 +6253,18 @@ static_cast(llvm::AArch64::ArchKind::AK_INVALID); } + bool hasFP16VectorArithmetic() const { + if (FPU != NeonMode || !HasFullFP16) + return false; + + switch(ArchKind) { + default: + return false; + case llvm::ARM::AK_ARMV8_2A: + return true; + } + } + void getTargetDefines(const LangOptions &Opts, MacroBuilder &Builder) const override { // Target identification. @@ -6318,9 +6329,10 @@ if (Unaligned) Builder.defineMacro("__ARM_FEATURE_UNALIGNED", "1"); - if (V8_1A) + if (ArchKind == llvm::ARM::AK_ARMV8_1A) Builder.defineMacro("__ARM_FEATURE_QRDMX", "1"); - if (V8_2A && FPU == NeonMode && HasFullFP16) + + if (hasFP16VectorArithmetic()) Builder.defineMacro("__ARM_FEATURE_FP16_VECTOR_ARITHMETIC", "1"); // All of the __sync_(bool|val)_compare_and_swap_(1|2|4|8) builtins work. @@ -6348,9 +6360,8 @@ CRC = 0; Crypto = 0; Unaligned = 1; - V8_1A = 0; - V8_2A = 0; HasFullFP16 = 0; + ArchKind = llvm::ARM::AK_INVALID; for (const auto &Feature : Features) { if (Feature == "+neon") @@ -6362,9 +6373,9 @@ if (Feature == "+strict-align") Unaligned = 0; if (Feature == "+v8.1a") - V8_1A = 1; + ArchKind = llvm::ARM::AK_ARMV8_1A; if (Feature == "+v8.2a") - V8_2A = 1; + ArchKind = llvm::ARM::AK_ARMV8_2A; if (Feature == "+fullfp16") HasFullFP16 = 1; }