Skip to content

Commit e82f9ea

Browse files
committed
[a64] Implement OPCODE_DID_SATURATE
This directly maps to the QC bit in the FPSR. Just have to make sure that the saturated instruction is the very last instruction(which is currently the case for stuff like VECTOR_ADD and such).
1 parent c1b59d7 commit e82f9ea

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/xenia/cpu/backend/a64/a64_sequences.cc

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1107,8 +1107,9 @@ EMITTER_ASSOCIATIVE_COMPARE_FLT_XX(UGE, Cond::HS); // setae
11071107
struct DID_SATURATE
11081108
: Sequence<DID_SATURATE, I<OPCODE_DID_SATURATE, I8Op, V128Op>> {
11091109
static void Emit(A64Emitter& e, const EmitArgType& i) {
1110-
// TODO(benvanik): implement saturation check (VECTOR_ADD, etc).
1111-
e.EOR(i.dest, i.dest, i.dest);
1110+
// Bit 27 in the FPSR is the QC bit
1111+
e.MRS(X0, SystemReg::FPSR);
1112+
e.UBFX(i.dest, W0, 27, 1);
11121113
}
11131114
};
11141115
EMITTER_OPCODE_TABLE(OPCODE_DID_SATURATE, DID_SATURATE);

0 commit comments

Comments
 (0)