shader_recompiler: added `V_CMPX_GT_I32`

This commit is contained in:
psucien 2024-08-25 00:53:02 +02:00
parent 459083528a
commit 3e2ccabb5e
3 changed files with 21 additions and 1 deletions

View File

@ -22,6 +22,11 @@ struct Compare {
};
static IR::Condition MakeCondition(Opcode opcode) {
if (IsCmpxOpcode(opcode)) {
ASSERT(opcode == Opcode::V_CMPX_NE_U32);
return IR::Condition::Execnz;
}
switch (opcode) {
case Opcode::S_CBRANCH_SCC0:
return IR::Condition::Scc0;
@ -37,7 +42,6 @@ static IR::Condition MakeCondition(Opcode opcode) {
return IR::Condition::Execnz;
case Opcode::S_AND_SAVEEXEC_B64:
case Opcode::S_ANDN2_B64:
case Opcode::V_CMPX_NE_U32:
return IR::Condition::Execnz;
default:
return IR::Condition::True;

View File

@ -2194,6 +2194,20 @@ enum class Opcode : u32 {
EXP = 0 + (u32)OpcodeMap::OP_MAP_EXP,
};
static constexpr bool IsCmpxOpcode(Opcode op) {
if ((op >= Opcode::V_CMPX_F_F32 && op <= Opcode::V_CMPX_T_F32) ||
(op >= Opcode::V_CMPX_F_F64 && op <= Opcode::V_CMPX_T_F64) ||
(op >= Opcode::V_CMPSX_F_F32 && op <= Opcode::V_CMPSX_T_F32) ||
(op >= Opcode::V_CMPSX_F_F64 && op <= Opcode::V_CMPSX_T_F64) ||
(op >= Opcode::V_CMPX_F_I32 && op <= Opcode::V_CMPX_CLASS_F32) ||
(op >= Opcode::V_CMPX_F_I64 && op <= Opcode::V_CMPX_CLASS_F64) ||
(op >= Opcode::V_CMPX_F_U32 && op <= Opcode::V_CMPX_T_U32) ||
(op >= Opcode::V_CMPX_F_U64 && op <= Opcode::V_CMPX_T_U64)) {
return true;
}
return false;
}
enum class EncodingMask : u32 {
MASK_9bit = 0x000001FFULL << 23,
MASK_7bit = 0x0000007FULL << 25,

View File

@ -280,6 +280,8 @@ void Translator::EmitVectorAlu(const GcnInst& inst) {
return V_CMP_U32(ConditionOp::GT, true, false, inst);
case Opcode::V_CMP_LT_I32:
return V_CMP_U32(ConditionOp::LT, true, false, inst);
case Opcode::V_CMPX_GT_I32:
return V_CMP_U32(ConditionOp::GT, true, true, inst);
case Opcode::V_CMPX_LT_I32:
return V_CMP_U32(ConditionOp::LT, true, true, inst);
case Opcode::V_CMPX_F_U32: