diff --git a/src/frontend/A64/decoder/a64.inc b/src/frontend/A64/decoder/a64.inc index b4875e1d..dc9404d7 100644 --- a/src/frontend/A64/decoder/a64.inc +++ b/src/frontend/A64/decoder/a64.inc @@ -325,7 +325,7 @@ INST(AESIMC, "AESIMC", "01001 //INST(SHA1C, "SHA1C", "01011110000mmmmm000000nnnnnddddd") //INST(SHA1P, "SHA1P", "01011110000mmmmm000100nnnnnddddd") //INST(SHA1M, "SHA1M", "01011110000mmmmm001000nnnnnddddd") -//INST(SHA1SU0, "SHA1SU0", "01011110000mmmmm001100nnnnnddddd") +INST(SHA1SU0, "SHA1SU0", "01011110000mmmmm001100nnnnnddddd") //INST(SHA256H, "SHA256H", "01011110000mmmmm010000nnnnnddddd") //INST(SHA256H2, "SHA256H2", "01011110000mmmmm010100nnnnnddddd") //INST(SHA256SU1, "SHA256SU1", "01011110000mmmmm011000nnnnnddddd") diff --git a/src/frontend/A64/translate/impl/simd_sha.cpp b/src/frontend/A64/translate/impl/simd_sha.cpp index 55624a26..d9190ee8 100644 --- a/src/frontend/A64/translate/impl/simd_sha.cpp +++ b/src/frontend/A64/translate/impl/simd_sha.cpp @@ -8,6 +8,26 @@ namespace Dynarmic::A64 { +bool TranslatorVisitor::SHA1SU0(Vec Vm, Vec Vn, Vec Vd) { + const IR::U128 d = ir.GetQ(Vd); + const IR::U128 m = ir.GetQ(Vm); + const IR::U128 n = ir.GetQ(Vn); + + IR::U128 result = [&] { + const IR::U64 d_high = ir.VectorGetElement(64, d, 1); + const IR::U64 n_low = ir.VectorGetElement(64, n, 0); + const IR::U128 zero = ir.ZeroVector(); + + const IR::U128 tmp1 = ir.VectorSetElement(64, zero, 0, d_high); + return ir.VectorSetElement(64, tmp1, 1, n_low); + }(); + + result = ir.VectorEor(ir.VectorEor(result, d), m); + + ir.SetQ(Vd, result); + return true; +} + bool TranslatorVisitor::SHA1H(Vec Vn, Vec Vd) { const IR::U128 data = ir.GetS(Vn);