diff options
-rw-r--r-- | clang/include/clang/Basic/arm_neon.td | 3 | ||||
-rw-r--r-- | clang/test/CodeGen/aarch64-neon-crypto.c | 5 | ||||
-rw-r--r-- | clang/utils/TableGen/NeonEmitter.cpp | 20 |
3 files changed, 27 insertions, 1 deletions
diff --git a/clang/include/clang/Basic/arm_neon.td b/clang/include/clang/Basic/arm_neon.td index c917940288b..ccca04e7b6a 100644 --- a/clang/include/clang/Basic/arm_neon.td +++ b/clang/include/clang/Basic/arm_neon.td @@ -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 diff --git a/clang/test/CodeGen/aarch64-neon-crypto.c b/clang/test/CodeGen/aarch64-neon-crypto.c index 968ef2ed604..240f3794b96 100644 --- a/clang/test/CodeGen/aarch64-neon-crypto.c +++ b/clang/test/CodeGen/aarch64-neon-crypto.c @@ -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 } diff --git a/clang/utils/TableGen/NeonEmitter.cpp b/clang/utils/TableGen/NeonEmitter.cpp index 86cd429b173..23c3b17666c 100644 --- a/clang/utils/TableGen/NeonEmitter.cpp +++ b/clang/utils/TableGen/NeonEmitter.cpp @@ -2560,8 +2560,28 @@ 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"; |