Alyssa Rosenzweig
6864d48dcf
OpcodeDispatcher: optimize cdq
...
prereq to optimizing sign-ext+ldiv in a reasonable way.
Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io >
2025-06-03 15:00:06 -04:00
Alyssa Rosenzweig
06299cca4b
OpcodeDispatcher: optimize out Bfi for storereg
...
Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io >
2025-06-02 14:15:51 -04:00
Alyssa Rosenzweig
af5aaab38b
OpcodeDispatcher: optimize a few ALU-with-constant ops
...
instead of relying on ConstProp for this.
Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io >
2025-06-02 14:15:51 -04:00
Alyssa Rosenzweig
a9eb1bd4e6
OpcodeDispatcher: don't generate pointless Bfe for moves
...
Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io >
2025-06-02 14:15:51 -04:00
Alyssa Rosenzweig
83ef2da95f
OpcodeDispatcher: avoid zero shift in SHLD
...
Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io >
2025-06-02 14:15:51 -04:00
Alyssa Rosenzweig
ba13ccadb8
OpcodeDispatcher: use ArithRef for 8/16-bit imul
...
Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io >
2025-06-02 14:15:51 -04:00
Alyssa Rosenzweig
4a2dee873d
OpcodeDispatcher: use ArithRef for small rotates
...
Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io >
2025-06-02 14:15:51 -04:00
Alyssa Rosenzweig
0d235d63d0
OpcodeDispatcher: use ArithRef for bit tests
...
Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io >
2025-06-02 14:15:51 -04:00
Alyssa Rosenzweig
820d5c1447
OpcodeDispatcher: use ArithRef for rotates
...
Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io >
2025-06-02 14:15:51 -04:00
Alyssa Rosenzweig
bf3a1839a2
OpcodeDispatcher: transform DF ourselves
...
Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io >
2025-06-02 14:15:51 -04:00
Alyssa Rosenzweig
0fbe69ebcf
OpcodeDispatcher: optimize xor-with-self flags
...
Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io >
2025-05-28 13:53:38 -04:00
Alyssa Rosenzweig
3fbc8204b7
OpcodeDispatcher: clean up logical flags
...
Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io >
2025-05-28 13:28:31 -04:00
Alyssa Rosenzweig
0e67f30103
OpcodeDispatcher: make Push do the right thing and use it
...
this both optimizes and bug-fixes pusha while deleting a snotton of code.
Closes: https://github.com/FEX-Emu/FEX/issues/4589
Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io >
2025-05-26 15:52:23 -04:00
Alyssa Rosenzweig
a01e29ac99
IR: extend the IR header with RA info
...
Beyond the actual registers allocated, there are two pieces of sideband data we
store in the RAData object:
* # of spill slots (explicitly)
* whether RA has run (implicitly by the existence of RAData)
We want to get rid of RAData, so we'll move these to the header.
Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io >
2025-05-19 13:42:59 -04:00
Ryan Houdek
00f8181c3a
OpcodeDispatcher: Fix CPUID being a instruction fence
...
It is common practice for games to use CPUID as an instruction barrier
for various reasons. Ensure that we respect this by adding support for
an instruction barrier.
2025-04-15 15:42:43 -07:00
Ryan Houdek
60565cc2ef
OpcodeDispatcher: Implement support for self-synchronizing cycle counter
...
FEAT_ECV added a new synchronizing cycle counter instruction that
restrict speculation across the cycle counter access. Because it
restricts speculation, it effectively acts like an isb and load dsb.
Luckily for us, this actually matches behaviour for what rdtscp does, so
we can take advantage of it if the host supports FEAT_ECV.
2025-04-15 15:42:43 -07:00
Ryan Houdek
0ca34d11ad
Merge pull request #4454 from alyssarosenzweig/silly-nop
...
Fix 66 90 decoding to a nop
2025-03-28 14:50:02 -07:00
Alyssa Rosenzweig
3a2ca41724
OpcodeDispatcher: handle 66 90 as a NOP
...
Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io >
2025-03-28 13:03:34 -04:00
Lioncache
54dbb9f248
OpcodeDispatcher: Fix potential for uninitialized value use in RCRSmallerOp()
...
If Src isn't a constant, then no value is actually assigned to SrcConst, so this
can result in uninitialized arithmetic being performed
2025-03-28 04:45:40 -04:00
Ryan Houdek
8f9d818368
OpcodeDispathcer: static analysis warnings
2025-03-27 04:26:40 -07:00
Ryan Houdek
d48413cbec
Merge pull request #4426 from alyssarosenzweig/opt/shld-improvements
...
Drop some masking in shld
2025-03-24 19:24:51 -07:00
Alyssa Rosenzweig
b86cbda03d
OpcodeDispatcher: drop useless mask in trivial cmpxchg
...
hit by upcoming opt pass, but we don't want to depend on that pass for that.
Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io >
2025-03-24 16:17:04 -04:00
Alyssa Rosenzweig
e26b9b12fa
OpcodeDispatcher: drop useless zext in shld
...
this gets deleted by an upcoming opt pass, but we shouldn't be depending on
the opt pass for it!
Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io >
2025-03-24 16:00:24 -04:00
Ryan Houdek
ab7f6484cf
Merge pull request #4414 from pmatos/AddrMode-DeusEx
...
Fix address modes calculation on 32bit guests
2025-03-20 13:21:53 -07:00
Paulo Matos
b18f148575
Abstract AddressMode into its own header
...
Also refactor usage of utility functions into x87 Stack Optimization Pass.
2025-03-20 11:41:26 +01:00
Alyssa Rosenzweig
61d2a09827
OpcodeDispatcher: fix BT flags
...
ZF needs to be preserved.
the new code is the same instr count on flagm although probably an extra uop.
the inst count regression is on flagm, but we can't tolerate broken behaviour.
Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io >
2025-03-18 15:26:47 -04:00
Paulo Matos
64020e8828
Simplify by merging FSTF64 with FST
2025-03-18 15:54:54 +01:00
Ryan Houdek
b0b41d00ee
Various: More static analysis warnings cleanup
...
NFC
2025-03-12 17:27:41 -07:00
Ryan Houdek
a37d6a3841
JIT: Optimize CAS
...
Hey kid, want to see a sick trick?
Finally optimal codegen for 64-bit cmpxchg.
2025-03-07 14:24:45 -08:00
Ryan Houdek
2bf87ff40f
Various: Removes warnings about uninitialized variables
...
NFC. These wouldn't even occur in practice.
2025-03-04 19:59:26 -08:00
Billy Laws
cdae654fe4
FEXCore: Somewhat implement LSL
...
Emulate by always returning failure, this deviates from both Linux
and Windows but shouldn't be depended on by anything.
2025-02-27 23:45:14 +00:00
Billy Laws
a506c84bc7
FEXCore: Implement SIDT
2025-02-27 23:45:14 +00:00
Ryan Houdek
5b4fd590d1
OpcodeDispatcher: Use offset for LRCPC2 more frequently
...
We were missing small offset immediate encoded LRCPC2 pretty much
always.
This fixes that. Finishes up what #4216 started.
2025-02-10 10:38:39 -08:00
Billy Laws
40662f947f
OpcodeDispatcher: Only set mark _Break as setting RIP in the non-MB case
...
If we're starting a new block here then the newly started block won't have
set RIP and it is erroneous to set it.
2025-02-06 00:01:40 +00:00
Paulo Matos
0bccb1ece5
Ensure predicate cache is reset when control flow leaves block
...
Whenever the control float leaves the block, it might clobber the
predicate register so we reset the cache whenever that happens.
Fixes #4264
2025-01-27 20:12:43 +01:00
Tony Wasserka
e54b9237c6
Drop use of assume-asserting logging macros
2025-01-21 12:01:33 +01:00
Paulo Matos
cbda688e29
Revert "Cache predicate register generation from pattern"
...
This reverts commit 72a4063651 .
Caused #4264
2025-01-10 12:52:11 +01:00
Ryan Houdek
5daf007b6a
OpcodeDispatcher: FEX_UNREACHABLE in programming error case
...
Coverity scan
2025-01-03 10:34:22 -08:00
Ryan Houdek
12dc16780f
OpcodeDispatcher: Fixes FEX's H0F3A table handling of REX.W
...
Most of this table ignores REX.W, but two encodings change behaviour
based on REX.W. These two encodings are PEXTRD/PEXTRQ and PINSRD/PINSRQ.
For every other instruction encoding, they will ignore REX.W, but FEX
was requiring that they didn't have REX.W encoding. I had special cased
this in the past by adding PALIGNR, but that didn't handle any of the
other instructions.
We can't just handle REX.W in the OpcodeDispatcher and remove the two
special cased instructions because these vector operations also interact
with instruction prefix 0x66 which changes the operating size to 16bit
with regular instructions.
So instead just generate all listings of instructions with REX.W being
zero and one and install handlers in all cases.
2025-01-01 08:22:19 -08:00
Ryan Houdek
d2f86e49f7
Merge pull request #4237 from bylaws/fpfix
...
Fix float->int conversion overflow behaviour
2024-12-31 16:00:20 -08:00
Billy Laws
9bdb1f4306
OpcodeDispatcher: Make narrowing implicit for F64->I32 conversions
...
This is always used, removing it avoids needing to handle unused codepaths.
2024-12-30 00:36:17 +00:00
Billy Laws
ae4b7135d5
OpcodeDispatcher: Share AVX F2I/I2F code for 256-bit SVE
2024-12-30 00:29:31 +00:00
Ryan Houdek
bb10f25808
OpcodeDispatcher: Minor division improvement
...
No need to extract the subregisters out before operating on them since
the long division and long remainder IR operations correctly zero/sign
extend the incoming sources as necessary. Saves a couple of
instructions.
2024-12-20 13:20:52 -08:00
Billy Laws
b51fa497c5
OpcodeDispatcher: Mask TF for pop ss instructions
2024-12-10 15:20:47 +00:00
Paulo Matos
72a4063651
Cache predicate register generation from pattern
2024-12-06 10:15:38 +01:00
Paulo Matos
1d3ce30e50
Generate SVE for 80bit load/stores when possible
...
Fixes #4166 .
2024-12-06 10:15:29 +01:00
Ryan Houdek
0123946ed1
FEXCore: Removes GetGPRSize and convert all uses to GetGPROpSize
...
Only a few remaining uses left, easy enough to convert. This finally
switches the final few uses over.
NFC
2024-12-01 05:38:09 -08:00
LC
2e7fc60dbf
Merge pull request #4169 from Sonicadvance1/x87_loadstore_tests
...
unittests/ASM: Fixes x87 80-bit loads on the edge of page boundaries.
2024-11-30 10:43:10 -05:00
Alyssa Rosenzweig
d19473160d
OpcodeDispatcher: drop InvalidateDeferredFlags
...
it is now useless.
Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io >
2024-11-26 09:02:01 -05:00
Alyssa Rosenzweig
aeb2c98cbf
OpcodeDispatcher: drop PossiblySetNZCV
...
this is a pain to track and, it turns out, buys us virtually nothing on flagm
systems. rip it out.
this fixes a bug with failing to set in all the right places.
on non-flagm systems there's a slight instcountci impact, but that is mostly
mitigated by the earlier patches in the series. so overall a wash there but
worth it for making the codebase easier
to reason about.
Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io >
2024-11-26 08:59:19 -05:00