mirror of
https://github.com/FEX-Emu/FEX.git
synced 2026-10-12 18:00:40 +02:00
OpcodeDispatcher: Optimize CMC
Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
This commit is contained in:
1 parent
486f0ba1e3
commit
b6462ee854
2 files changed
+12
-17
No files matched your search
@@ -1559,18 +1559,23 @@ void OpDispatchBuilder::LAHFOp(OpcodeArgs) {
|
||||
}
|
||||
|
||||
void OpDispatchBuilder::FLAGControlOp(OpcodeArgs) {
|
||||
// Calculate flags early.
|
||||
CalculateDeferredFlags();
|
||||
|
||||
enum class OpType {
|
||||
Clear,
|
||||
Set,
|
||||
Complement,
|
||||
};
|
||||
OpType Type;
|
||||
uint64_t Flag;
|
||||
switch (Op->OP) {
|
||||
case 0xF5: // CMC
|
||||
Flag= FEXCore::X86State::RFLAG_CF_LOC;
|
||||
Type = OpType::Complement;
|
||||
break;
|
||||
case 0xF5: {// CMC
|
||||
uint32_t Bit = 1u << IndexNZCV(X86State::RFLAG_CF_LOC);
|
||||
SetNZCV(_Xor(OpSize::i32Bit, GetNZCV(), _Constant(Bit)));
|
||||
PossiblySetNZCVBits |= Bit;
|
||||
return;
|
||||
}
|
||||
|
||||
case 0xF8: // CLC
|
||||
Flag= FEXCore::X86State::RFLAG_CF_LOC;
|
||||
Type = OpType::Clear;
|
||||
@@ -1593,9 +1598,6 @@ void OpDispatchBuilder::FLAGControlOp(OpcodeArgs) {
|
||||
LOGMAN_THROW_AA_FMT(Flag != FEXCore::X86State::RFLAG_AF_LOC,
|
||||
"No AF complement instruction in x86");
|
||||
|
||||
// Calculate flags early.
|
||||
CalculateDeferredFlags();
|
||||
|
||||
OrderedNode *Result{};
|
||||
switch (Type) {
|
||||
case OpType::Clear: {
|
||||
@@ -1606,11 +1608,6 @@ void OpDispatchBuilder::FLAGControlOp(OpcodeArgs) {
|
||||
Result = _Constant(1);
|
||||
break;
|
||||
}
|
||||
case OpType::Complement: {
|
||||
auto RFLAG = GetRFLAG(Flag);
|
||||
Result = _Xor(OpSize::i64Bit, RFLAG, _Constant(1));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
SetRFLAG(Result, Flag);
|
||||
|
||||
Reference in new issue
Block a user