mirror of
https://github.com/shadps4-emu/shadPS4.git
synced 2025-05-18 09:24:58 +00:00
Add various V_CVT opcodes (#1223)
This commit is contained in:
parent
be411b37d4
commit
9f79764b01
3 changed files with 35 additions and 0 deletions
|
@ -161,6 +161,7 @@ public:
|
|||
// VOP1
|
||||
void V_MOV(const GcnInst& inst);
|
||||
void V_READFIRSTLANE_B32(const GcnInst& inst);
|
||||
void V_CVT_I32_F64(const GcnInst& inst);
|
||||
void V_CVT_F64_I32(const GcnInst& inst);
|
||||
void V_CVT_F32_I32(const GcnInst& inst);
|
||||
void V_CVT_F32_U32(const GcnInst& inst);
|
||||
|
@ -168,8 +169,11 @@ public:
|
|||
void V_CVT_I32_F32(const GcnInst& inst);
|
||||
void V_CVT_F16_F32(const GcnInst& inst);
|
||||
void V_CVT_F32_F16(const GcnInst& inst);
|
||||
void V_CVT_RPI_I32_F32(const GcnInst& inst);
|
||||
void V_CVT_FLR_I32_F32(const GcnInst& inst);
|
||||
void V_CVT_OFF_F32_I4(const GcnInst& inst);
|
||||
void V_CVT_F32_F64(const GcnInst& inst);
|
||||
void V_CVT_F64_F32(const GcnInst& inst);
|
||||
void V_CVT_F32_UBYTE(u32 index, const GcnInst& inst);
|
||||
void V_FRACT_F32(const GcnInst& inst);
|
||||
void V_TRUNC_F32(const GcnInst& inst);
|
||||
|
|
|
@ -99,6 +99,8 @@ void Translator::EmitVectorAlu(const GcnInst& inst) {
|
|||
return V_MOV(inst);
|
||||
case Opcode::V_READFIRSTLANE_B32:
|
||||
return V_READFIRSTLANE_B32(inst);
|
||||
case Opcode::V_CVT_I32_F64:
|
||||
return V_CVT_I32_F64(inst);
|
||||
case Opcode::V_CVT_F64_I32:
|
||||
return V_CVT_F64_I32(inst);
|
||||
case Opcode::V_CVT_F32_I32:
|
||||
|
@ -612,6 +614,11 @@ void Translator::V_MOV(const GcnInst& inst) {
|
|||
SetDst(inst.dst[0], GetSrc<IR::F32>(inst.src[0]));
|
||||
}
|
||||
|
||||
void Translator::V_CVT_I32_F64(const GcnInst& inst) {
|
||||
const IR::F64 src0{GetSrc64<IR::F64>(inst.src[0])};
|
||||
SetDst(inst.dst[0], ir.ConvertFToS(32, src0));
|
||||
}
|
||||
|
||||
void Translator::V_CVT_F64_I32(const GcnInst& inst) {
|
||||
const IR::U32 src0{GetSrc(inst.src[0])};
|
||||
SetDst64(inst.dst[0], ir.ConvertSToF(64, 32, src0));
|
||||
|
@ -649,6 +656,11 @@ void Translator::V_CVT_F32_F16(const GcnInst& inst) {
|
|||
SetDst(inst.dst[0], ir.FPConvert(32, ir.BitCast<IR::F16>(src0l)));
|
||||
}
|
||||
|
||||
void Translator::V_CVT_RPI_I32_F32(const GcnInst& inst) {
|
||||
const IR::F32 src0{GetSrc<IR::F32>(inst.src[0])};
|
||||
SetDst(inst.dst[0], ir.ConvertFToI(32, true, ir.FPFloor(ir.FPAdd(src0, ir.Imm32(0.5f)))));
|
||||
}
|
||||
|
||||
void Translator::V_CVT_FLR_I32_F32(const GcnInst& inst) {
|
||||
const IR::F32 src0{GetSrc<IR::F32>(inst.src[0])};
|
||||
SetDst(inst.dst[0], ir.ConvertFToI(32, true, ir.FPFloor(src0)));
|
||||
|
@ -663,6 +675,16 @@ void Translator::V_CVT_OFF_F32_I4(const GcnInst& inst) {
|
|||
SetDst(inst.dst[0], ir.Imm32(IntToFloat[src0.U32() & 0xF]));
|
||||
}
|
||||
|
||||
void Translator::V_CVT_F32_F64(const GcnInst& inst) {
|
||||
const IR::F64 src0{GetSrc64<IR::F64>(inst.src[0])};
|
||||
SetDst(inst.dst[0], ir.FPConvert(32, src0));
|
||||
}
|
||||
|
||||
void Translator::V_CVT_F64_F32(const GcnInst& inst) {
|
||||
const IR::F32 src0{GetSrc<IR::F32>(inst.src[0])};
|
||||
SetDst64(inst.dst[0], ir.FPConvert(64, src0));
|
||||
}
|
||||
|
||||
void Translator::V_CVT_F32_UBYTE(u32 index, const GcnInst& inst) {
|
||||
const IR::U32 src0{GetSrc(inst.src[0])};
|
||||
const IR::U32 byte = ir.BitFieldExtract(src0, ir.Imm32(8 * index), ir.Imm32(8));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue