IR: Implement FPRecipStepFused, FPVectorRecipStepFused

This commit is contained in:
MerryMage 2018-07-25 19:11:20 +01:00
parent f66f61d8ab
commit 901bd9b4e2
10 changed files with 135 additions and 0 deletions

View file

@ -1495,6 +1495,13 @@ U32U64 IREmitter::FPRecipEstimate(const U32U64& a) {
return Inst<U64>(Opcode::FPRecipEstimate64, a);
}
U32U64 IREmitter::FPRecipStepFused(const U32U64& a, const U32U64& b) {
if (a.GetType() == Type::U32) {
return Inst<U32>(Opcode::FPRecipStepFused32, a, b);
}
return Inst<U64>(Opcode::FPRecipStepFused64, a, b);
}
U32U64 IREmitter::FPRoundInt(const U32U64& a, FP::RoundingMode rounding, bool exact) {
if (a.GetType() == Type::U32) {
return Inst<U32>(Opcode::FPRoundInt32, a, static_cast<u8>(rounding), Imm1(exact));
@ -1760,6 +1767,17 @@ U128 IREmitter::FPVectorRecipEstimate(size_t esize, const U128& a) {
return {};
}
U128 IREmitter::FPVectorRecipStepFused(size_t esize, const U128& a, const U128& b) {
switch (esize) {
case 32:
return Inst<U128>(Opcode::FPVectorRecipStepFused32, a, b);
case 64:
return Inst<U128>(Opcode::FPVectorRecipStepFused64, a, b);
}
UNREACHABLE();
return {};
}
U128 IREmitter::FPVectorRSqrtEstimate(size_t esize, const U128& a) {
switch (esize) {
case 32:

View file

@ -270,6 +270,7 @@ public:
U32U64 FPMulAdd(const U32U64& addend, const U32U64& op1, const U32U64& op2, bool fpscr_controlled);
U32U64 FPNeg(const U32U64& a);
U32U64 FPRecipEstimate(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);
U32U64 FPRSqrtStepFused(const U32U64& a, const U32U64& b);
@ -306,6 +307,7 @@ public:
U128 FPVectorPairedAdd(size_t esize, const U128& a, const U128& b);
U128 FPVectorPairedAddLower(size_t esize, const U128& a, const U128& b);
U128 FPVectorRecipEstimate(size_t esize, const U128& a);
U128 FPVectorRecipStepFused(size_t esize, const U128& a, const U128& b);
U128 FPVectorRSqrtEstimate(size_t esize, const U128& a);
U128 FPVectorRSqrtStepFused(size_t esize, const U128& a, const U128& b);
U128 FPVectorSub(size_t esize, const U128& a, const U128& b);

View file

@ -396,6 +396,8 @@ OPCODE(FPNeg32, T::U32, T::U32
OPCODE(FPNeg64, T::U64, T::U64 )
OPCODE(FPRecipEstimate32, T::U32, T::U32 )
OPCODE(FPRecipEstimate64, T::U64, T::U64 )
OPCODE(FPRecipStepFused32, T::U32, T::U32, T::U32 )
OPCODE(FPRecipStepFused64, T::U64, T::U64, T::U64 )
OPCODE(FPRoundInt32, T::U32, T::U32, T::U8, T::U1 )
OPCODE(FPRoundInt64, T::U64, T::U64, T::U8, T::U1 )
OPCODE(FPRSqrtEstimate32, T::U32, T::U32 )
@ -454,6 +456,8 @@ OPCODE(FPVectorPairedAdd32, T::U128, T::U128,
OPCODE(FPVectorPairedAdd64, T::U128, T::U128, T::U128 )
OPCODE(FPVectorRecipEstimate32, T::U128, T::U128 )
OPCODE(FPVectorRecipEstimate64, T::U128, T::U128 )
OPCODE(FPVectorRecipStepFused32, T::U128, T::U128, T::U128 )
OPCODE(FPVectorRecipStepFused64, T::U128, T::U128, T::U128 )
OPCODE(FPVectorRSqrtEstimate32, T::U128, T::U128 )
OPCODE(FPVectorRSqrtEstimate64, T::U128, T::U128 )
OPCODE(FPVectorRSqrtStepFused32, T::U128, T::U128, T::U128 )