mirror of
https://git.suyu.dev/suyu/dynarmic.git
synced 2026-03-09 14:56:28 +00:00
A64: Implement FCMP, FCMPE
This commit is contained in:
62
src/frontend/A64/translate/impl/floating_point_compare.cpp
Normal file
62
src/frontend/A64/translate/impl/floating_point_compare.cpp
Normal file
@@ -0,0 +1,62 @@
|
||||
/* This file is part of the dynarmic project.
|
||||
* Copyright (c) 2018 MerryMage
|
||||
* This software may be used and distributed according to the terms of the GNU
|
||||
* General Public License version 2 or any later version.
|
||||
*/
|
||||
|
||||
#include <boost/optional.hpp>
|
||||
|
||||
#include "frontend/A64/translate/impl/impl.h"
|
||||
|
||||
namespace Dynarmic::A64 {
|
||||
|
||||
static boost::optional<size_t> GetDataSize(Imm<2> type) {
|
||||
switch (type.ZeroExtend()) {
|
||||
case 0b00:
|
||||
return 32;
|
||||
case 0b01:
|
||||
return 64;
|
||||
case 0b11:
|
||||
// FP16Ext, unimplemented.
|
||||
return boost::none;
|
||||
}
|
||||
return boost::none;
|
||||
}
|
||||
|
||||
bool TranslatorVisitor::FCMP_float(Imm<2> type, Vec Vm, Vec Vn, bool cmp_with_zero) {
|
||||
auto datasize = GetDataSize(type);
|
||||
if (!datasize) {
|
||||
return UnallocatedEncoding();
|
||||
}
|
||||
|
||||
const IR::U32U64 operand1 = V_scalar(*datasize, Vn);
|
||||
IR::U32U64 operand2;
|
||||
if (cmp_with_zero) {
|
||||
operand2 = I(*datasize, 0);
|
||||
} else {
|
||||
operand2 = V_scalar(*datasize, Vm);
|
||||
}
|
||||
|
||||
ir.FPCompare(operand1, operand2, false, true);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool TranslatorVisitor::FCMPE_float(Imm<2> type, Vec Vm, Vec Vn, bool cmp_with_zero) {
|
||||
auto datasize = GetDataSize(type);
|
||||
if (!datasize) {
|
||||
return UnallocatedEncoding();
|
||||
}
|
||||
|
||||
const IR::U32U64 operand1 = V_scalar(*datasize, Vn);
|
||||
IR::U32U64 operand2;
|
||||
if (cmp_with_zero) {
|
||||
operand2 = I(*datasize, 0);
|
||||
} else {
|
||||
operand2 = V_scalar(*datasize, Vm);
|
||||
}
|
||||
|
||||
ir.FPCompare(operand1, operand2, true, true);
|
||||
return true;
|
||||
}
|
||||
|
||||
} // namespace Dynarmic::A64
|
||||
Reference in New Issue
Block a user