mirror of
https://git.suyu.dev/suyu/dynarmic.git
synced 2026-02-19 14:52:57 +00:00
Merge pull request #478 from lioncash/stepfused
A64: Handle half-precision variants of FRECPE and FRECPS
This commit is contained in:
@@ -384,7 +384,7 @@ INST(DUP_elt_1, "DUP (element)", "01011
|
||||
INST(FMULX_vec_2, "FMULX", "010111100z1mmmmm110111nnnnnddddd")
|
||||
//INST(FCMEQ_reg_1, "FCMEQ (register)", "01011110010mmmmm001001nnnnnddddd")
|
||||
INST(FCMEQ_reg_2, "FCMEQ (register)", "010111100z1mmmmm111001nnnnnddddd")
|
||||
//INST(FRECPS_1, "FRECPS", "01011110010mmmmm001111nnnnnddddd")
|
||||
INST(FRECPS_1, "FRECPS", "01011110010mmmmm001111nnnnnddddd")
|
||||
INST(FRECPS_2, "FRECPS", "010111100z1mmmmm111111nnnnnddddd")
|
||||
//INST(FRSQRTS_1, "FRSQRTS", "01011110110mmmmm001111nnnnnddddd")
|
||||
INST(FRSQRTS_2, "FRSQRTS", "010111101z1mmmmm111111nnnnnddddd")
|
||||
@@ -418,7 +418,7 @@ INST(FCMLT_2, "FCMLT (zero)", "01011
|
||||
INST(FCVTPS_2, "FCVTPS (vector)", "010111101z100001101010nnnnnddddd")
|
||||
//INST(FCVTZS_int_1, "FCVTZS (vector, integer)", "0101111011111001101110nnnnnddddd")
|
||||
INST(FCVTZS_int_2, "FCVTZS (vector, integer)", "010111101z100001101110nnnnnddddd")
|
||||
//INST(FRECPE_1, "FRECPE", "0101111011111001110110nnnnnddddd")
|
||||
INST(FRECPE_1, "FRECPE", "0101111011111001110110nnnnnddddd")
|
||||
INST(FRECPE_2, "FRECPE", "010111101z100001110110nnnnnddddd")
|
||||
INST(FRECPX_1, "FRECPX", "0101111011111001111110nnnnnddddd")
|
||||
INST(FRECPX_2, "FRECPX", "010111101z100001111110nnnnnddddd")
|
||||
@@ -575,7 +575,7 @@ INST(INS_elt, "INS (element)", "01101
|
||||
// Data Processing - FP and SIMD - SIMD Three same
|
||||
//INST(FMULX_vec_3, "FMULX", "0Q001110010mmmmm000111nnnnnddddd")
|
||||
//INST(FCMEQ_reg_3, "FCMEQ (register)", "0Q001110010mmmmm001001nnnnnddddd")
|
||||
//INST(FRECPS_3, "FRECPS", "0Q001110010mmmmm001111nnnnnddddd")
|
||||
INST(FRECPS_3, "FRECPS", "0Q001110010mmmmm001111nnnnnddddd")
|
||||
//INST(FRSQRTS_3, "FRSQRTS", "0Q001110110mmmmm001111nnnnnddddd")
|
||||
//INST(FCMGE_reg_3, "FCMGE (register)", "0Q101110010mmmmm001001nnnnnddddd")
|
||||
//INST(FACGE_3, "FACGE", "0Q101110010mmmmm001011nnnnnddddd")
|
||||
@@ -650,7 +650,7 @@ INST(FCVTPS_4, "FCVTPS (vector)", "0Q001
|
||||
//INST(FCVTZS_int_3, "FCVTZS (vector, integer)", "0Q00111011111001101110nnnnnddddd")
|
||||
INST(FCVTZS_int_4, "FCVTZS (vector, integer)", "0Q0011101z100001101110nnnnnddddd")
|
||||
INST(URECPE, "URECPE", "0Q0011101z100001110010nnnnnddddd")
|
||||
//INST(FRECPE_3, "FRECPE", "0Q00111011111001110110nnnnnddddd")
|
||||
INST(FRECPE_3, "FRECPE", "0Q00111011111001110110nnnnnddddd")
|
||||
INST(FRECPE_4, "FRECPE", "0Q0011101z100001110110nnnnnddddd")
|
||||
INST(REV32_asimd, "REV32 (vector)", "0Q101110zz100000000010nnnnnddddd")
|
||||
INST(UADDLP, "UADDLP", "0Q101110zz100000001010nnnnnddddd")
|
||||
|
||||
@@ -294,6 +294,17 @@ bool TranslatorVisitor::FMULX_vec_2(bool sz, Vec Vm, Vec Vn, Vec Vd) {
|
||||
return true;
|
||||
}
|
||||
|
||||
bool TranslatorVisitor::FRECPS_1(Vec Vm, Vec Vn, Vec Vd) {
|
||||
const size_t esize = 16;
|
||||
|
||||
const IR::U16 operand1 = V_scalar(esize, Vn);
|
||||
const IR::U16 operand2 = V_scalar(esize, Vm);
|
||||
const IR::U16 result = ir.FPRecipStepFused(operand1, operand2);
|
||||
|
||||
V_scalar(esize, Vd, result);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool TranslatorVisitor::FRECPS_2(bool sz, Vec Vm, Vec Vn, Vec Vd) {
|
||||
const size_t esize = sz ? 64 : 32;
|
||||
|
||||
|
||||
@@ -172,6 +172,16 @@ bool TranslatorVisitor::FCVTZU_int_2(bool sz, Vec Vn, Vec Vd) {
|
||||
return ScalarFPConvertWithRound(*this, sz, Vn, Vd, FP::RoundingMode::TowardsZero, Signedness::Unsigned);
|
||||
}
|
||||
|
||||
bool TranslatorVisitor::FRECPE_1(Vec Vn, Vec Vd) {
|
||||
const size_t esize = 16;
|
||||
|
||||
const IR::U16 operand = V_scalar(esize, Vn);
|
||||
const IR::U16 result = ir.FPRecipEstimate(operand);
|
||||
|
||||
V_scalar(esize, Vd, result);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool TranslatorVisitor::FRECPE_2(bool sz, Vec Vn, Vec Vd) {
|
||||
const size_t esize = sz ? 64 : 32;
|
||||
|
||||
|
||||
@@ -939,6 +939,18 @@ bool TranslatorVisitor::FSUB_2(bool Q, bool sz, Vec Vm, Vec Vn, Vec Vd) {
|
||||
return true;
|
||||
}
|
||||
|
||||
bool TranslatorVisitor::FRECPS_3(bool Q, Vec Vm, Vec Vn, Vec Vd) {
|
||||
const size_t esize = 16;
|
||||
const size_t datasize = Q ? 128 : 64;
|
||||
|
||||
const IR::U128 operand1 = V(datasize, Vn);
|
||||
const IR::U128 operand2 = V(datasize, Vm);
|
||||
const IR::U128 result = ir.FPVectorRecipStepFused(esize, operand1, operand2);
|
||||
|
||||
V(datasize, Vd, result);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool TranslatorVisitor::FRECPS_4(bool Q, bool sz, Vec Vm, Vec Vn, Vec Vd) {
|
||||
if (sz && !Q) {
|
||||
return ReservedValue();
|
||||
|
||||
@@ -518,6 +518,17 @@ bool TranslatorVisitor::FRINTI_2(bool Q, bool sz, Vec Vn, Vec Vd) {
|
||||
return FloatRoundToIntegral(*this, Q, sz, Vn, Vd,ir.current_location->FPCR().RMode(), false);
|
||||
}
|
||||
|
||||
bool TranslatorVisitor::FRECPE_3(bool Q, Vec Vn, Vec Vd) {
|
||||
const size_t datasize = Q ? 128 : 64;
|
||||
const size_t esize = 16;
|
||||
|
||||
const IR::U128 operand = V(datasize, Vn);
|
||||
const IR::U128 result = ir.FPVectorRecipEstimate(esize, operand);
|
||||
|
||||
V(datasize, Vd, result);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool TranslatorVisitor::FRECPE_4(bool Q, bool sz, Vec Vn, Vec Vd) {
|
||||
if (sz && !Q) {
|
||||
return ReservedValue();
|
||||
|
||||
@@ -1922,11 +1922,18 @@ U16U32U64 IREmitter::FPNeg(const U16U32U64& a) {
|
||||
}
|
||||
}
|
||||
|
||||
U32U64 IREmitter::FPRecipEstimate(const U32U64& a) {
|
||||
if (a.GetType() == Type::U32) {
|
||||
U16U32U64 IREmitter::FPRecipEstimate(const U16U32U64& a) {
|
||||
switch (a.GetType()) {
|
||||
case Type::U16:
|
||||
return Inst<U16>(Opcode::FPRecipEstimate16, a);
|
||||
case Type::U32:
|
||||
return Inst<U32>(Opcode::FPRecipEstimate32, a);
|
||||
case Type::U64:
|
||||
return Inst<U64>(Opcode::FPRecipEstimate64, a);
|
||||
default:
|
||||
UNREACHABLE();
|
||||
return U16U32U64{};
|
||||
}
|
||||
return Inst<U64>(Opcode::FPRecipEstimate64, a);
|
||||
}
|
||||
|
||||
U16U32U64 IREmitter::FPRecipExponent(const U16U32U64& a) {
|
||||
@@ -1943,11 +1950,20 @@ U16U32U64 IREmitter::FPRecipExponent(const U16U32U64& a) {
|
||||
}
|
||||
}
|
||||
|
||||
U32U64 IREmitter::FPRecipStepFused(const U32U64& a, const U32U64& b) {
|
||||
if (a.GetType() == Type::U32) {
|
||||
U16U32U64 IREmitter::FPRecipStepFused(const U16U32U64& a, const U16U32U64& b) {
|
||||
ASSERT(a.GetType() == b.GetType());
|
||||
|
||||
switch (a.GetType()) {
|
||||
case Type::U16:
|
||||
return Inst<U16>(Opcode::FPRecipStepFused16, a, b);
|
||||
case Type::U32:
|
||||
return Inst<U32>(Opcode::FPRecipStepFused32, a, b);
|
||||
case Type::U64:
|
||||
return Inst<U64>(Opcode::FPRecipStepFused64, a, b);
|
||||
default:
|
||||
UNREACHABLE();
|
||||
return U16U32U64{};
|
||||
}
|
||||
return Inst<U64>(Opcode::FPRecipStepFused64, a, b);
|
||||
}
|
||||
|
||||
U16U32U64 IREmitter::FPRoundInt(const U16U32U64& a, FP::RoundingMode rounding, bool exact) {
|
||||
@@ -2264,6 +2280,8 @@ U128 IREmitter::FPVectorPairedAddLower(size_t esize, const U128& a, const U128&
|
||||
|
||||
U128 IREmitter::FPVectorRecipEstimate(size_t esize, const U128& a) {
|
||||
switch (esize) {
|
||||
case 16:
|
||||
return Inst<U128>(Opcode::FPVectorRecipEstimate16, a);
|
||||
case 32:
|
||||
return Inst<U128>(Opcode::FPVectorRecipEstimate32, a);
|
||||
case 64:
|
||||
@@ -2275,6 +2293,8 @@ U128 IREmitter::FPVectorRecipEstimate(size_t esize, const U128& a) {
|
||||
|
||||
U128 IREmitter::FPVectorRecipStepFused(size_t esize, const U128& a, const U128& b) {
|
||||
switch (esize) {
|
||||
case 16:
|
||||
return Inst<U128>(Opcode::FPVectorRecipStepFused16, a, b);
|
||||
case 32:
|
||||
return Inst<U128>(Opcode::FPVectorRecipStepFused32, a, b);
|
||||
case 64:
|
||||
|
||||
@@ -305,9 +305,9 @@ public:
|
||||
U16U32U64 FPMulAdd(const U16U32U64& addend, const U16U32U64& op1, const U16U32U64& op2, bool fpcr_controlled);
|
||||
U32U64 FPMulX(const U32U64& a, const U32U64& b);
|
||||
U16U32U64 FPNeg(const U16U32U64& a);
|
||||
U32U64 FPRecipEstimate(const U32U64& a);
|
||||
U16U32U64 FPRecipEstimate(const U16U32U64& a);
|
||||
U16U32U64 FPRecipExponent(const U16U32U64& a);
|
||||
U32U64 FPRecipStepFused(const U32U64& a, const U32U64& b);
|
||||
U16U32U64 FPRecipStepFused(const U16U32U64& a, const U16U32U64& b);
|
||||
U16U32U64 FPRoundInt(const U16U32U64& a, FP::RoundingMode rounding, bool exact);
|
||||
U16U32U64 FPRSqrtEstimate(const U16U32U64& a);
|
||||
U32U64 FPRSqrtStepFused(const U32U64& a, const U32U64& b);
|
||||
|
||||
@@ -272,11 +272,13 @@ bool Inst::ReadsFromAndWritesToFPSRCumulativeExceptionBits() const {
|
||||
case Opcode::FPMulAdd16:
|
||||
case Opcode::FPMulAdd32:
|
||||
case Opcode::FPMulAdd64:
|
||||
case Opcode::FPRecipEstimate16:
|
||||
case Opcode::FPRecipEstimate32:
|
||||
case Opcode::FPRecipEstimate64:
|
||||
case Opcode::FPRecipExponent16:
|
||||
case Opcode::FPRecipExponent32:
|
||||
case Opcode::FPRecipExponent64:
|
||||
case Opcode::FPRecipStepFused16:
|
||||
case Opcode::FPRecipStepFused32:
|
||||
case Opcode::FPRecipStepFused64:
|
||||
case Opcode::FPRoundInt16:
|
||||
@@ -336,8 +338,10 @@ bool Inst::ReadsFromAndWritesToFPSRCumulativeExceptionBits() const {
|
||||
case Opcode::FPVectorPairedAddLower64:
|
||||
case Opcode::FPVectorPairedAdd32:
|
||||
case Opcode::FPVectorPairedAdd64:
|
||||
case Opcode::FPVectorRecipEstimate16:
|
||||
case Opcode::FPVectorRecipEstimate32:
|
||||
case Opcode::FPVectorRecipEstimate64:
|
||||
case Opcode::FPVectorRecipStepFused16:
|
||||
case Opcode::FPVectorRecipStepFused32:
|
||||
case Opcode::FPVectorRecipStepFused64:
|
||||
case Opcode::FPVectorRoundInt16:
|
||||
|
||||
@@ -491,11 +491,13 @@ OPCODE(FPMulX64, U64, U64,
|
||||
OPCODE(FPNeg16, U16, U16 )
|
||||
OPCODE(FPNeg32, U32, U32 )
|
||||
OPCODE(FPNeg64, U64, U64 )
|
||||
OPCODE(FPRecipEstimate16, U16, U16 )
|
||||
OPCODE(FPRecipEstimate32, U32, U32 )
|
||||
OPCODE(FPRecipEstimate64, U64, U64 )
|
||||
OPCODE(FPRecipExponent16, U16, U16 )
|
||||
OPCODE(FPRecipExponent32, U32, U32 )
|
||||
OPCODE(FPRecipExponent64, U64, U64 )
|
||||
OPCODE(FPRecipStepFused16, U16, U16, U16 )
|
||||
OPCODE(FPRecipStepFused32, U32, U32, U32 )
|
||||
OPCODE(FPRecipStepFused64, U64, U64, U64 )
|
||||
OPCODE(FPRoundInt16, U16, U16, U8, U1 )
|
||||
@@ -571,8 +573,10 @@ OPCODE(FPVectorPairedAdd32, U128, U128
|
||||
OPCODE(FPVectorPairedAdd64, U128, U128, U128 )
|
||||
OPCODE(FPVectorPairedAddLower32, U128, U128, U128 )
|
||||
OPCODE(FPVectorPairedAddLower64, U128, U128, U128 )
|
||||
OPCODE(FPVectorRecipEstimate16, U128, U128 )
|
||||
OPCODE(FPVectorRecipEstimate32, U128, U128 )
|
||||
OPCODE(FPVectorRecipEstimate64, U128, U128 )
|
||||
OPCODE(FPVectorRecipStepFused16, U128, U128, U128 )
|
||||
OPCODE(FPVectorRecipStepFused32, U128, U128, U128 )
|
||||
OPCODE(FPVectorRecipStepFused64, U128, U128, U128 )
|
||||
OPCODE(FPVectorRoundInt16, U128, U128, U8, U1 )
|
||||
|
||||
Reference in New Issue
Block a user