A64: Implement AESE

This commit is contained in:
Lioncash
2018-02-03 13:16:02 -05:00
committed by MerryMage
parent 68f46c8334
commit ccef85dbb7
8 changed files with 98 additions and 8 deletions

View File

@@ -329,7 +329,7 @@ INST(UMSUBL, "UMSUBL", "10011
//INST(UMULH, "UMULH", "10011011110mmmmm011111nnnnnddddd")
// Data Processing - FP and SIMD - AES
//INST(AESE, "AESE", "0100111000101000010010nnnnnddddd")
INST(AESE, "AESE", "0100111000101000010010nnnnnddddd")
//INST(AESD, "AESD", "0100111000101000010110nnnnnddddd")
INST(AESMC, "AESMC", "0100111000101000011010nnnnnddddd")
INST(AESIMC, "AESIMC", "0100111000101000011110nnnnnddddd")

View File

@@ -8,6 +8,16 @@
namespace Dynarmic::A64 {
bool TranslatorVisitor::AESE(Vec Vn, Vec Vd) {
const IR::U128 operand1 = ir.GetQ(Vd);
const IR::U128 operand2 = ir.GetQ(Vn);
const IR::U128 result = ir.AESEncrypt(ir.VectorEor(operand1, operand2));
ir.SetQ(Vd, result);
return true;
}
bool TranslatorVisitor::AESIMC(Vec Vn, Vec Vd) {
const IR::U128 operand = ir.GetQ(Vn);
const IR::U128 result = ir.AESInverseMixColumns(operand);

View File

@@ -723,11 +723,15 @@ U32 IREmitter::CRC32ISO64(const U32& a, const U64& b) {
return Inst<U32>(Opcode::CRC32ISO64, a, b);
}
U128 IREmitter::AESInverseMixColumns(const U128 &a) {
U128 IREmitter::AESEncrypt(const U128& a) {
return Inst<U128>(Opcode::AESEncrypt, a);
}
U128 IREmitter::AESInverseMixColumns(const U128& a) {
return Inst<U128>(Opcode::AESInverseMixColumns, a);
}
U128 IREmitter::AESMixColumns(const U128 &a) {
U128 IREmitter::AESMixColumns(const U128& a) {
return Inst<U128>(Opcode::AESMixColumns, a);
}

View File

@@ -197,6 +197,7 @@ public:
U32 CRC32ISO32(const U32& a, const U32& b);
U32 CRC32ISO64(const U32& a, const U64& b);
U128 AESEncrypt(const U128& a);
U128 AESInverseMixColumns(const U128& a);
U128 AESMixColumns(const U128& a);

View File

@@ -181,6 +181,7 @@ OPCODE(CRC32ISO32, T::U32, T::U32, T::U32
OPCODE(CRC32ISO64, T::U32, T::U32, T::U64 )
// AES instructions
OPCODE(AESEncrypt, T::U128, T::U128 )
OPCODE(AESInverseMixColumns, T::U128, T::U128 )
OPCODE(AESMixColumns, T::U128, T::U128 )