A64: Specialize sign-extension SBFM aliases

This commit is contained in:
MerryMage 2020-04-20 20:44:55 +01:00
parent 4573511fe3
commit a13392e432
3 changed files with 45 additions and 0 deletions

View file

@ -27,6 +27,11 @@ INST(MOVK, "MOVK", "z1110
INST(SBFM, "SBFM", "z00100110Nrrrrrrssssssnnnnnddddd") INST(SBFM, "SBFM", "z00100110Nrrrrrrssssssnnnnnddddd")
INST(BFM, "BFM", "z01100110Nrrrrrrssssssnnnnnddddd") INST(BFM, "BFM", "z01100110Nrrrrrrssssssnnnnnddddd")
INST(UBFM, "UBFM", "z10100110Nrrrrrrssssssnnnnnddddd") INST(UBFM, "UBFM", "z10100110Nrrrrrrssssssnnnnnddddd")
INST(SXTB_1, "SXTB (32-bit)", "0001001100000000000111nnnnnddddd")
INST(SXTB_2, "SXTB (64-bit)", "1001001101000000000111nnnnnddddd")
INST(SXTH_1, "SXTH (32-bit)", "0001001100000000001111nnnnnddddd")
INST(SXTH_2, "SXTH (64-bit)", "1001001101000000001111nnnnnddddd")
INST(SXTW, "SXTW", "1001001101000000011111nnnnnddddd")
// Data processing - Immediate - Extract // Data processing - Immediate - Extract
INST(EXTR, "EXTR", "z00100111N0mmmmmssssssnnnnnddddd") INST(EXTR, "EXTR", "z00100111N0mmmmmssssssnnnnnddddd")

View file

@ -85,6 +85,41 @@ bool TranslatorVisitor::UBFM(bool sf, bool N, Imm<6> immr, Imm<6> imms, Reg Rn,
return true; return true;
} }
bool TranslatorVisitor::SXTB_1(Reg Rn, Reg Rd) {
const auto src = X(32, Rn);
const auto result = ir.SignExtendToWord(ir.LeastSignificantByte(src));
X(32, Rd, result);
return true;
}
bool TranslatorVisitor::SXTB_2(Reg Rn, Reg Rd) {
const auto src = X(64, Rn);
const auto result = ir.SignExtendToLong(ir.LeastSignificantByte(src));
X(64, Rd, result);
return true;
}
bool TranslatorVisitor::SXTH_1(Reg Rn, Reg Rd) {
const auto src = X(32, Rn);
const auto result = ir.SignExtendToWord(ir.LeastSignificantHalf(src));
X(32, Rd, result);
return true;
}
bool TranslatorVisitor::SXTH_2(Reg Rn, Reg Rd) {
const auto src = X(64, Rn);
const auto result = ir.SignExtendToLong(ir.LeastSignificantHalf(src));
X(64, Rd, result);
return true;
}
bool TranslatorVisitor::SXTW(Reg Rn, Reg Rd) {
const auto src = X(64, Rn);
const auto result = ir.SignExtendToLong(ir.LeastSignificantWord(src));
X(64, Rd, result);
return true;
}
bool TranslatorVisitor::EXTR(bool sf, bool N, Reg Rm, Imm<6> imms, Reg Rn, Reg Rd) { bool TranslatorVisitor::EXTR(bool sf, bool N, Reg Rm, Imm<6> imms, Reg Rn, Reg Rd) {
if (N != sf) { if (N != sf) {
return UnallocatedEncoding(); return UnallocatedEncoding();

View file

@ -94,6 +94,11 @@ struct TranslatorVisitor final {
bool SBFM(bool sf, bool N, Imm<6> immr, Imm<6> imms, Reg Rn, Reg Rd); bool SBFM(bool sf, bool N, Imm<6> immr, Imm<6> imms, Reg Rn, Reg Rd);
bool BFM(bool sf, bool N, Imm<6> immr, Imm<6> imms, Reg Rn, Reg Rd); bool BFM(bool sf, bool N, Imm<6> immr, Imm<6> imms, Reg Rn, Reg Rd);
bool UBFM(bool sf, bool N, Imm<6> immr, Imm<6> imms, Reg Rn, Reg Rd); bool UBFM(bool sf, bool N, Imm<6> immr, Imm<6> imms, Reg Rn, Reg Rd);
bool SXTB_1(Reg Rn, Reg Rd);
bool SXTB_2(Reg Rn, Reg Rd);
bool SXTH_1(Reg Rn, Reg Rd);
bool SXTH_2(Reg Rn, Reg Rd);
bool SXTW(Reg Rn, Reg Rd);
// Data processing - Immediate - Extract // Data processing - Immediate - Extract
bool EXTR(bool sf, bool N, Reg Rm, Imm<6> imms, Reg Rn, Reg Rd); bool EXTR(bool sf, bool N, Reg Rm, Imm<6> imms, Reg Rn, Reg Rd);