mirror of
https://github.com/FEX-Emu/FEX.git
synced 2026-10-14 06:00:41 +02:00
OpcodeDispatcher: optimize RDRAND on flagm
Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
This commit is contained in:
1 parent
d9c779289c
commit
91f4c54768
1 file changed
+11
-3
@@ -4925,12 +4925,20 @@ void OpDispatchBuilder::RDRANDOp(OpcodeArgs) {
|
||||
StoreResult(GPRClass, Op, _RDRAND(Reseed), -1);
|
||||
|
||||
// If the rng number is valid then NZCV is 0b0000, otherwise NZCV is 0b0100
|
||||
auto Invalid = GetRFLAG(X86State::RFLAG_ZF_RAW_LOC);
|
||||
auto CF_inv = GetRFLAG(X86State::RFLAG_ZF_RAW_LOC);
|
||||
|
||||
// OF, SF, ZF, AF, PF all zero. CF indicates if valid.
|
||||
ZeroNZCV();
|
||||
ZeroPF_AF();
|
||||
SetCFInverted(Invalid);
|
||||
|
||||
if (!CTX->HostFeatures.SupportsFlagM) {
|
||||
ZeroNZCV();
|
||||
SetCFInverted(CF_inv);
|
||||
} else {
|
||||
// Accelerated path. Invalid is 0 or 1, so set NZCV with a single rmif.
|
||||
HandleNZCVWrite(1u << 29 /* C */);
|
||||
_RmifNZCV(CF_inv, (64 - 1) /* rotate bit 0 into bit 1 = C */, 0xf);
|
||||
CFInverted = true;
|
||||
}
|
||||
}
|
||||
|
||||
void OpDispatchBuilder::BreakOp(OpcodeArgs, FEXCore::IR::BreakDefinition BreakDefinition) {
|
||||
|
||||
Reference in new issue
Block a user