shader_decode: Implement CSETP
This commit is contained in:
parent
7e13e8bfcb
commit
3f1136ac6f
|
@ -17,6 +17,8 @@ u32 ShaderIR::DecodePredicateSetPredicate(BasicBlock& bb, u32 pc) {
|
||||||
const Instruction instr = {program_code[pc]};
|
const Instruction instr = {program_code[pc]};
|
||||||
const auto opcode = OpCode::Decode(instr);
|
const auto opcode = OpCode::Decode(instr);
|
||||||
|
|
||||||
|
switch (opcode->get().GetId()) {
|
||||||
|
case OpCode::Id::PSETP: {
|
||||||
const Node op_a = GetPredicate(instr.psetp.pred12, instr.psetp.neg_pred12 != 0);
|
const Node op_a = GetPredicate(instr.psetp.pred12, instr.psetp.neg_pred12 != 0);
|
||||||
const Node op_b = GetPredicate(instr.psetp.pred29, instr.psetp.neg_pred29 != 0);
|
const Node op_b = GetPredicate(instr.psetp.pred29, instr.psetp.neg_pred29 != 0);
|
||||||
|
|
||||||
|
@ -32,10 +34,31 @@ u32 ShaderIR::DecodePredicateSetPredicate(BasicBlock& bb, u32 pc) {
|
||||||
SetPredicate(bb, instr.psetp.pred3, Operation(combiner, predicate, second_pred));
|
SetPredicate(bb, instr.psetp.pred3, Operation(combiner, predicate, second_pred));
|
||||||
|
|
||||||
if (instr.psetp.pred0 != static_cast<u64>(Pred::UnusedIndex)) {
|
if (instr.psetp.pred0 != static_cast<u64>(Pred::UnusedIndex)) {
|
||||||
// Set the secondary predicate to the result of !Predicate OP SecondPredicate, if enabled
|
// Set the secondary predicate to the result of !Predicate OP SecondPredicate, if
|
||||||
SetPredicate(
|
// enabled
|
||||||
bb, instr.psetp.pred0,
|
SetPredicate(bb, instr.psetp.pred0,
|
||||||
Operation(combiner, Operation(OperationCode::LogicalNegate, predicate), second_pred));
|
Operation(combiner, Operation(OperationCode::LogicalNegate, predicate),
|
||||||
|
second_pred));
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case OpCode::Id::CSETP: {
|
||||||
|
const Node pred = GetPredicate(instr.csetp.pred39, instr.csetp.neg_pred39 != 0);
|
||||||
|
const Node condition_code = GetConditionCode(instr.csetp.cc);
|
||||||
|
|
||||||
|
const OperationCode combiner = GetPredicateCombiner(instr.csetp.op);
|
||||||
|
|
||||||
|
if (instr.csetp.pred3 != static_cast<u64>(Pred::UnusedIndex)) {
|
||||||
|
SetPredicate(bb, instr.csetp.pred3, Operation(combiner, condition_code, pred));
|
||||||
|
}
|
||||||
|
if (instr.csetp.pred0 != static_cast<u64>(Pred::UnusedIndex)) {
|
||||||
|
const Node neg_cc = Operation(OperationCode::LogicalNegate, condition_code);
|
||||||
|
SetPredicate(bb, instr.csetp.pred0, Operation(combiner, neg_cc, pred));
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
default:
|
||||||
|
UNIMPLEMENTED_MSG("Unhandled predicate instruction: {}", opcode->get().GetName());
|
||||||
}
|
}
|
||||||
|
|
||||||
return pc;
|
return pc;
|
||||||
|
|
Reference in New Issue