mirror of
https://github.com/FEX-Emu/FEX.git
synced 2026-10-26 22:01:47 +01:00
OpcodeDispatcher: Optimize EFLAG unpacking
Noticed this was slightly unoptimal. Resulting in a 18% code reduction in the case of of a simple four instruction test ASM case.
This commit is contained in:
1 parent
4e01452a65
commit
a2cbfccb3b
2 files changed
+2
-3
No files matched your search
@@ -1544,7 +1544,7 @@ void OpDispatchBuilder::SAHFOp(OpcodeArgs) {
|
||||
OrderedNode *Src = LoadGPRRegister(X86State::REG_RAX, 1, 8);
|
||||
|
||||
// Clear bits that aren't supposed to be set
|
||||
Src = _And(Src, _Constant(~0b101000));
|
||||
Src = _Andn(Src, _Constant(0b101000));
|
||||
|
||||
// Set the bit that is always set here
|
||||
Src = _Or(Src, _Constant(0b10));
|
||||
|
||||
@@ -52,10 +52,9 @@ void OpDispatchBuilder::SetPackedRFLAG(bool Lower8, OrderedNode *Src) {
|
||||
InvalidateDeferredFlags();
|
||||
}
|
||||
|
||||
auto OneConst = _Constant(1);
|
||||
for (size_t i = 0; i < NumFlags; ++i) {
|
||||
const auto FlagOffset = FlagOffsets[i];
|
||||
auto Tmp = _And(_Lshr(Src, _Constant(FlagOffset)), OneConst);
|
||||
auto Tmp = _Bfe(4, 1, FlagOffset, Src);
|
||||
SetRFLAG(Tmp, FlagOffset);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user