A64: Implement FABS

This commit is contained in:
MerryMage 2018-02-04 13:43:47 +00:00
parent 8765b421b7
commit db958061a3
2 changed files with 13 additions and 1 deletions

View file

@ -908,7 +908,7 @@ INST(FCVTZU_float_int, "FCVTZU (scalar, integer)", "z0011
// Data Processing - FP and SIMD - Floating point data processing // Data Processing - FP and SIMD - Floating point data processing
//INST(FMOV_float, "FMOV (register)", "00011110yy100000010000nnnnnddddd") //INST(FMOV_float, "FMOV (register)", "00011110yy100000010000nnnnnddddd")
//INST(FABS_float, "FABS (scalar)", "00011110yy100000110000nnnnnddddd") INST(FABS_float, "FABS (scalar)", "00011110yy100000110000nnnnnddddd")
//INST(FNEG_float, "FNEG (scalar)", "00011110yy100001010000nnnnnddddd") //INST(FNEG_float, "FNEG (scalar)", "00011110yy100001010000nnnnnddddd")
//INST(FSQRT_float, "FSQRT (scalar)", "00011110yy100001110000nnnnnddddd") //INST(FSQRT_float, "FSQRT (scalar)", "00011110yy100001110000nnnnnddddd")
INST(FCVT_float, "FCVT", "00011110yy10001oo10000nnnnnddddd") INST(FCVT_float, "FCVT", "00011110yy10001oo10000nnnnnddddd")

View file

@ -22,6 +22,18 @@ static boost::optional<size_t> GetDataSize(Imm<2> type) {
return boost::none; return boost::none;
} }
bool TranslatorVisitor::FABS_float(Imm<2> type, Vec Vn, Vec Vd) {
boost::optional<size_t> datasize = GetDataSize(type);
if (!datasize || *datasize == 16) {
return UnallocatedEncoding();
}
const IR::U32U64 operand = V_scalar(*datasize, Vn);
const IR::U32U64 result = ir.FPAbs(operand);
V_scalar(*datasize, Vd, result);
return true;
}
bool TranslatorVisitor::FMOV_float_imm(Imm<2> type, Imm<8> imm8, Vec Vd) { bool TranslatorVisitor::FMOV_float_imm(Imm<2> type, Imm<8> imm8, Vec Vd) {
boost::optional<size_t> datasize = GetDataSize(type); boost::optional<size_t> datasize = GetDataSize(type);
if (!datasize) { if (!datasize) {