frontend/ir/ir_emitter: Add opcodes for floating point reciprocal exponents
This commit is contained in:
parent
b168c2a9f9
commit
9cf3c25811
4 changed files with 27 additions and 0 deletions
|
@ -719,6 +719,23 @@ void EmitX64::EmitFPRecipEstimate64(EmitContext& ctx, IR::Inst* inst) {
|
|||
EmitFPRecipEstimate<u64>(code, ctx, inst);
|
||||
}
|
||||
|
||||
template <typename FPT>
|
||||
static void EmitFPRecipExponent(BlockOfCode& code, EmitContext& ctx, IR::Inst* inst) {
|
||||
auto args = ctx.reg_alloc.GetArgumentInfo(inst);
|
||||
ctx.reg_alloc.HostCall(inst, args[0]);
|
||||
code.mov(code.ABI_PARAM2.cvt32(), ctx.FPCR());
|
||||
code.lea(code.ABI_PARAM3, code.ptr[code.r15 + code.GetJitStateInfo().offsetof_fpsr_exc]);
|
||||
code.CallFunction(&FP::FPRecipExponent<FPT>);
|
||||
}
|
||||
|
||||
void EmitX64::EmitFPRecipExponent32(EmitContext& ctx, IR::Inst* inst) {
|
||||
EmitFPRecipExponent<u32>(code, ctx, inst);
|
||||
}
|
||||
|
||||
void EmitX64::EmitFPRecipExponent64(EmitContext& ctx, IR::Inst* inst) {
|
||||
EmitFPRecipExponent<u64>(code, ctx, inst);
|
||||
}
|
||||
|
||||
template<size_t fsize>
|
||||
static void EmitFPRecipStepFused(BlockOfCode& code, EmitContext& ctx, IR::Inst* inst) {
|
||||
using FPT = mp::unsigned_integer_of_size<fsize>;
|
||||
|
|
|
@ -1895,6 +1895,13 @@ U32U64 IREmitter::FPRecipEstimate(const U32U64& a) {
|
|||
return Inst<U64>(Opcode::FPRecipEstimate64, a);
|
||||
}
|
||||
|
||||
U32U64 IREmitter::FPRecipExponent(const U32U64& a) {
|
||||
if (a.GetType() == Type::U32) {
|
||||
return Inst<U32>(Opcode::FPRecipExponent32, a);
|
||||
}
|
||||
return Inst<U64>(Opcode::FPRecipExponent64, a);
|
||||
}
|
||||
|
||||
U32U64 IREmitter::FPRecipStepFused(const U32U64& a, const U32U64& b) {
|
||||
if (a.GetType() == Type::U32) {
|
||||
return Inst<U32>(Opcode::FPRecipStepFused32, a, b);
|
||||
|
|
|
@ -305,6 +305,7 @@ public:
|
|||
U32U64 FPMulX(const U32U64& a, const U32U64& b);
|
||||
U32U64 FPNeg(const U32U64& a);
|
||||
U32U64 FPRecipEstimate(const U32U64& a);
|
||||
U32U64 FPRecipExponent(const U32U64& a);
|
||||
U32U64 FPRecipStepFused(const U32U64& a, const U32U64& b);
|
||||
U32U64 FPRoundInt(const U32U64& a, FP::RoundingMode rounding, bool exact);
|
||||
U32U64 FPRSqrtEstimate(const U32U64& a);
|
||||
|
|
|
@ -484,6 +484,8 @@ OPCODE(FPNeg32, U32, U32
|
|||
OPCODE(FPNeg64, U64, U64 )
|
||||
OPCODE(FPRecipEstimate32, U32, U32 )
|
||||
OPCODE(FPRecipEstimate64, U64, U64 )
|
||||
OPCODE(FPRecipExponent32, U32, U32 )
|
||||
OPCODE(FPRecipExponent64, U64, U64 )
|
||||
OPCODE(FPRecipStepFused32, U32, U32, U32 )
|
||||
OPCODE(FPRecipStepFused64, U64, U64, U64 )
|
||||
OPCODE(FPRoundInt32, U32, U32, U8, U1 )
|
||||
|
|
Loading…
Reference in a new issue