forked from OSchip/llvm-project
[ARM64/AArch64] Hook up CRC32 subtarget feature to the driver
llvm-svn: 207841
This commit is contained in:
parent
d7360900a8
commit
418c5935f8
|
@ -3399,6 +3399,7 @@ class AArch64TargetInfo : public TargetInfo {
|
||||||
};
|
};
|
||||||
|
|
||||||
unsigned FPU;
|
unsigned FPU;
|
||||||
|
unsigned CRC;
|
||||||
unsigned Crypto;
|
unsigned Crypto;
|
||||||
static const Builtin::Info BuiltinInfo[];
|
static const Builtin::Info BuiltinInfo[];
|
||||||
|
|
||||||
|
@ -3475,6 +3476,9 @@ public:
|
||||||
Builder.defineMacro("__ARM_NEON_FP", "7");
|
Builder.defineMacro("__ARM_NEON_FP", "7");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (CRC)
|
||||||
|
Builder.defineMacro("__ARM_FEATURE_CRC32");
|
||||||
|
|
||||||
if (Crypto) {
|
if (Crypto) {
|
||||||
Builder.defineMacro("__ARM_FEATURE_CRYPTO");
|
Builder.defineMacro("__ARM_FEATURE_CRYPTO");
|
||||||
}
|
}
|
||||||
|
@ -3498,10 +3502,13 @@ public:
|
||||||
bool handleTargetFeatures(std::vector<std::string> &Features,
|
bool handleTargetFeatures(std::vector<std::string> &Features,
|
||||||
DiagnosticsEngine &Diags) override {
|
DiagnosticsEngine &Diags) override {
|
||||||
FPU = FPUMode;
|
FPU = FPUMode;
|
||||||
|
CRC = 0;
|
||||||
Crypto = 0;
|
Crypto = 0;
|
||||||
for (unsigned i = 0, e = Features.size(); i != e; ++i) {
|
for (unsigned i = 0, e = Features.size(); i != e; ++i) {
|
||||||
if (Features[i] == "+neon")
|
if (Features[i] == "+neon")
|
||||||
FPU = NeonMode;
|
FPU = NeonMode;
|
||||||
|
if (Features[i] == "+crc")
|
||||||
|
CRC = 1;
|
||||||
if (Features[i] == "+crypto")
|
if (Features[i] == "+crypto")
|
||||||
Crypto = 1;
|
Crypto = 1;
|
||||||
}
|
}
|
||||||
|
@ -4492,6 +4499,7 @@ class ARM64TargetInfo : public TargetInfo {
|
||||||
};
|
};
|
||||||
|
|
||||||
unsigned FPU;
|
unsigned FPU;
|
||||||
|
unsigned CRC;
|
||||||
unsigned Crypto;
|
unsigned Crypto;
|
||||||
|
|
||||||
static const Builtin::Info BuiltinInfo[];
|
static const Builtin::Info BuiltinInfo[];
|
||||||
|
@ -4589,6 +4597,9 @@ public:
|
||||||
Builder.defineMacro("__ARM_NEON_FP", "7");
|
Builder.defineMacro("__ARM_NEON_FP", "7");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (CRC)
|
||||||
|
Builder.defineMacro("__ARM_FEATURE_CRC32");
|
||||||
|
|
||||||
if (Crypto)
|
if (Crypto)
|
||||||
Builder.defineMacro("__ARM_FEATURE_CRYPTO");
|
Builder.defineMacro("__ARM_FEATURE_CRYPTO");
|
||||||
}
|
}
|
||||||
|
@ -4608,10 +4619,13 @@ public:
|
||||||
bool handleTargetFeatures(std::vector<std::string> &Features,
|
bool handleTargetFeatures(std::vector<std::string> &Features,
|
||||||
DiagnosticsEngine &Diags) override {
|
DiagnosticsEngine &Diags) override {
|
||||||
FPU = FPUMode;
|
FPU = FPUMode;
|
||||||
|
CRC = 0;
|
||||||
Crypto = 0;
|
Crypto = 0;
|
||||||
for (unsigned i = 0, e = Features.size(); i != e; ++i) {
|
for (unsigned i = 0, e = Features.size(); i != e; ++i) {
|
||||||
if (Features[i] == "+neon")
|
if (Features[i] == "+neon")
|
||||||
FPU = NeonMode;
|
FPU = NeonMode;
|
||||||
|
if (Features[i] == "+crc")
|
||||||
|
CRC = 1;
|
||||||
if (Features[i] == "+crypto")
|
if (Features[i] == "+crypto")
|
||||||
Crypto = 1;
|
Crypto = 1;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1540,6 +1540,15 @@ static void getAArch64TargetFeatures(const Driver &D, const ArgList &Args,
|
||||||
Features.push_back("-crypto");
|
Features.push_back("-crypto");
|
||||||
Features.push_back("-neon");
|
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,
|
static void getTargetFeatures(const Driver &D, const llvm::Triple &Triple,
|
||||||
|
|
|
@ -10,6 +10,7 @@
|
||||||
// CHECK: __ARM_ARCH_PROFILE 'A'
|
// CHECK: __ARM_ARCH_PROFILE 'A'
|
||||||
// CHECK-NOT: __ARM_FEATURE_BIG_ENDIAN
|
// CHECK-NOT: __ARM_FEATURE_BIG_ENDIAN
|
||||||
// CHECK: __ARM_FEATURE_CLZ 1
|
// CHECK: __ARM_FEATURE_CLZ 1
|
||||||
|
// CHECK-NOT: __ARM_FEATURE_CRC32 1
|
||||||
// CHECK-NOT: __ARM_FEATURE_CRYPTO 1
|
// CHECK-NOT: __ARM_FEATURE_CRYPTO 1
|
||||||
// CHECK: __ARM_FEATURE_DIV 1
|
// CHECK: __ARM_FEATURE_DIV 1
|
||||||
// CHECK: __ARM_FEATURE_FMA 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
|
// 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
|
// 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
|
// 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
|
// CHECK-FASTMATH: __ARM_FP_FAST 1
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue