Shader_IR: Implement ICMP.
This commit is contained in:
parent
b31880dc5e
commit
4b81d19a1a
2 changed files with 37 additions and 0 deletions
|
@ -138,6 +138,32 @@ u32 ShaderIR::DecodeArithmeticInteger(NodeBlock& bb, u32 pc) {
|
|||
SetRegister(bb, instr.gpr0, value);
|
||||
break;
|
||||
}
|
||||
case OpCode::Id::ICMP_CR:
|
||||
case OpCode::Id::ICMP_R:
|
||||
case OpCode::Id::ICMP_RC: {
|
||||
UNIMPLEMENTED_IF(instr.icmp.is_signed != 0);
|
||||
const Node zero = Immediate(0);
|
||||
|
||||
const auto [op_a, op_b] = [&]() -> std::tuple<Node, Node> {
|
||||
switch (opcode->get().GetId()) {
|
||||
case OpCode::Id::ICMP_CR:
|
||||
return {GetConstBuffer(instr.cbuf34.index, instr.cbuf34.offset),
|
||||
GetRegister(instr.gpr39)};
|
||||
case OpCode::Id::ICMP_R:
|
||||
return {GetRegister(instr.gpr20), GetRegister(instr.gpr39)};
|
||||
case OpCode::Id::ICMP_RC:
|
||||
return {GetRegister(instr.gpr39),
|
||||
GetConstBuffer(instr.cbuf34.index, instr.cbuf34.offset)};
|
||||
default:
|
||||
UNIMPLEMENTED();
|
||||
return {zero, zero};
|
||||
}
|
||||
}();
|
||||
const Node test = GetRegister(instr.gpr8);
|
||||
const Node comparison = GetPredicateComparisonInteger(instr.icmp.cond, false, test, zero);
|
||||
SetRegister(bb, instr.gpr0, Operation(OperationCode::Select, comparison, op_a, op_b));
|
||||
break;
|
||||
}
|
||||
case OpCode::Id::LOP_C:
|
||||
case OpCode::Id::LOP_R:
|
||||
case OpCode::Id::LOP_IMM: {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue