A64: Implement CNT

This commit is contained in:
MerryMage 2018-02-11 11:44:00 +00:00
parent 303088a51e
commit 6c9b4f0114
2 changed files with 14 additions and 1 deletions

View file

@ -633,7 +633,7 @@ INST(INS_elt, "INS (element)", "01101
//INST(REV16_asimd, "REV16 (vector)", "0Q001110zz100000000110nnnnnddddd")
//INST(SADDLP, "SADDLP", "0Q001110zz100000001010nnnnnddddd")
//INST(CLS_asimd, "CLS (vector)", "0Q001110zz100000010010nnnnnddddd")
//INST(CNT, "CNT", "0Q001110zz100000010110nnnnnddddd")
INST(CNT, "CNT", "0Q001110zz100000010110nnnnnddddd")
//INST(SADALP, "SADALP", "0Q001110zz100000011010nnnnnddddd")
INST(XTN, "XTN, XTN2", "0Q001110zz100001001010nnnnnddddd")
//INST(FCVTN, "FCVTN, FCVTN2", "0Q0011100z100001011010nnnnnddddd")

View file

@ -8,6 +8,19 @@
namespace Dynarmic::A64 {
bool TranslatorVisitor::CNT(bool Q, Imm<2> size, Vec Vn, Vec Vd) {
if (size != 0b00) {
return ReservedValue();
}
const size_t datasize = Q ? 128 : 64;
const IR::U128 operand = V(datasize, Vn);
const IR::U128 result = ir.VectorPopulationCount(operand);
V(datasize, Vd, result);
return true;
}
bool TranslatorVisitor::XTN(bool Q, Imm<2> size, Vec Vn, Vec Vd) {
if (size == 0b11) {
return ReservedValue();