Skip to content

Commit

Permalink
[ARM][MVE] MVE-I should not be disabled by -mfpu=none
Browse files Browse the repository at this point in the history
Architecturally, it's allowed to have MVE-I without an FPU, thus
-mfpu=none should not disable MVE-I, or moves to/from FP-registers.

This patch removes `+/-fpregs` from features unconditionally added to
target feature list, depending on FPU and moves the logic to Clang
driver, where the negative form (`-fpregs`) is conditionally added to
the target features list for the cases of `-mfloat-abi=soft`, or
`-mfpu=none` without either `+mve` or `+mve.fp`. Only the negative
form is added by the driver, the positive one is derived from other
features in the backend.

Differential Revision: https://reviews.llvm.org/D71843
  • Loading branch information
momchil-velikov committed Jan 9, 2020
1 parent 032a939 commit 173b711
Show file tree
Hide file tree
Showing 12 changed files with 82 additions and 61 deletions.
43 changes: 23 additions & 20 deletions clang/lib/Driver/ToolChains/Arch/ARM.cpp
Expand Up @@ -63,12 +63,13 @@ static void getARMHWDivFeatures(const Driver &D, const Arg *A,
}

// Handle -mfpu=.
static void getARMFPUFeatures(const Driver &D, const Arg *A,
unsigned getARMFPUFeatures(const Driver &D, const Arg *A,
const ArgList &Args, StringRef FPU,
std::vector<StringRef> &Features) {
unsigned FPUID = llvm::ARM::parseFPU(FPU);
if (!llvm::ARM::getFPUFeatures(FPUID, Features))
D.Diag(clang::diag::err_drv_clang_unsupported) << A->getAsString(Args);
return FPUID;
}

// Decode ARM features from string like +[no]featureA+[no]featureB+...
Expand Down Expand Up @@ -388,18 +389,20 @@ void arm::getARMTargetFeatures(const ToolChain &TC,
checkARMCPUName(D, CPUArg, Args, CPUName, ArchName,
ExtensionFeatures, Triple);
// Honor -mfpu=. ClangAs gives preference to -Wa,-mfpu=.
unsigned FPUID = llvm::ARM::FK_INVALID;
const Arg *FPUArg = Args.getLastArg(options::OPT_mfpu_EQ);
if (WaFPU) {
if (FPUArg)
D.Diag(clang::diag::warn_drv_unused_argument)
<< FPUArg->getAsString(Args);
getARMFPUFeatures(D, WaFPU, Args, StringRef(WaFPU->getValue()).substr(6),
Features);
(void)getARMFPUFeatures(D, WaFPU, Args, StringRef(WaFPU->getValue()).substr(6),
Features);
} else if (FPUArg) {
getARMFPUFeatures(D, FPUArg, Args, FPUArg->getValue(), Features);
FPUID = getARMFPUFeatures(D, FPUArg, Args, FPUArg->getValue(), Features);
} else if (Triple.isAndroid() && getARMSubArchVersionNumber(Triple) >= 7) {
const char *AndroidFPU = "neon";
if (!llvm::ARM::getFPUFeatures(llvm::ARM::parseFPU(AndroidFPU), Features))
FPUID = llvm::ARM::parseFPU(AndroidFPU);
if (!llvm::ARM::getFPUFeatures(FPUID, Features))
D.Diag(clang::diag::err_drv_clang_unsupported)
<< std::string("-mfpu=") + AndroidFPU;
}
Expand Down Expand Up @@ -454,21 +457,21 @@ void arm::getARMTargetFeatures(const ToolChain &TC,
if (ABI == arm::FloatABI::Soft) {
llvm::ARM::getFPUFeatures(llvm::ARM::FK_NONE, Features);

// Disable all features relating to hardware FP.
// FIXME: Disabling fpregs should be enough all by itself, since all
// the other FP features are dependent on it. However
// there is currently no easy way to test this in clang, so for
// now just be explicit and disable all known dependent features
// as well.
for (std::string Feature : {
"vfp2", "vfp2sp",
"vfp3", "vfp3sp", "vfp3d16", "vfp3d16sp",
"vfp4", "vfp4sp", "vfp4d16", "vfp4d16sp",
"fp-armv8", "fp-armv8sp", "fp-armv8d16", "fp-armv8d16sp",
"fullfp16", "neon", "crypto", "dotprod", "fp16fml",
"mve", "mve.fp",
"fp64", "d32", "fpregs"})
Features.push_back(Args.MakeArgString("-" + Feature));
// Disable all features relating to hardware FP, not already disabled by the
// above call.
Features.insert(Features.end(), {"-neon", "-crypto", "-dotprod", "-fp16fml",
"-mve", "-mve.fp", "-fpregs"});
} else if (FPUID == llvm::ARM::FK_NONE) {
// -mfpu=none is *very* similar to -mfloat-abi=soft, only that it should not
// disable MVE-I.
Features.insert(Features.end(),
{"-neon", "-crypto", "-dotprod", "-fp16fml", "-mve.fp"});
// Even though we remove MVE-FP, we still need to check if it was originally
// present among the requested extensions, because it implies MVE-I, which
// should not be disabled by -mfpu-none.
if (!llvm::is_contained(Features, "+mve") &&
!llvm::is_contained(Features, "+mve.fp"))
Features.emplace_back("-fpregs");
}

// En/disable crc code generation.
Expand Down
28 changes: 14 additions & 14 deletions clang/test/CodeGen/arm-target-features.c
@@ -1,23 +1,23 @@
// REQUIRES: arm-registered-target

// RUN: %clang_cc1 -triple thumbv7-linux-gnueabihf -target-cpu cortex-a8 -emit-llvm -o - %s | FileCheck %s --check-prefix=CHECK-VFP3
// CHECK-VFP3: "target-features"="+armv7-a,+d32,+dsp,+fp64,+fpregs,+neon,+thumb-mode,+vfp2,+vfp2sp,+vfp3,+vfp3d16,+vfp3d16sp,+vfp3sp"
// CHECK-VFP3: "target-features"="+armv7-a,+d32,+dsp,+fp64,+neon,+thumb-mode,+vfp2,+vfp2sp,+vfp3,+vfp3d16,+vfp3d16sp,+vfp3sp"


// RUN: %clang_cc1 -triple thumbv7-linux-gnueabihf -target-cpu cortex-a5 -emit-llvm -o - %s | FileCheck %s --check-prefix=CHECK-VFP4
// CHECK-VFP4: "target-features"="+armv7-a,+d32,+dsp,+fp16,+fp64,+fpregs,+neon,+thumb-mode,+vfp2,+vfp2sp,+vfp3,+vfp3d16,+vfp3d16sp,+vfp3sp,+vfp4,+vfp4d16,+vfp4d16sp,+vfp4sp"
// CHECK-VFP4: "target-features"="+armv7-a,+d32,+dsp,+fp16,+fp64,+neon,+thumb-mode,+vfp2,+vfp2sp,+vfp3,+vfp3d16,+vfp3d16sp,+vfp3sp,+vfp4,+vfp4d16,+vfp4d16sp,+vfp4sp"


// RUN: %clang_cc1 -triple thumbv7-linux-gnueabihf -target-cpu cortex-a7 -emit-llvm -o - %s | FileCheck %s --check-prefix=CHECK-VFP4-DIV
// RUN: %clang_cc1 -triple thumbv7-linux-gnueabi -target-cpu cortex-a12 -emit-llvm -o - %s | FileCheck %s --check-prefix=CHECK-VFP4-DIV
// RUN: %clang_cc1 -triple thumbv7s-linux-gnueabi -target-cpu swift -emit-llvm -o - %s | FileCheck %s --check-prefix=CHECK-VFP4-DIV-2
// RUN: %clang_cc1 -triple thumbv7-linux-gnueabihf -target-cpu krait -emit-llvm -o - %s | FileCheck %s --check-prefix=CHECK-VFP4-DIV
// CHECK-VFP4-DIV: "target-features"="+armv7-a,+d32,+dsp,+fp16,+fp64,+fpregs,+hwdiv,+hwdiv-arm,+neon,+thumb-mode,+vfp2,+vfp2sp,+vfp3,+vfp3d16,+vfp3d16sp,+vfp3sp,+vfp4,+vfp4d16,+vfp4d16sp,+vfp4sp"
// CHECK-VFP4-DIV-2: "target-features"="+armv7s,+d32,+dsp,+fp16,+fp64,+fpregs,+hwdiv,+hwdiv-arm,+neon,+thumb-mode,+vfp2,+vfp2sp,+vfp3,+vfp3d16,+vfp3d16sp,+vfp3sp,+vfp4,+vfp4d16,+vfp4d16sp,+vfp4sp"
// CHECK-VFP4-DIV: "target-features"="+armv7-a,+d32,+dsp,+fp16,+fp64,+hwdiv,+hwdiv-arm,+neon,+thumb-mode,+vfp2,+vfp2sp,+vfp3,+vfp3d16,+vfp3d16sp,+vfp3sp,+vfp4,+vfp4d16,+vfp4d16sp,+vfp4sp"
// CHECK-VFP4-DIV-2: "target-features"="+armv7s,+d32,+dsp,+fp16,+fp64,+hwdiv,+hwdiv-arm,+neon,+thumb-mode,+vfp2,+vfp2sp,+vfp3,+vfp3d16,+vfp3d16sp,+vfp3sp,+vfp4,+vfp4d16,+vfp4d16sp,+vfp4sp"

// RUN: %clang_cc1 -triple armv7-linux-gnueabihf -target-cpu cortex-a15 -emit-llvm -o - %s | FileCheck %s --check-prefix=CHECK-VFP4-DIV-ARM
// RUN: %clang_cc1 -triple armv7-linux-gnueabihf -target-cpu cortex-a17 -emit-llvm -o - %s | FileCheck %s --check-prefix=CHECK-VFP4-DIV-ARM
// CHECK-VFP4-DIV-ARM: "target-features"="+armv7-a,+d32,+dsp,+fp16,+fp64,+fpregs,+hwdiv,+hwdiv-arm,+neon,+vfp2,+vfp2sp,+vfp3,+vfp3d16,+vfp3d16sp,+vfp3sp,+vfp4,+vfp4d16,+vfp4d16sp,+vfp4sp,-thumb-mode"
// CHECK-VFP4-DIV-ARM: "target-features"="+armv7-a,+d32,+dsp,+fp16,+fp64,+hwdiv,+hwdiv-arm,+neon,+vfp2,+vfp2sp,+vfp3,+vfp3d16,+vfp3d16sp,+vfp3sp,+vfp4,+vfp4d16,+vfp4d16sp,+vfp4sp,-thumb-mode"

// RUN: %clang_cc1 -triple thumbv7s-apple-ios7.0 -target-cpu cyclone -emit-llvm -o - %s | FileCheck %s --check-prefix=CHECK-BASIC-V8
// RUN: %clang_cc1 -triple thumbv8-linux-gnueabihf -target-cpu cortex-a32 -emit-llvm -o - %s | FileCheck %s --check-prefix=CHECK-BASIC-V8
Expand All @@ -26,34 +26,34 @@
// RUN: %clang_cc1 -triple thumbv8-linux-gnueabihf -target-cpu cortex-a72 -emit-llvm -o - %s | FileCheck %s --check-prefix=CHECK-BASIC-V8
// RUN: %clang_cc1 -triple thumbv8-linux-gnueabihf -target-cpu cortex-a73 -emit-llvm -o - %s | FileCheck %s --check-prefix=CHECK-BASIC-V8
// RUN: %clang_cc1 -triple thumbv8-linux-gnueabihf -target-cpu exynos-m3 -emit-llvm -o - %s | FileCheck %s --check-prefix=CHECK-BASIC-V8
// CHECK-BASIC-V8: "target-features"="+armv8-a,+crc,+crypto,+d32,+dsp,+fp-armv8,+fp-armv8d16,+fp-armv8d16sp,+fp-armv8sp,+fp16,+fp64,+fpregs,+hwdiv,+hwdiv-arm,+neon,+thumb-mode,+vfp2,+vfp2sp,+vfp3,+vfp3d16,+vfp3d16sp,+vfp3sp,+vfp4,+vfp4d16,+vfp4d16sp,+vfp4sp"
// CHECK-BASIC-V8: "target-features"="+armv8-a,+crc,+crypto,+d32,+dsp,+fp-armv8,+fp-armv8d16,+fp-armv8d16sp,+fp-armv8sp,+fp16,+fp64,+hwdiv,+hwdiv-arm,+neon,+thumb-mode,+vfp2,+vfp2sp,+vfp3,+vfp3d16,+vfp3d16sp,+vfp3sp,+vfp4,+vfp4d16,+vfp4d16sp,+vfp4sp"

// RUN: %clang_cc1 -triple thumbv8-linux-gnueabihf -target-cpu exynos-m4 -emit-llvm -o - %s | FileCheck %s --check-prefix=CHECK-BASIC-V82
// RUN: %clang_cc1 -triple thumbv8-linux-gnueabihf -target-cpu exynos-m5 -emit-llvm -o - %s | FileCheck %s --check-prefix=CHECK-BASIC-V82
// CHECK-BASIC-V82: "target-features"="+armv8.2-a,+crc,+crypto,+d32,+dotprod,+dsp,+fp-armv8,+fp-armv8d16,+fp-armv8d16sp,+fp-armv8sp,+fp16,+fp64,+fpregs,+fullfp16,+hwdiv,+hwdiv-arm,+neon,+ras,+thumb-mode,+vfp2,+vfp2sp,+vfp3,+vfp3d16,+vfp3d16sp,+vfp3sp,+vfp4,+vfp4d16,+vfp4d16sp,+vfp4sp"
// CHECK-BASIC-V82: "target-features"="+armv8.2-a,+crc,+crypto,+d32,+dotprod,+dsp,+fp-armv8,+fp-armv8d16,+fp-armv8d16sp,+fp-armv8sp,+fp16,+fp64,+fullfp16,+hwdiv,+hwdiv-arm,+neon,+ras,+thumb-mode,+vfp2,+vfp2sp,+vfp3,+vfp3d16,+vfp3d16sp,+vfp3sp,+vfp4,+vfp4d16,+vfp4d16sp,+vfp4sp"

// RUN: %clang_cc1 -triple armv8-linux-gnueabi -target-cpu cortex-a53 -emit-llvm -o - %s | FileCheck %s --check-prefix=CHECK-BASIC-V8-ARM
// CHECK-BASIC-V8-ARM: "target-features"="+armv8-a,+crc,+crypto,+d32,+dsp,+fp-armv8,+fp-armv8d16,+fp-armv8d16sp,+fp-armv8sp,+fp16,+fp64,+fpregs,+hwdiv,+hwdiv-arm,+neon,+vfp2,+vfp2sp,+vfp3,+vfp3d16,+vfp3d16sp,+vfp3sp,+vfp4,+vfp4d16,+vfp4d16sp,+vfp4sp,-thumb-mode"
// CHECK-BASIC-V8-ARM: "target-features"="+armv8-a,+crc,+crypto,+d32,+dsp,+fp-armv8,+fp-armv8d16,+fp-armv8d16sp,+fp-armv8sp,+fp16,+fp64,+hwdiv,+hwdiv-arm,+neon,+vfp2,+vfp2sp,+vfp3,+vfp3d16,+vfp3d16sp,+vfp3sp,+vfp4,+vfp4d16,+vfp4d16sp,+vfp4sp,-thumb-mode"

// RUN: %clang_cc1 -triple thumbv7-linux-gnueabi -target-cpu cortex-r5 -emit-llvm -o - %s | FileCheck %s --check-prefix=CHECK-VFP3-D16-DIV
// CHECK-VFP3-D16-DIV: "target-features"="+armv7-r,+dsp,+fp64,+fpregs,+hwdiv,+hwdiv-arm,+thumb-mode,+vfp2,+vfp2sp,+vfp3d16,+vfp3d16sp"
// CHECK-VFP3-D16-DIV: "target-features"="+armv7-r,+dsp,+fp64,+hwdiv,+hwdiv-arm,+thumb-mode,+vfp2,+vfp2sp,+vfp3d16,+vfp3d16sp"


// RUN: %clang_cc1 -triple armv7-linux-gnueabi -target-cpu cortex-r4f -emit-llvm -o - %s | FileCheck %s --check-prefix=CHECK-VFP3-D16-THUMB-DIV
// CHECK-VFP3-D16-THUMB-DIV: "target-features"="+armv7-r,+dsp,+fp64,+fpregs,+hwdiv,+vfp2,+vfp2sp,+vfp3d16,+vfp3d16sp,-thumb-mode"
// CHECK-VFP3-D16-THUMB-DIV: "target-features"="+armv7-r,+dsp,+fp64,+hwdiv,+vfp2,+vfp2sp,+vfp3d16,+vfp3d16sp,-thumb-mode"


// RUN: %clang_cc1 -triple thumbv7-linux-gnueabi -target-cpu cortex-r7 -emit-llvm -o - %s | FileCheck %s --check-prefix=CHECK-VFP3-D16-FP16-DIV
// RUN: %clang_cc1 -triple thumbv7-linux-gnueabi -target-cpu cortex-r8 -emit-llvm -o - %s | FileCheck %s --check-prefix=CHECK-VFP3-D16-FP16-DIV
// CHECK-VFP3-D16-FP16-DIV: "target-features"="+armv7-r,+dsp,+fp16,+fp64,+fpregs,+hwdiv,+hwdiv-arm,+thumb-mode,+vfp2,+vfp2sp,+vfp3d16,+vfp3d16sp"
// CHECK-VFP3-D16-FP16-DIV: "target-features"="+armv7-r,+dsp,+fp16,+fp64,+hwdiv,+hwdiv-arm,+thumb-mode,+vfp2,+vfp2sp,+vfp3d16,+vfp3d16sp"


// RUN: %clang_cc1 -triple thumbv7-linux-gnueabi -target-cpu cortex-m4 -emit-llvm -o - %s | FileCheck %s --check-prefix=CHECK-VFP4-D16-SP-THUMB-DIV
// CHECK-VFP4-D16-SP-THUMB-DIV: "target-features"="+armv7e-m,+dsp,+fp16,+fpregs,+hwdiv,+thumb-mode,+vfp2sp,+vfp3d16sp,+vfp4d16sp"
// CHECK-VFP4-D16-SP-THUMB-DIV: "target-features"="+armv7e-m,+dsp,+fp16,+hwdiv,+thumb-mode,+vfp2sp,+vfp3d16sp,+vfp4d16sp"


// RUN: %clang_cc1 -triple thumbv7-linux-gnueabi -target-cpu cortex-m7 -emit-llvm -o - %s | FileCheck %s --check-prefix=CHECK-VFP5-D16-THUMB-DIV
// CHECK-VFP5-D16-THUMB-DIV: "target-features"="+armv7e-m,+dsp,+fp-armv8d16,+fp-armv8d16sp,+fp16,+fp64,+fpregs,+hwdiv,+thumb-mode,+vfp2,+vfp2sp,+vfp3d16,+vfp3d16sp,+vfp4d16,+vfp4d16sp"
// CHECK-VFP5-D16-THUMB-DIV: "target-features"="+armv7e-m,+dsp,+fp-armv8d16,+fp-armv8d16sp,+fp16,+fp64,+hwdiv,+thumb-mode,+vfp2,+vfp2sp,+vfp3d16,+vfp3d16sp,+vfp4d16,+vfp4d16sp"


// RUN: %clang_cc1 -triple armv7-linux-gnueabi -target-cpu cortex-r4 -emit-llvm -o - %s | FileCheck %s --check-prefix=CHECK-THUMB-DIV
Expand Down Expand Up @@ -105,6 +105,6 @@
// CHECK-ARMV8M-M23-LINUX: "target-features"="+armv8-m.base,+hwdiv,+thumb-mode"

// RUN: %clang_cc1 -triple thumb-linux-gnueabi -target-cpu cortex-m33 -emit-llvm -o - %s | FileCheck %s --check-prefix=CHECK-ARMV8M-MAIN-LINUX
// CHECK-ARMV8M-MAIN-LINUX: "target-features"="+armv8-m.main,+dsp,+fp-armv8d16sp,+fp16,+fpregs,+hwdiv,+thumb-mode,+vfp2sp,+vfp3d16sp,+vfp4d16sp"
// CHECK-ARMV8M-MAIN-LINUX: "target-features"="+armv8-m.main,+dsp,+fp-armv8d16sp,+fp16,+hwdiv,+thumb-mode,+vfp2sp,+vfp3d16sp,+vfp4d16sp"

void foo() {}
54 changes: 37 additions & 17 deletions clang/test/Driver/arm-mfpu.c
Expand Up @@ -84,7 +84,7 @@
// CHECK-VFP3-D16-DAG: "-target-feature" "-vfp4d16sp"
// CHECK-VFP3-D16-DAG: "-target-feature" "-fp-armv8d16sp"
// CHECK-VFP3-D16-DAG: "-target-feature" "+fp64"
// CHECK-VFP3-D16-NOT: "-target-feature" "+d32"
// CHECK-VFP3-D16-DAG: "-target-feature" "-d32"
// CHECK-VFP3-D16-DAG: "-target-feature" "-neon"

// RUN: %clang -target arm-linux-eabi -mfpu=vfpv3-d16-fp16 %s -### -o %t.o 2>&1 \
Expand All @@ -98,7 +98,7 @@
// CHECK-VFP3-D16-FP16-DAG: "-target-feature" "-vfp4d16sp"
// CHECK-VFP3-D16-FP16-DAG: "-target-feature" "-fp-armv8d16sp"
// CHECK-VFP3-D16-FP16-DAG: "-target-feature" "+fp64"
// CHECK-VFP3-D16-FP16-NOT: "-target-feature" "+d32"
// CHECK-VFP3-D16-FP16-DAG: "-target-feature" "-d32"
// CHECK-VFP3-D16-FP16-DAG: "-target-feature" "-neon"
// CHECK-VFP3-D16-FP16-DAG: "-target-feature" "-crypto"

Expand All @@ -108,8 +108,8 @@
// RUN: | FileCheck --check-prefix=CHECK-SOFT-ABI-FP-3 %s
// CHECK-VFP3XD-NOT: "-target-feature" "+soft-float"
// CHECK-VFP3XD-DAG: "-target-feature" "+soft-float-abi"
// CHECK-VFP3XD-NOT: "-target-feature" "+fp64"
// CHECK-VFP3XD-NOT: "-target-feature" "+d32"
// CHECK-VFP3XD-DAG: "-target-feature" "-fp64"
// CHECK-VFP3XD-DAG: "-target-feature" "-d32"
// CHECK-VFP3XD-DAG: "-target-feature" "+vfp3d16sp"
// CHECK-VFP3XD-DAG: "-target-feature" "-fp16"
// CHECK-VFP3XD-DAG: "-target-feature" "-vfp4d16sp"
Expand All @@ -127,8 +127,8 @@
// CHECK-VFP3XD-FP16-DAG: "-target-feature" "+fp16"
// CHECK-VFP3XD-FP16-DAG: "-target-feature" "-vfp4d16sp"
// CHECK-VFP3XD-FP16-DAG: "-target-feature" "-fp-armv8d16sp"
// CHECK-VFP3XD-FP16-NOT: "-target-feature" "+fp64"
// CHECK-VFP3XD-FP16-NOT: "-target-feature" "+d32"
// CHECK-VFP3XD-FP16-DAG: "-target-feature" "-fp64"
// CHECK-VFP3XD-FP16-DAG: "-target-feature" "-d32"
// CHECK-VFP3XD-FP16-DAG: "-target-feature" "-neon"
// CHECK-VFP3XD-FP16-DAG: "-target-feature" "-crypto"

Expand Down Expand Up @@ -162,7 +162,7 @@
// CHECK-VFP4-D16-DAG: "-target-feature" "+vfp4d16"
// CHECK-VFP4-D16-DAG: "-target-feature" "-fp-armv8d16sp"
// CHECK-VFP4-D16-DAG: "-target-feature" "+fp64"
// CHECK-VFP4-D16-NOT: "-target-feature" "+d32"
// CHECK-VFP4-D16-DAG: "-target-feature" "-d32"
// CHECK-VFP4-D16-DAG: "-target-feature" "-neon"

// RUN: %clang -target arm-linux-eabi -mfpu=fp4-sp-d16 %s -### -o %t.o 2>&1 \
Expand All @@ -175,8 +175,8 @@
// CHECK-FP4-SP-D16-DAG: "-target-feature" "+soft-float-abi"
// CHECK-FP4-SP-D16-DAG: "-target-feature" "+vfp4d16sp"
// CHECK-FP4-SP-D16-DAG: "-target-feature" "-fp-armv8d16sp"
// CHECK-FP4-SP-D16-NOT: "-target-feature" "+fp64"
// CHECK-FP4-SP-D16-NOT: "-target-feature" "+d32"
// CHECK-FP4-SP-D16-DAG: "-target-feature" "-fp64"
// CHECK-FP4-SP-D16-DAG: "-target-feature" "-d32"
// CHECK-FP4-SP-D16-DAG: "-target-feature" "-neon"

// RUN: %clang -target arm-linux-eabi -mfpu=fp5-sp-d16 %s -### -o %t.o 2>&1 \
Expand All @@ -189,8 +189,8 @@
// CHECK-FP5-SP-D16-DAG: "-target-feature" "+soft-float-abi"
// CHECK-FP5-SP-D16-DAG: "-target-feature" "+fp-armv8d16sp"
// CHECK-FP5-SP-D16-DAG: "-target-feature" "-neon"
// CHECK-FP5-SP-D16-NOT: "-target-feature" "+fp64"
// CHECK-FP5-SP-D16-NOT: "-target-feature" "+d32"
// CHECK-FP5-SP-D16-DAG: "-target-feature" "-fp64"
// CHECK-FP5-SP-D16-DAG: "-target-feature" "-d32"
// CHECK-FP5-SP-D16-DAG: "-target-feature" "-crypto"

// RUN: %clang -target arm-linux-eabi -mfpu=fp5-dp-d16 %s -### -o %t.o 2>&1 \
Expand All @@ -203,7 +203,7 @@
// CHECK-FP5-DP-D16-DAG: "-target-feature" "+soft-float-abi"
// CHECK-FP5-DP-D16-DAG: "-target-feature" "+fp-armv8d16"
// CHECK-FP5-DP-D16-DAG: "-target-feature" "+fp64"
// CHECK-FP5-DP-D16-NOT: "-target-feature" "+d32"
// CHECK-FP5-DP-D16-DAG: "-target-feature" "-d32"
// CHECK-FP5-DP-D16-DAG: "-target-feature" "-neon"
// CHECK-FP5-DP-D16-DAG: "-target-feature" "-crypto"
// CHECK-SOFT-ABI-FP-5-DAG: "-target-feature" "+soft-float"
Expand Down Expand Up @@ -323,8 +323,8 @@
// CHECK-NO-FP-DAG: "-target-feature" "-vfp3d16sp"
// CHECK-NO-FP-DAG: "-target-feature" "-vfp4d16sp"
// CHECK-NO-FP-DAG: "-target-feature" "-fp-armv8d16sp"
// CHECK-NO-FP-NOT: "-target-feature" "+fp64"
// CHECK-NO-FP-NOT: "-target-feature" "+d32"
// CHECK-NO-FP-DAG: "-target-feature" "-fp64"
// CHECK-NO-FP-DAG: "-target-feature" "-d32"
// CHECK-NO-FP-DAG: "-target-feature" "-neon"
// CHECK-NO-FP-DAG: "-target-feature" "-crypto"

Expand Down Expand Up @@ -382,16 +382,16 @@
// CHECK-ARM7-ANDROID-FP-DEFAULT-NOT: "-target-feature" "+soft-float"
// CHECK-ARM7-ANDROID-FP-DEFAULT-DAG: "-target-feature" "+soft-float-abi"
// CHECK-ARM7-ANDROID-FP-DEFAULT-DAG: "-target-feature" "+vfp3"
// CHECK-ARM7-ANDROID-FP-DEFAULT-NOT: "-target-feature" "+vfp4"
// CHECK-ARM7-ANDROID-FP-DEFAULT-NOT: "-target-feature" "+fp-armv8"
// CHECK-ARM7-ANDROID-FP-DEFAULT-DAG: "-target-feature" "-vfp4"
// CHECK-ARM7-ANDROID-FP-DEFAULT-DAG: "-target-feature" "-fp-armv8"
// CHECK-ARM7-ANDROID-FP-DEFAULT-DAG: "-target-feature" "+neon"
// CHECK-ARM7-ANDROID-FP-DEFAULT-NOT: "-target-feature" "+crypto"

// RUN: %clang -target armv7-linux-androideabi21 %s -mfpu=vfp3-d16 -### -c 2>&1 \
// RUN: | FileCheck --check-prefix=CHECK-ARM7-ANDROID-FP-D16 %s
// CHECK-ARM7-ANDROID-FP-D16-NOT: "-target-feature" "+soft-float"
// CHECK-ARM7-ANDROID-FP-D16-DAG: "-target-feature" "+soft-float-abi"
// CHECK-ARM7-ANDROID-FP-D16-NOT: "-target-feature" "+d32"
// CHECK-ARM7-ANDROID-FP-D16-DAG: "-target-feature" "-d32"
// CHECK-ARM7-ANDROID-FP-D16-DAG: "-target-feature" "+vfp3d16"
// CHECK-ARM7-ANDROID-FP-D16-NOT: "-target-feature" "+vfp4"
// CHECK-ARM7-ANDROID-FP-D16-NOT: "-target-feature" "+fp-armv8"
Expand All @@ -403,3 +403,23 @@
// CHECK-SOFTFLOATABI-INHIBITS-MVE-NOT: "-target-feature" "+mve"
// CHECK-SOFTFLOATABI-INHIBITS-MVE-DAG: "-target-feature" "-mve"
// CHECK-SOFTFLOATABI-INHIBITS-MVE-DAG: "-target-feature" "-mve.fp"

// RUN: %clang -target arm-none-none-eabi %s -march=armv8.1-m.main+mve.fp -mfpu=none -### -c 2>&1 \
// RUN: | FileCheck --check-prefix=CHECK-MVEFP-FPUNONE %s
// CHECK-MVEFP-FPUNONE-DAG: "-target-feature" "-vfp2sp"
// CHECK-MVEFP-FPUNONE-DAG: "-target-feature" "-vfp3d16sp"
// CHECK-MVEFP-FPUNONE-DAG: "-target-feature" "-vfp4d16sp"
// CHECK-MVEFP-FPUNONE-DAG: "-target-feature" "-fp-armv8d16sp"
// CHECK-MVEFP-FPUNONE-DAG: "-target-feature" "-fp64"
// CHECK-MVEFP-FPUNONE-DAG: "-target-feature" "-d32"
// CHECK-MVEFP-FPUNONE-DAG: "-target-feature" "-neon"
// CHECK-MVEFP-FPUNONE-DAG: "-target-feature" "-crypto"
// CHECK-MVEFP-FPUNONE-DAG: "-target-feature" "-mve.fp"
// CHECK-MVEFP-FPUNONE-NOT: "-target-feature" "-fpregs"


// RUN: %clang -target arm-none-none-eabi %s -march=armv8.1-m.main+mve -mfpu=none -### -c 2>&1 \
// RUN: | FileCheck --check-prefix=CHECK-MVEI-FPUNONE %s
// CHECK-MVEI-FPUNONE-DAG: "-target-feature" "-mve.fp"
// CHECK-MVEI-FPUNONE-DAG: "-target-feature" "+mve"
// CHECK-MVEI-FPUNONE-NOT: "-target-feature" "-fpregs"
2 changes: 0 additions & 2 deletions llvm/lib/Support/ARMTargetParser.cpp
Expand Up @@ -174,8 +174,6 @@ bool ARM::getFPUFeatures(unsigned FPUKind, std::vector<StringRef> &Features) {
// under FPURestriction::None, which is the only FPURestriction in
// which they would be valid (since FPURestriction::SP doesn't
// exist).

{"+fpregs", "-fpregs", FPUVersion::VFPV2, FPURestriction::SP_D16},
{"+vfp2", "-vfp2", FPUVersion::VFPV2, FPURestriction::D16},
{"+vfp2sp", "-vfp2sp", FPUVersion::VFPV2, FPURestriction::SP_D16},
{"+vfp3", "-vfp3", FPUVersion::VFPV3, FPURestriction::None},
Expand Down

0 comments on commit 173b711

Please sign in to comment.