mirror of
https://github.com/capstone-engine/llvm-capstone.git
synced 2024-12-12 09:41:26 +00:00
[ARM] ACLE FP16 feature test macros
This is a partial recommit of r327189 that was reverted due to test issues. I.e., this recommits minimal functional change, the FP16 feature test macros, and adds tests that were missing in the original commit. llvm-svn: 327455
This commit is contained in:
parent
cc060e921b
commit
a7463df6e2
@ -379,6 +379,7 @@ bool ARMTargetInfo::handleTargetFeatures(std::vector<std::string> &Features,
|
||||
Unaligned = 1;
|
||||
SoftFloat = SoftFloatABI = false;
|
||||
HWDiv = 0;
|
||||
HasFullFP16 = 0;
|
||||
|
||||
// This does not diagnose illegal cases like having both
|
||||
// "+vfpv2" and "+vfpv3" or having "+neon" and "+fp-only-sp".
|
||||
@ -419,6 +420,8 @@ bool ARMTargetInfo::handleTargetFeatures(std::vector<std::string> &Features,
|
||||
Unaligned = 0;
|
||||
} else if (Feature == "+fp16") {
|
||||
HW_FP |= HW_FP_HP;
|
||||
} else if (Feature == "+fullfp16") {
|
||||
HasFullFP16 = 1;
|
||||
}
|
||||
}
|
||||
HW_FP &= ~HW_FP_remove;
|
||||
@ -710,6 +713,15 @@ void ARMTargetInfo::getTargetDefines(const LangOptions &Opts,
|
||||
if (Opts.UnsafeFPMath)
|
||||
Builder.defineMacro("__ARM_FP_FAST", "1");
|
||||
|
||||
// Armv8.2-A FP16 vector intrinsic
|
||||
if ((FPU & NeonFPU) && HasFullFP16)
|
||||
Builder.defineMacro("__ARM_FEATURE_FP16_VECTOR_ARITHMETIC", "1");
|
||||
|
||||
// Armv8.2-A FP16 scalar intrinsics
|
||||
if (HasFullFP16)
|
||||
Builder.defineMacro("__ARM_FEATURE_FP16_SCALAR_ARITHMETIC", "1");
|
||||
|
||||
|
||||
switch (ArchKind) {
|
||||
default:
|
||||
break;
|
||||
|
@ -69,6 +69,7 @@ class LLVM_LIBRARY_VISIBILITY ARMTargetInfo : public TargetInfo {
|
||||
unsigned Crypto : 1;
|
||||
unsigned DSP : 1;
|
||||
unsigned Unaligned : 1;
|
||||
unsigned HasFullFP16 : 1;
|
||||
|
||||
enum {
|
||||
LDREX_B = (1 << 0), /// byte (8-bit)
|
||||
|
@ -19,6 +19,18 @@
|
||||
// CHECK-V8A-ALLOW-FP-INSTR: #define __ARM_FP16_ARGS 1
|
||||
// CHECK-V8A-ALLOW-FP-INSTR: #define __ARM_FP16_FORMAT_IEEE 1
|
||||
|
||||
// RUN: %clang -target arm-none-linux-gnueabi -march=armv8.2a+fp16 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=CHECK-FULLFP16-VECTOR-SCALAR %s
|
||||
// CHECK-FULLFP16-VECTOR-SCALAR: #define __ARM_FEATURE_FP16_SCALAR_ARITHMETIC 1
|
||||
// CHECK-FULLFP16-VECTOR-SCALAR: #define __ARM_FEATURE_FP16_VECTOR_ARITHMETIC 1
|
||||
// CHECK-FULLFP16-VECTOR-SCALAR: #define __ARM_FP 0xe
|
||||
// CHECK-FULLFP16-VECTOR-SCALAR: #define __ARM_FP16_FORMAT_IEEE 1
|
||||
|
||||
// RUN: %clang -target arm-none-linux-gnueabi -march=armv8.2a+fp16 -mfpu=vfp4 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=CHECK-FULLFP16-SCALAR %s
|
||||
// CHECK-FULLFP16-SCALAR: #define __ARM_FEATURE_FP16_SCALAR_ARITHMETIC 1
|
||||
// CHECK-FULLFP16-SCALAR-NOT: #define __ARM_FEATURE_FP16_VECTOR_ARITHMETIC 1
|
||||
// CHECK-FULLFP16-SCALAR: #define __ARM_FP 0xe
|
||||
// CHECK-FULLFP16-SCALAR: #define __ARM_FP16_FORMAT_IEEE 1
|
||||
|
||||
// RUN: %clang -target armv8r-none-linux-gnu -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=CHECK-V8R %s
|
||||
// CHECK-V8R: #define __ARMEL__ 1
|
||||
// CHECK-V8R: #define __ARM_ARCH 8
|
||||
|
Loading…
Reference in New Issue
Block a user