shader: support V_CMPX_NGT_F16 SDWA

This commit is contained in:
nmzik
2026-08-27 04:25:11 +02:00
parent ae896d0bf6
commit 1ff580498c
4 changed files with 35 additions and 1 deletions
@@ -366,6 +366,7 @@ enum class Opcode {
V_CMPX_LE_F16,
V_CMPX_GT_F16,
V_CMPX_GE_F16,
V_CMPX_NGT_F16,
V_CMPX_NEQ_F16,
V_CMPX_NLT_F16,
V_CMPX_LT_I32,
@@ -242,7 +242,8 @@ constexpr VopcOpcodeInfo VOPC_OPCODE_LIST[] = {
{0xedu, Opcode::V_CMP_NEQ_F16}, {0xd9u, Opcode::V_CMPX_LT_F16},
{0xdau, Opcode::V_CMPX_EQ_F16}, {0xdbu, Opcode::V_CMPX_LE_F16},
{0xdcu, Opcode::V_CMPX_GT_F16}, {0xdeu, Opcode::V_CMPX_GE_F16},
{0xfdu, Opcode::V_CMPX_NEQ_F16}, {0xfeu, Opcode::V_CMPX_NLT_F16},
{0xfbu, Opcode::V_CMPX_NGT_F16}, {0xfdu, Opcode::V_CMPX_NEQ_F16},
{0xfeu, Opcode::V_CMPX_NLT_F16},
};
constexpr auto VOPC_OPS = Detail::MakeOpcodeTable<0x100>(VOPC_OPCODE_LIST);
@@ -874,6 +875,7 @@ bool IsVopcFloatCompareOpcode(Opcode opcode) {
case Opcode::V_CMPX_LE_F16:
case Opcode::V_CMPX_GT_F16:
case Opcode::V_CMPX_GE_F16:
case Opcode::V_CMPX_NGT_F16:
case Opcode::V_CMPX_NEQ_F16:
case Opcode::V_CMPX_NLT_F16:
case Opcode::V_CMP_CLASS_F32: return true;
@@ -1513,6 +1515,7 @@ bool IsVopcCompareExec(Opcode opcode) {
case Opcode::V_CMPX_LE_F16:
case Opcode::V_CMPX_GT_F16:
case Opcode::V_CMPX_GE_F16:
case Opcode::V_CMPX_NGT_F16:
case Opcode::V_CMPX_NEQ_F16:
case Opcode::V_CMPX_NLT_F16: return true;
default: return false;
@@ -256,6 +256,9 @@ bool Translator::EmitVector(const Decoder::Instruction& inst, std::string* error
case O::V_CMPX_LE_F16:
EmitFloatCompare(inst, IR::ValueOpcode::FPOrdLessThanEqual32, true, true);
return true;
case O::V_CMPX_NGT_F16:
EmitFloatCompare(inst, IR::ValueOpcode::FPUnordLessThanEqual32, true, true);
return true;
case O::V_CMP_NEQ_F16:
EmitFloatCompare(inst, IR::ValueOpcode::FPUnordNotEqual32, true, false);
return true;
+27
View File
@@ -15772,6 +15772,32 @@ TestCase VectorVopcCmpxGtU16CapturedSdwaExecMask() {
return test;
}
TestCase VectorVopcCmpxNgtF16CapturedSdwaExecMask() {
using O = ShaderOpcode;
std::vector<u32> code;
AppendVMovLiteral(&code, 31, 0x7e003c00u);
AppendVMovU32(&code, 3, 7);
AppendVMovU32(&code, 30, 0);
code.insert(code.end(), {0x7df700f9u, 0x8605001fu});
AppendBufferStoreDword(&code, 3, 30);
AppendVMovLiteral(&code, 31, 0x3c007e00u);
AppendVMovU32(&code, 3, 9);
AppendVMovU32(&code, 30, 4);
code.insert(code.end(), {0x7df700f9u, 0x8605001fu});
AppendBufferStoreDword(&code, 3, 30);
AppendEnd(&code);
TestCase test{"VectorVopcCmpxNgtF16CapturedSdwaExecMask",
code,
{0x11111111u, 0x22222222u},
{7, 0x22222222u},
{O::V_MOV_B32, O::V_CMPX_NGT_F16, O::BUFFER_STORE_DWORD,
O::S_ENDPGM}};
test.decoded_counts = {{"V_CMPX_NGT_F16", 2}};
return test;
}
TestCase VectorCompareInvertedMaskSelect() {
using O = ShaderOpcode;
@@ -20297,6 +20323,7 @@ std::vector<TestCase> MakeCases() {
AddCase(VectorVop3CmpxWritesExecMask);
AddCase(VectorVopcSdwaCmpxWritesExecMask);
AddCase(VectorVopcCmpxGtU16CapturedSdwaExecMask);
AddCase(VectorVopcCmpxNgtF16CapturedSdwaExecMask);
AddCase(VectorCompareInvertedMaskSelect);
AddCase(BranchSelect);
AddCase(SimpleLoop);