Render.Recompiler: Implement V_FLOOR_F64 (#3828)

* VectorFpRound64 decode table

Also fixed definition for V_TRUNC_F64, though I doubt that would change anything important.

* V_FLOOR_F64 implementation

Used by Just Cause 4

* Oops

Never forget your 64s
This commit is contained in:
Stephen Miller
2025-11-25 01:51:06 -06:00
committed by GitHub
parent 14d71a155a
commit 6295c32e5c
3 changed files with 18 additions and 4 deletions

View File

@@ -1837,11 +1837,17 @@ constexpr std::array<InstFormat, 71> InstructionFormatVOP1 = {{
// 22 = V_CVT_F64_U32 // 22 = V_CVT_F64_U32
{InstClass::VectorConv, InstCategory::VectorALU, 1, 1, ScalarType::Uint32, ScalarType::Float64}, {InstClass::VectorConv, InstCategory::VectorALU, 1, 1, ScalarType::Uint32, ScalarType::Float64},
// 23 = V_TRUNC_F64 // 23 = V_TRUNC_F64
{InstClass::VectorConv, InstCategory::VectorALU, 1, 1, ScalarType::Float64, {InstClass::VectorFpRound64, InstCategory::VectorALU, 1, 1, ScalarType::Float64,
ScalarType::Float64},
// 24 = V_CEIL_F64
{InstClass::VectorFpRound64, InstCategory::VectorALU, 1, 1, ScalarType::Float64,
ScalarType::Float64},
// 25 = V_RNDNE_F64
{InstClass::VectorFpRound64, InstCategory::VectorALU, 1, 1, ScalarType::Float64,
ScalarType::Float64},
// 26 = V_FLOOR_F64
{InstClass::VectorFpRound64, InstCategory::VectorALU, 1, 1, ScalarType::Float64,
ScalarType::Float64}, ScalarType::Float64},
{},
{},
{},
{}, {},
{}, {},
{}, {},

View File

@@ -201,6 +201,7 @@ public:
void V_CVT_F32_F64(const GcnInst& inst); void V_CVT_F32_F64(const GcnInst& inst);
void V_CVT_F64_F32(const GcnInst& inst); void V_CVT_F64_F32(const GcnInst& inst);
void V_CVT_F32_UBYTE(u32 index, const GcnInst& inst); void V_CVT_F32_UBYTE(u32 index, const GcnInst& inst);
void V_FLOOR_F64(const GcnInst& inst);
void V_FRACT_F32(const GcnInst& inst); void V_FRACT_F32(const GcnInst& inst);
void V_TRUNC_F32(const GcnInst& inst); void V_TRUNC_F32(const GcnInst& inst);
void V_CEIL_F32(const GcnInst& inst); void V_CEIL_F32(const GcnInst& inst);

View File

@@ -142,6 +142,8 @@ void Translator::EmitVectorAlu(const GcnInst& inst) {
return V_CVT_F32_UBYTE(2, inst); return V_CVT_F32_UBYTE(2, inst);
case Opcode::V_CVT_F32_UBYTE3: case Opcode::V_CVT_F32_UBYTE3:
return V_CVT_F32_UBYTE(3, inst); return V_CVT_F32_UBYTE(3, inst);
case Opcode::V_FLOOR_F64:
return V_FLOOR_F64(inst);
case Opcode::V_FRACT_F32: case Opcode::V_FRACT_F32:
return V_FRACT_F32(inst); return V_FRACT_F32(inst);
case Opcode::V_TRUNC_F32: case Opcode::V_TRUNC_F32:
@@ -806,6 +808,11 @@ void Translator::V_CVT_F32_UBYTE(u32 index, const GcnInst& inst) {
SetDst(inst.dst[0], ir.ConvertUToF(32, 32, byte)); SetDst(inst.dst[0], ir.ConvertUToF(32, 32, byte));
} }
void Translator::V_FLOOR_F64(const GcnInst& inst) {
const IR::F64 src0{GetSrc64<IR::F64>(inst.src[0])};
SetDst64(inst.dst[0], ir.FPFloor(src0));
}
void Translator::V_FRACT_F32(const GcnInst& inst) { void Translator::V_FRACT_F32(const GcnInst& inst) {
const IR::F32 src0{GetSrc<IR::F32>(inst.src[0])}; const IR::F32 src0{GetSrc<IR::F32>(inst.src[0])};
SetDst(inst.dst[0], ir.FPFract(src0)); SetDst(inst.dst[0], ir.FPFract(src0));