r193367 - Add driver support for FP, SIMD and crypto defaults.
Bernard Ogden
bogden at arm.com
Thu Oct 24 11:32:51 PDT 2013
Author: bogden
Date: Thu Oct 24 13:32:51 2013
New Revision: 193367
URL: http://llvm.org/viewvc/llvm-project?rev=193367&view=rev
Log:
Add driver support for FP, SIMD and crypto defaults.
Although we wire up a bit for v8fp for macro setting
purposes, we don't set a macro yet. Need to ask list
about that.
Change-Id: Ic9819593ce00882fbec72757ffccc6f0b18160a0
Modified:
cfe/trunk/lib/Basic/Targets.cpp
cfe/trunk/lib/Driver/Tools.cpp
cfe/trunk/test/Driver/arm-mfpu.c
cfe/trunk/test/Preprocessor/arm-target-features.c
Modified: cfe/trunk/lib/Basic/Targets.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/Targets.cpp?rev=193367&r1=193366&r2=193367&view=diff
==============================================================================
--- cfe/trunk/lib/Basic/Targets.cpp (original)
+++ cfe/trunk/lib/Basic/Targets.cpp Thu Oct 24 13:32:51 2013
@@ -3598,7 +3598,8 @@ class ARMTargetInfo : public TargetInfo
VFP2FPU = (1 << 0),
VFP3FPU = (1 << 1),
VFP4FPU = (1 << 2),
- NeonFPU = (1 << 3)
+ NeonFPU = (1 << 3),
+ FPARMV8 = (1 << 4)
};
// Possible HWDiv features.
@@ -3608,7 +3609,7 @@ class ARMTargetInfo : public TargetInfo
};
static bool FPUModeIsVFP(FPUMode Mode) {
- return Mode & (VFP2FPU | VFP3FPU | VFP4FPU | NeonFPU);
+ return Mode & (VFP2FPU | VFP3FPU | VFP4FPU | NeonFPU | FPARMV8);
}
static const TargetInfo::GCCRegAlias GCCRegAliases[];
@@ -3622,7 +3623,7 @@ class ARMTargetInfo : public TargetInfo
FP_Neon
} FPMath;
- unsigned FPU : 4;
+ unsigned FPU : 5;
unsigned IsAAPCS : 1;
unsigned IsThumb : 1;
@@ -3778,8 +3779,12 @@ public:
Features["neon"] = true;
Features["hwdiv"] = true;
Features["hwdiv-arm"] = true;
- } else if (CPU == "cortex-r5" || CPU == "cortex-a53"||
- CPU == "cortex-a57" || CPU == "cortex-m3" ||
+ } else if (CPU == "cortex-a53" || CPU == "cortex-a57") {
+ Features["fp-armv8"] = true;
+ Features["neon"] = true;
+ Features["hwdiv"] = true;
+ Features["hwdiv-arm"] = true;
+ } else if (CPU == "cortex-r5" || CPU == "cortex-m3" ||
CPU == "cortex-m4" ||
// Enable the hwdiv extension for all v8a AArch32 cores by
// default.
@@ -3806,6 +3811,8 @@ public:
FPU |= VFP3FPU;
else if (Features[i] == "+vfp4")
FPU |= VFP4FPU;
+ else if (Features[i] == "+fp-armv8")
+ FPU |= FPARMV8;
else if (Features[i] == "+neon")
FPU |= NeonFPU;
else if (Features[i] == "+hwdiv")
@@ -3960,7 +3967,7 @@ public:
// the VFP define, hence the soft float and arch check. This is subtly
// different from gcc, we follow the intent which was that it should be set
// when Neon instructions are actually available.
- if ((FPU & NeonFPU) && !SoftFloat && CPUArchVer == 7)
+ if ((FPU & NeonFPU) && !SoftFloat && CPUArchVer >= 7)
Builder.defineMacro("__ARM_NEON__");
if (CPUArchVer == 8)
Modified: cfe/trunk/lib/Driver/Tools.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Tools.cpp?rev=193367&r1=193366&r2=193367&view=diff
==============================================================================
--- cfe/trunk/lib/Driver/Tools.cpp (original)
+++ cfe/trunk/lib/Driver/Tools.cpp Thu Oct 24 13:32:51 2013
@@ -645,12 +645,16 @@ static void getARMFPUFeatures(const Driv
Features.push_back("-neon");
} else if (FPU == "fp-armv8") {
Features.push_back("+fp-armv8");
+ Features.push_back("-neon");
+ Features.push_back("-crypto");
} else if (FPU == "neon-fp-armv8") {
Features.push_back("+fp-armv8");
Features.push_back("+neon");
+ Features.push_back("-crypto");
} else if (FPU == "crypto-neon-fp-armv8") {
- Features.push_back("+crypto");
Features.push_back("+fp-armv8");
+ Features.push_back("+neon");
+ Features.push_back("+crypto");
} else if (FPU == "neon") {
Features.push_back("+neon");
} else if (FPU == "none") {
Modified: cfe/trunk/test/Driver/arm-mfpu.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/arm-mfpu.c?rev=193367&r1=193366&r2=193367&view=diff
==============================================================================
--- cfe/trunk/test/Driver/arm-mfpu.c (original)
+++ cfe/trunk/test/Driver/arm-mfpu.c Thu Oct 24 13:32:51 2013
@@ -47,19 +47,29 @@
// RUN: | FileCheck --check-prefix=CHECK-SOFT-FLOAT %s
// CHECK-SOFT-FLOAT: "-target-feature" "-neon"
+// RUN: %clang -target armv8 -mfpu=fp-armv8 %s -### 2>&1 \
+// RUN: | FileCheck --check-prefix=CHECK-ARMV8-SOFT-FLOAT %s
+// CHECK-ARMV8-SOFT-FLOAT: "-target-feature" "+fp-armv8"
+// CHECK-ARMV8-SOFT-FLOAT: "-target-feature" "-crypto"
+// CHECK-ARMV8-SOFT-FLOAT: "-target-feature" "-neon"
+
// RUN: %clang -target armv8-linux-gnueabihf -mfpu=fp-armv8 %s -### 2>&1 \
// RUN: | FileCheck --check-prefix=CHECK-FP-ARMV8 %s
// CHECK-FP-ARMV8: "-target-feature" "+fp-armv8"
+// CHECK-FP-ARMV8: "-target-feature" "-neon"
+// CHECK-FP-ARMV8: "-target-feature" "-crypto"
// RUN: %clang -target armv8-linux-gnueabihf -mfpu=neon-fp-armv8 %s -### 2>&1 \
// RUN: | FileCheck --check-prefix=CHECK-NEON-FP-ARMV8 %s
// CHECK-NEON-FP-ARMV8: "-target-feature" "+fp-armv8"
// CHECK-NEON-FP-ARMV8: "-target-feature" "+neon"
+// CHECK-NEON-FP-ARMV8: "-target-feature" "-crypto"
// RUN: %clang -target armv8-linux-gnueabihf -mfpu=crypto-neon-fp-armv8 %s -### 2>&1 \
// RUN: | FileCheck --check-prefix=CHECK-CRYPTO-NEON-FP-ARMV8 %s
-// CHECK-CRYPTO-NEON-FP-ARMV8: "-target-feature" "+crypto"
// CHECK-CRYPTO-NEON-FP-ARMV8: "-target-feature" "+fp-armv8"
+// CHECK-CRYPTO-NEON-FP-ARMV8: "-target-feature" "+neon"
+// CHECK-CRYPTO-NEON-FP-ARMV8: "-target-feature" "+crypto"
// RUN: %clang -target armv8-linux-gnueabi -mfpu=none %s -### 2>&1 \
// RUN: | FileCheck --check-prefix=CHECK-NO-FP %s
Modified: cfe/trunk/test/Preprocessor/arm-target-features.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Preprocessor/arm-target-features.c?rev=193367&r1=193366&r2=193367&view=diff
==============================================================================
--- cfe/trunk/test/Preprocessor/arm-target-features.c (original)
+++ cfe/trunk/test/Preprocessor/arm-target-features.c Thu Oct 24 13:32:51 2013
@@ -10,6 +10,23 @@
// CHECK-V7: __ARM_ARCH_7A__ 1
// CHECK-NOT-V7: __ARM_FEATURE_CRC32
+// RUN: %clang -target armv8a -mfloat-abi=hard -x c -E -dM %s | FileCheck --check-prefix=CHECK-V8-BAREHF %s
+// CHECK-V8-BAREHF: __ARMEL__ 1
+// CHECK-V8-BAREHF: __ARM_ARCH 8
+// CHECK-V8-BAREHF: __ARM_ARCH_8A__ 1
+// CHECK-V8-BAREHF: __ARM_FEATURE_CRC32 1
+// CHECK-V8-BAREHF: __ARM_NEON__ 1
+// CHECK-V8-BAREHF: __VFP_FP__ 1
+
+// RUN: %clang -target armv8a -mfloat-abi=hard -mfpu=fp-armv8 -x c -E -dM %s | FileCheck --check-prefix=CHECK-V8-BAREHF-FP %s
+// CHECK-V8-BAREHF-FP-NOT: __ARM_NEON__ 1
+// CHECK-V8-BAREHF-FP: __VFP_FP__ 1
+
+// RUN: %clang -target armv8a -mfloat-abi=hard -mfpu=neon-fp-armv8 -x c -E -dM %s | FileCheck --check-prefix=CHECK-V8-BAREHF-NEON-FP %s
+// RUN: %clang -target armv8a -mfloat-abi=hard -mfpu=crypto-neon-fp-armv8 -x c -E -dM %s | FileCheck --check-prefix=CHECK-V8-BAREHF-NEON-FP %s
+// CHECK-V8-BAREHF-NEON-FP: __ARM_NEON__ 1
+// CHECK-V8-BAREHF-NEON-FP: __VFP_FP__ 1
+
// Check that -mhwdiv works properly for armv8/thumbv8 (enabled by default).
// RUN: %clang -target armv8 -x c -E -dM %s -o - | FileCheck --check-prefix=ARMV8 %s
More information about the cfe-commits
mailing list