Add predicate for AArch64 crypto instructions.

llvm-svn: 195069
This commit is contained in:
Jiangning Liu 2013-11-19 01:38:19 +00:00
parent c8b0a1ad95
commit 3311f374a8
3 changed files with 27 additions and 1 deletions

View File

@ -129,6 +129,7 @@ class Inst <string n, string p, string t, Op o> {
bit isScalarShift = 0;
bit isVCVT_N = 0;
bit isA64 = 0;
bit isCrypto = 0;
// Certain intrinsics have different names than their representative
// instructions. This field allows us to handle this correctly when we
@ -907,6 +908,7 @@ def VEXT_A64 : WInst<"vext", "dddi",
////////////////////////////////////////////////////////////////////////////////
// Crypto
let isCrypto = 1 in {
def AESE : SInst<"vaese", "ddd", "QUc">;
def AESD : SInst<"vaesd", "ddd", "QUc">;
def AESMC : SInst<"vaesmc", "dd", "QUc">;
@ -923,6 +925,7 @@ def SHA1SU0 : SInst<"vsha1su0", "dddd", "QUi">;
def SHA256H : SInst<"vsha256h", "dddd", "QUi">;
def SHA256H2 : SInst<"vsha256h2", "dddd", "QUi">;
def SHA256SU1 : SInst<"vsha256su1", "dddd", "QUi">;
}
////////////////////////////////////////////////////////////////////////////////
// Permutation

View File

@ -1,6 +1,8 @@
// REQUIRES: aarch64-registered-target
// RUN: %clang_cc1 -triple aarch64-none-linux-gnu -target-feature +neon \
// RUN: -ffp-contract=fast -S -O3 -o - %s | FileCheck %s
// RUN: -target-feature +crypto -S -O3 -o - %s | FileCheck %s
// RUN: not %clang_cc1 -triple aarch64-none-linux-gnu -target-feature +neon \
// RUN: -S -O3 -o - %s 2>&1 | FileCheck --check-prefix=CHECK-NO-CRYPTO %s
// Test new aarch64 intrinsics and types
@ -8,6 +10,7 @@
uint8x16_t test_vaeseq_u8(uint8x16_t data, uint8x16_t key) {
// CHECK: test_vaeseq_u8
// CHECK-NO-CRYPTO: warning: implicit declaration of function 'vaeseq_u8' is invalid in C99
return vaeseq_u8(data, key);
// CHECK: aese {{v[0-9]+}}.16b, {{v[0-9]+}}.16b
}

View File

@ -2560,9 +2560,29 @@ void NeonEmitter::run(raw_ostream &OS) {
if (!isA64)
continue;
// Skip crypto temporarily, and will emit them all together at the end.
bool isCrypto = R->getValueAsBit("isCrypto");
if (isCrypto)
continue;
emitIntrinsic(OS, R, EmittedMap);
}
OS << "#ifdef __ARM_FEATURE_CRYPTO\n";
for (unsigned i = 0, e = RV.size(); i != e; ++i) {
Record *R = RV[i];
// Skip crypto temporarily, and will emit them all together at the end.
bool isCrypto = R->getValueAsBit("isCrypto");
if (!isCrypto)
continue;
emitIntrinsic(OS, R, EmittedMap);
}
OS << "#endif\n\n";
OS << "#endif\n\n";
OS << "#undef __ai\n\n";