r207841 - [ARM64/AArch64] Hook up CRC32 subtarget feature to the driver
Bradley Smith
bradley.smith at arm.com
Fri May 2 08:17:52 PDT 2014
Author: brasmi01
Date: Fri May 2 10:17:51 2014
New Revision: 207841
URL: http://llvm.org/viewvc/llvm-project?rev=207841&view=rev
Log:
[ARM64/AArch64] Hook up CRC32 subtarget feature to the driver
Modified:
cfe/trunk/lib/Basic/Targets.cpp
cfe/trunk/lib/Driver/Tools.cpp
cfe/trunk/test/Preprocessor/aarch64-target-features.c
Modified: cfe/trunk/lib/Basic/Targets.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/Targets.cpp?rev=207841&r1=207840&r2=207841&view=diff
==============================================================================
--- cfe/trunk/lib/Basic/Targets.cpp (original)
+++ cfe/trunk/lib/Basic/Targets.cpp Fri May 2 10:17:51 2014
@@ -3399,6 +3399,7 @@ class AArch64TargetInfo : public TargetI
};
unsigned FPU;
+ unsigned CRC;
unsigned Crypto;
static const Builtin::Info BuiltinInfo[];
@@ -3475,6 +3476,9 @@ public:
Builder.defineMacro("__ARM_NEON_FP", "7");
}
+ if (CRC)
+ Builder.defineMacro("__ARM_FEATURE_CRC32");
+
if (Crypto) {
Builder.defineMacro("__ARM_FEATURE_CRYPTO");
}
@@ -3498,10 +3502,13 @@ public:
bool handleTargetFeatures(std::vector<std::string> &Features,
DiagnosticsEngine &Diags) override {
FPU = FPUMode;
+ CRC = 0;
Crypto = 0;
for (unsigned i = 0, e = Features.size(); i != e; ++i) {
if (Features[i] == "+neon")
FPU = NeonMode;
+ if (Features[i] == "+crc")
+ CRC = 1;
if (Features[i] == "+crypto")
Crypto = 1;
}
@@ -4492,6 +4499,7 @@ class ARM64TargetInfo : public TargetInf
};
unsigned FPU;
+ unsigned CRC;
unsigned Crypto;
static const Builtin::Info BuiltinInfo[];
@@ -4589,6 +4597,9 @@ public:
Builder.defineMacro("__ARM_NEON_FP", "7");
}
+ if (CRC)
+ Builder.defineMacro("__ARM_FEATURE_CRC32");
+
if (Crypto)
Builder.defineMacro("__ARM_FEATURE_CRYPTO");
}
@@ -4608,10 +4619,13 @@ public:
bool handleTargetFeatures(std::vector<std::string> &Features,
DiagnosticsEngine &Diags) override {
FPU = FPUMode;
+ CRC = 0;
Crypto = 0;
for (unsigned i = 0, e = Features.size(); i != e; ++i) {
if (Features[i] == "+neon")
FPU = NeonMode;
+ if (Features[i] == "+crc")
+ CRC = 1;
if (Features[i] == "+crypto")
Crypto = 1;
}
Modified: cfe/trunk/lib/Driver/Tools.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Tools.cpp?rev=207841&r1=207840&r2=207841&view=diff
==============================================================================
--- cfe/trunk/lib/Driver/Tools.cpp (original)
+++ cfe/trunk/lib/Driver/Tools.cpp Fri May 2 10:17:51 2014
@@ -1540,6 +1540,15 @@ static void getAArch64TargetFeatures(con
Features.push_back("-crypto");
Features.push_back("-neon");
}
+
+ // En/disable crc
+ if (Arg *A = Args.getLastArg(options::OPT_mcrc,
+ options::OPT_mnocrc)) {
+ if (A->getOption().matches(options::OPT_mcrc))
+ Features.push_back("+crc");
+ else
+ Features.push_back("-crc");
+ }
}
static void getTargetFeatures(const Driver &D, const llvm::Triple &Triple,
Modified: cfe/trunk/test/Preprocessor/aarch64-target-features.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Preprocessor/aarch64-target-features.c?rev=207841&r1=207840&r2=207841&view=diff
==============================================================================
--- cfe/trunk/test/Preprocessor/aarch64-target-features.c (original)
+++ cfe/trunk/test/Preprocessor/aarch64-target-features.c Fri May 2 10:17:51 2014
@@ -10,6 +10,7 @@
// CHECK: __ARM_ARCH_PROFILE 'A'
// CHECK-NOT: __ARM_FEATURE_BIG_ENDIAN
// CHECK: __ARM_FEATURE_CLZ 1
+// CHECK-NOT: __ARM_FEATURE_CRC32 1
// CHECK-NOT: __ARM_FEATURE_CRYPTO 1
// CHECK: __ARM_FEATURE_DIV 1
// CHECK: __ARM_FEATURE_FMA 1
@@ -27,6 +28,10 @@
// RUN: %clang -target aarch64-none-linux-gnu -mfpu=crypto-neon-fp-armv8 -x c -E -dM %s -o - | FileCheck --check-prefix=CHECK-CRYPTO %s
// CHECK-CRYPTO: __ARM_FEATURE_CRYPTO 1
+// RUN: %clang -target aarch64-none-linux-gnu -mcrc -x c -E -dM %s -o - | FileCheck --check-prefix=CHECK-CRC32 %s
+// RUN: %clang -target arm64-none-linux-gnu -mcrc -x c -E -dM %s -o - | FileCheck --check-prefix=CHECK-CRC32 %s
+// CHECK-CRC32: __ARM_FEATURE_CRC32 1
+
// RUN: %clang -target aarch64-none-linux-gnu -ffast-math -x c -E -dM %s -o - | FileCheck --check-prefix=CHECK-FASTMATH %s
// CHECK-FASTMATH: __ARM_FP_FAST 1
More information about the cfe-commits
mailing list