diff options
-rw-r--r-- | clang/lib/Driver/Tools.cpp | 13 | ||||
-rw-r--r-- | clang/test/Driver/arm-mfpu.c | 16 | ||||
-rw-r--r-- | clang/test/Preprocessor/arm-target-features.c | 25 |
3 files changed, 51 insertions, 3 deletions
diff --git a/clang/lib/Driver/Tools.cpp b/clang/lib/Driver/Tools.cpp index 1d86e3f6d60..d6a50168a8a 100644 --- a/clang/lib/Driver/Tools.cpp +++ b/clang/lib/Driver/Tools.cpp @@ -654,16 +654,23 @@ static void getARMFPUFeatures(const Driver &D, const Arg *A, Features.push_back("-vfp2"); Features.push_back("-vfp3"); Features.push_back("-neon"); + } else if (FPU == "vfp") { + Features.push_back("+vfp2"); + Features.push_back("-neon"); } else if (FPU == "vfp3-d16" || FPU == "vfpv3-d16") { Features.push_back("+vfp3"); Features.push_back("+d16"); Features.push_back("-neon"); - } else if (FPU == "vfp") { - Features.push_back("+vfp2"); - Features.push_back("-neon"); } else if (FPU == "vfp3" || FPU == "vfpv3") { Features.push_back("+vfp3"); Features.push_back("-neon"); + } else if (FPU == "vfp4-d16" || FPU == "vfpv4-d16") { + Features.push_back("+vfp4"); + Features.push_back("+d16"); + Features.push_back("-neon"); + } else if (FPU == "vfp4" || FPU == "vfpv4") { + Features.push_back("+vfp4"); + Features.push_back("-neon"); } else if (FPU == "fp-armv8") { Features.push_back("+fp-armv8"); Features.push_back("-neon"); diff --git a/clang/test/Driver/arm-mfpu.c b/clang/test/Driver/arm-mfpu.c index 765b2982156..7e61195080c 100644 --- a/clang/test/Driver/arm-mfpu.c +++ b/clang/test/Driver/arm-mfpu.c @@ -39,6 +39,22 @@ // CHECK-VFP3: "-target-feature" "+vfp3" // CHECK-VFP3: "-target-feature" "-neon" +// RUN: %clang -target arm-linux-eabi -mfpu=vfp4 %s -### -o %t.o 2>&1 \ +// RUN: | FileCheck --check-prefix=CHECK-VFP4 %s +// RUN: %clang -target arm-linux-eabi -mfpu=vfpv4 %s -### -o %t.o 2>&1 \ +// RUN: | FileCheck --check-prefix=CHECK-VFP4 %s +// CHECK-VFP4: "-target-feature" "+vfp4" +// CHECK-VFP4: "-target-feature" "-neon" + +// RUN: %clang -target arm-linux-eabi -mfpu=vfp4-d16 %s -### -o %t.o 2>&1 \ +// RUN: | FileCheck --check-prefix=CHECK-VFP4-D16 %s +// RUN: %clang -target arm-linux-eabi -mfpu=vfpv4-d16 %s -### -o %t.o 2>&1 \ +// RUN: | FileCheck --check-prefix=CHECK-VFP4-D16 %s +// CHECK-VFP4-D16: "-target-feature" "+vfp4" +// CHECK-VFP4-D16: "-target-feature" "+d16" +// CHECK-VFP4-D16: "-target-feature" "-neon" + + // RUN: %clang -target arm-linux-eabi -mfpu=neon %s -### -o %t.o 2>&1 \ // RUN: | FileCheck --check-prefix=CHECK-NEON %s // CHECK-NEON: "-target-feature" "+neon" diff --git a/clang/test/Preprocessor/arm-target-features.c b/clang/test/Preprocessor/arm-target-features.c index ae93a3da7c0..80e59de9a3e 100644 --- a/clang/test/Preprocessor/arm-target-features.c +++ b/clang/test/Preprocessor/arm-target-features.c @@ -94,6 +94,23 @@ // RUN: %clang -target arm -mthumb -mcpu=cortex-a15 -mhwdiv=none -x c -E -dM %s -o - | FileCheck --check-prefix=DEFAULTHWDIV-NONEHWDIV-THUMB %s // DEFAULTHWDIV-NONEHWDIV-THUMB-NOT:#define __ARM_ARCH_EXT_IDIV__ + +// Check that -mfpu works properly for Cortex-A7 (enabled by default). +// RUN: %clang -target armv7-none-linux-gnueabi -mcpu=cortex-a7 -x c -E -dM %s -o - | FileCheck --check-prefix=DEFAULTFPU-A7 %s +// RUN: %clang -target armv7-none-linux-gnueabi -mthumb -mcpu=cortex-a7 -x c -E -dM %s -o - | FileCheck --check-prefix=DEFAULTFPU-A7 %s +// DEFAULTFPU-A7:#define __ARM_NEON__ 1 +// DEFAULTFPU-A7:#define __ARM_VFPV4__ 1 + +// RUN: %clang -target armv7-none-linux-gnueabi -mcpu=cortex-a7 -mfpu=none -x c -E -dM %s -o - | FileCheck --check-prefix=FPUNONE-A7 %s +// RUN: %clang -target armv7-none-linux-gnueabi -mthumb -mcpu=cortex-a7 -mfpu=none -x c -E -dM %s -o - | FileCheck --check-prefix=FPUNONE-A7 %s +// FPUNONE-A7-NOT:#define __ARM_NEON__ 1 +// FPUNONE-A7-NOT:#define __ARM_VFPV4__ 1 + +// RUN: %clang -target armv7-none-linux-gnueabi -mcpu=cortex-a7 -mfpu=vfp4 -x c -E -dM %s -o - | FileCheck --check-prefix=NONEON-A7 %s +// RUN: %clang -target armv7-none-linux-gnueabi -mthumb -mcpu=cortex-a7 -mfpu=vfp4 -x c -E -dM %s -o - | FileCheck --check-prefix=NONEON-A7 %s +// NONEON-A7-NOT:#define __ARM_NEON__ 1 +// NONEON-A7:#define __ARM_VFPV4__ 1 + // FIXME: add check for further predefines // Test whether predefines are as expected when targeting cortex-a5. // RUN: %clang -target armv7 -mcpu=cortex-a5 -x c -E -dM %s -o - | FileCheck --check-prefix=A5-ARM %s @@ -102,6 +119,14 @@ // RUN: %clang -target armv7 -mthumb -mcpu=cortex-a5 -x c -E -dM %s -o - | FileCheck --check-prefix=A5-THUMB %s // A5-THUMB-NOT:#define __ARM_ARCH_EXT_IDIV__ +// Test whether predefines are as expected when targeting cortex-a7. +// RUN: %clang -target armv7 -mcpu=cortex-a7 -x c -E -dM %s -o - | FileCheck --check-prefix=A7 %s +// RUN: %clang -target armv7 -mthumb -mcpu=cortex-a7 -x c -E -dM %s -o - | FileCheck --check-prefix=A7 %s +// A7:#define __ARM_ARCH 7 +// A7:#define __ARM_ARCH_7A__ 1 +// A7:#define __ARM_ARCH_EXT_IDIV__ 1 +// A7:#define __ARM_ARCH_PROFILE A + // Test whether predefines are as expected when targeting cortex-a8. // RUN: %clang -target armv7 -mcpu=cortex-a8 -x c -E -dM %s -o - | FileCheck --check-prefix=A8-ARM %s // A8-ARM-NOT:#define __ARM_ARCH_EXT_IDIV__ |