From: Artyom Skrobov Date: Thu, 21 Nov 2013 14:04:38 +0000 (+0000) Subject: [ARM] add basic support for Cortex-A7 and VFPv4 to Clang X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=ddc8047cd52693fbce6769ff5fbc77f16ae0f215;p=clang [ARM] add basic support for Cortex-A7 and VFPv4 to Clang git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@195359 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Driver/Tools.cpp b/lib/Driver/Tools.cpp index 1d86e3f6d6..d6a50168a8 100644 --- a/lib/Driver/Tools.cpp +++ b/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/test/Driver/arm-mfpu.c b/test/Driver/arm-mfpu.c index 765b298215..7e61195080 100644 --- a/test/Driver/arm-mfpu.c +++ b/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/test/Preprocessor/arm-target-features.c b/test/Preprocessor/arm-target-features.c index ae93a3da7c..80e59de9a3 100644 --- a/test/Preprocessor/arm-target-features.c +++ b/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__