diff options
| author | Chad Rosier <mcrosier@codeaurora.org> | 2018-05-24 15:26:42 +0000 |
|---|---|---|
| committer | Chad Rosier <mcrosier@codeaurora.org> | 2018-05-24 15:26:42 +0000 |
| commit | 274d72faad6741613f74a17ad9a4a516826722ab (patch) | |
| tree | 39463807fa7c96de1e5c5eea42ef0b40bfb333be /llvm/lib/Transforms/InstCombine | |
| parent | 451f6c86800ef70e21647ccea31a704e3e419de3 (diff) | |
| download | bcm5719-llvm-274d72faad6741613f74a17ad9a4a516826722ab.tar.gz bcm5719-llvm-274d72faad6741613f74a17ad9a4a516826722ab.zip | |
[InstCombine] Combine XOR and AES instructions on ARM/ARM64.
The ARM/ARM64 AESE and AESD instructions have a builtin XOR as the first step in
the instruction. Therefore, if the AES key is zero and the AES data was
previously XORed, it can be combined into a single instruction.
Differential Revision: https://reviews.llvm.org/D47239
Patch by Michael Brase!
llvm-svn: 333193
Diffstat (limited to 'llvm/lib/Transforms/InstCombine')
| -rw-r--r-- | llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp b/llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp index 8b7c28281ca..a5a0edcd96f 100644 --- a/llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp +++ b/llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp @@ -2966,6 +2966,23 @@ Instruction *InstCombiner::visitCallInst(CallInst &CI) { break; } + case Intrinsic::arm_neon_aesd: + case Intrinsic::arm_neon_aese: + case Intrinsic::aarch64_crypto_aesd: + case Intrinsic::aarch64_crypto_aese: { + Value *DataArg = II->getArgOperand(0); + Value *KeyArg = II->getArgOperand(1); + + // Try to use the builtin XOR in AESE and AESD to eliminate a prior XOR + Value *Data, *Key; + if (match(KeyArg, m_ZeroInt()) && + match(DataArg, m_Xor(m_Value(Data), m_Value(Key)))) { + II->setArgOperand(0, Data); + II->setArgOperand(1, Key); + return II; + } + break; + } case Intrinsic::amdgcn_rcp: { Value *Src = II->getArgOperand(0); |

