Ryan Houdek
d703f3ccee
Fixes zero register flag generation
...
Fixes 140976d322
Adds a unit test to ensure it keeps working.
2024-02-24 16:32:25 -08:00
Alyssa Rosenzweig
852e3c4e93
OpcodeDispatcher: fuse XADD
...
Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io >
2024-02-24 15:54:49 -04:00
Alyssa Rosenzweig
e86547bbcb
OpcodeDispatcher: fuse INC
...
Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io >
2024-02-24 15:54:49 -04:00
Alyssa Rosenzweig
883cca2e8f
OpcodeDispatcher: use AddWithFlags
...
give it the same treatment we just gave sub.
Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io >
2024-02-24 15:54:49 -04:00
Alyssa Rosenzweig
df5bdefb8a
OpcodeDispatcher: merge secondary ALU with primary ALU
...
It's the same, stop copypasting. This gets our flag and arithmetic opts (current
and future) applied to secondary ALU too.
Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io >
2024-02-24 15:54:49 -04:00
Alyssa Rosenzweig
3d1fb7701c
OpcodeDispatcher: optimize sub
...
Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io >
2024-02-24 15:54:49 -04:00
Alyssa Rosenzweig
140976d322
OpcodeDispatcher: prep primary ALU for better flags
...
Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io >
2024-02-24 15:54:49 -04:00
Alyssa Rosenzweig
9a11d3b1a2
OpcodeDispatcher: fuse NEG
...
Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io >
2024-02-24 15:54:49 -04:00
Alyssa Rosenzweig
96e652879f
OpcodeDispatcher: fuse DEC
...
Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io >
2024-02-24 15:54:49 -04:00
Alyssa Rosenzweig
c1d572951f
OpcodeDispatcher: drop unused GenerateFlags_SUB arg
...
Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io >
2024-02-24 15:54:49 -04:00
Alyssa Rosenzweig
2bcd285851
Merge pull request #3430 from Sonicadvance1/tsc_scale
...
Implement small TSC scaling
2024-02-21 13:16:27 -04:00
Ryan Houdek
b902b8edab
Implement small TSC scaling
...
Games engines are expecting >1Ghz cycle counters. Scale them to work
around the issue.
Resolves the excessive busy waiting in Unreal Engine 5 games.
2024-02-20 12:05:44 -08:00
Alyssa Rosenzweig
0503c89ff6
OpcodeDispatcher: use NZCV update helpers
...
Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io >
2024-02-19 14:12:54 -04:00
Alyssa Rosenzweig
68232366e4
OpcodeDispatcher: don't mask add/sub sources
...
not needed in the new approach
Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io >
2024-02-12 12:36:28 -04:00
Ryan Houdek
df3d6938ae
Merge pull request #3410 from alyssarosenzweig/opt/nzcv-pass-2
...
Add NZCV+PF/AF optimization pass
2024-02-10 05:03:12 -08:00
Alyssa Rosenzweig
ad7202e7d7
OpcodeDispatcher: optimize test -1
...
Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io >
2024-02-08 14:10:13 -04:00
Alyssa Rosenzweig
175a57dd27
OpcodeDispatcher: emit AndWithFlags directly for primary alu
...
Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io >
2024-02-06 14:22:28 -04:00
Alyssa Rosenzweig
e2ce60148c
OpcodeDispatcher: emit AndWithFlags directly for 2ndary alu
...
rely on opt pass to drop the flags.
Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io >
2024-02-06 14:22:28 -04:00
Alyssa Rosenzweig
99660129f3
IR: implement AndWithFlags for 8/16-bit
...
easier to deal with in the JIT
Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io >
2024-02-06 14:22:28 -04:00
Alyssa Rosenzweig
4331753ca0
Merge pull request #3408 from alyssarosenzweig/opt/tst
...
Optimize TST
2024-02-06 11:28:02 -04:00
Paulo Matos
fa8bcfd67a
Clean up access to possible nullptr
...
Patch suggested by @Sonicadvance1
2024-02-06 12:31:38 +00:00
Alyssa Rosenzweig
2e0cb2fbd4
OpcodeDispatcher: optimize TST
...
it's just an AndWithFlags setting the PF.
Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io >
2024-02-05 15:32:21 -04:00
Mai
6993f4fd8d
Merge pull request #3400 from Sonicadvance1/revert_runtime_longmode_switch
...
Revert #3303
2024-02-02 11:53:44 -05:00
Paulo Matos
4623544f69
Improve XCHG operations
...
Marking loads as allowing upper garbage simplifies some operations.
Update InstCountCI as well.
2024-02-02 08:16:13 +00:00
Ryan Houdek
da0e1b515a
Revert "OpcodeDispatcher: Initial support for runtime long-mode switch"
...
This reverts commit 9e5d7aa5fe .
2024-02-01 18:14:24 -08:00
Ryan Houdek
cec1814a09
Merge pull request #3384 from pmatos/CDQOp-Opt
...
Optimize CDQOp
2024-01-31 17:51:23 -08:00
Mai
4d49ac7c3d
Merge pull request #3387 from alyssarosenzweig/opt/rotates
...
Optimize rotates
2024-01-31 18:20:40 -05:00
Alyssa Rosenzweig
6d13d9fb56
Merge pull request #3395 from pmatos/StaticAnalysis
...
Code cleanup - mainly dead store removal; NFC
2024-01-31 17:24:48 -04:00
Mai
ae7dc250db
Merge pull request #3386 from alyssarosenzweig/opt/shift
...
Optimize shifts a bit
2024-01-31 14:11:58 -05:00
Paulo Matos
e4560ed0c8
Code cleanup - mainly dead store removal; NFC
...
scan-build found a few dead stores that can be easily cleaned-up
2024-01-31 08:35:55 +00:00
Alyssa Rosenzweig
f3eee8f305
OpcodeDispatcher: optimize bextr's length sanitize
...
reordering the operations saves an immediate move.
Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io >
2024-01-30 22:28:06 -04:00
Alyssa Rosenzweig
f66085f4a7
OpcodeDispatcher: optimize bextr's (1 << x) - 1
...
little algebraic trick I cribbed from llvm
Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io >
2024-01-30 22:28:06 -04:00
Alyssa Rosenzweig
f3175848b1
OpcodeDispatcher: use lzcnt flag gen for tzcnt
...
as far as flags go, they're identical: set ZF for zero output, set CF for output
= DestSize, undef the rest. merge the impls, so we get the optimized lzcnt impl
for tzcnt.
Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io >
2024-01-30 22:28:06 -04:00
Alyssa Rosenzweig
3dd597a591
OpcodeDispatcher: optimize lzcnt
...
Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io >
2024-01-30 22:28:06 -04:00
Alyssa Rosenzweig
fe88b904c9
OpcodeDispatcher: fix missing SF set with blsmsk
2024-01-30 22:28:06 -04:00
Alyssa Rosenzweig
338f12845d
OpcodeDispatcher: save a constant in shld
...
one weird trick
Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io >
2024-01-30 22:26:59 -04:00
Alyssa Rosenzweig
b3ae81f75f
OpcodeDispatcher: allow garbage on shld shift
...
Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io >
2024-01-30 22:26:59 -04:00
Alyssa Rosenzweig
c1a1c37980
OpcodeDispatcher: mark ideas to improve SHLD
...
a bit tricky right now.
Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io >
2024-01-30 22:26:59 -04:00
Alyssa Rosenzweig
fb6f850bb4
OpcodeDispatcher: remove rcl sub
...
Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io >
2024-01-30 22:22:57 -04:00
Alyssa Rosenzweig
b6d8749525
OpcodeDispatcher: remove select from rcl
...
Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io >
2024-01-30 22:22:57 -04:00
Alyssa Rosenzweig
d3f1397325
OpcodeDispatcher: eliminate constants in RCR
...
Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io >
2024-01-30 22:22:57 -04:00
Alyssa Rosenzweig
0a164428fa
OpcodeDispatcher: eliminate select in RCR
...
the nzcv clobber I actually came ofr
Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io >
2024-01-30 22:22:57 -04:00
Alyssa Rosenzweig
7496175100
OpcodeDispatcher: optimize 32-bit rcl/rcr
...
Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io >
2024-01-30 22:22:57 -04:00
Alyssa Rosenzweig
0616a9cef1
OpcodeDispatcher: eliminate move in rcr 1-bit
...
Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io >
2024-01-30 22:22:57 -04:00
Alyssa Rosenzweig
97f8775354
OpcodeDispatcher: optimize <32-bit rcr op1
...
Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io >
2024-01-30 22:22:57 -04:00
Alyssa Rosenzweig
c92099aa98
OpcodeDispatcher: fuse orlshl in rcr 1-bit
...
Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io >
2024-01-30 22:22:57 -04:00
Alyssa Rosenzweig
7c288b09f1
OpcodeDispatcher: rmif mask rcl smaller OF
...
Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io >
2024-01-30 22:22:57 -04:00
Alyssa Rosenzweig
680af7b1b0
OpcodeDispatcher: rcr op 8x1 cleanup
...
Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io >
2024-01-30 22:22:57 -04:00
Alyssa Rosenzweig
349bc9efab
OpcodeDispatcher: unify rcr op 1bit codepaths
...
get additional opt for <32-bit
Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io >
2024-01-30 22:22:57 -04:00
Alyssa Rosenzweig
ad5c3cb268
OpcodeDispatcher: rmif mask for OF in rcr smaller
...
Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io >
2024-01-30 22:22:57 -04:00