Commit Graph
2917 Commits
Author SHA1 Message Date
Ryan Houdek 465395dede OpcodeDispatcher: Implement SLDT
Not 100% correct because the Linux kernel has some cheeky false data
return value when an LDT gets installed. But FEX can't really do it
properly today so whatever.
2026-10-22 15:29:16 -07:00
Ryan Houdek cbcb003425 HostFeatures: Make a stronger distinction between CPU features and Process features
We want to have two distinct control knobs here. CPU features that don't
change between Linux, Wow64, Arm64ec, and additional options that change
depending on the process environment.

This distinction was a /bit/ muddy where I added
`SupportsFaultFreeSynchronousFaults` to the wrong side of that. Make it
more distinct by logically splitting it out so that HostType, the
fault-free-faults, and added Is64BitMode all lives together.

This lets the DiskCache code which is hashing these variables look a bit
nicer and also correctly logically separate the two halves.
2026-10-21 16:34:29 -07:00
Ryan Houdek 89713ba3c0 Merge pull request #6053 from javelina-pkwy/fix/group1-0x82-alu
Decoder: Fix alias issue with 0x82 opcode
2026-10-21 16:14:35 -07:00
Justin Becker 7b909d31e2 OpcodeDispatcher: Handle 0x82 alias for 0x80 in x86 mode 2026-10-21 15:42:07 -07:00
Justin Becker eedb8be51a NIT: Clarify comment 2026-10-21 15:31:55 -07:00
Justin Becker 01b344b444 JIT: Slightly shorter path for EmitDivllu 2026-10-21 15:31:55 -07:00
Justin Becker 646c442b85 DiskCache: Bump version 2026-10-21 15:31:55 -07:00
Justin Becker 9f7913edb8 JIT: Inline 128 bit unsigned divide
Testing on X2 Elite suggests a ~4x speedup by this technique
2026-10-21 15:31:12 -07:00
Ryan Houdek 2ac75c26c8 CPUID: Add new Apple Silicon names 2026-10-21 12:56:06 -07:00
Ryan Houdek 407e78e69c InstcountCI: Update and add AVX_NE_CONVERT instructions 2026-10-20 18:21:29 -07:00
Ryan Houdek a98c5a3e38 FEXCore/CPUID: Expose AVX_NE_CONVERT 2026-10-20 17:29:04 -07:00
Ryan Houdek fd4c097628 AVX256: Implement AVX_NE_CONVERT
Doesn't require SVE_BF16, only BF16 because we split the operation even
on 256-bit.
2026-10-20 17:29:04 -07:00
Ryan Houdek 36d3bb6185 AVX128: Implement AVX_NE_CONVERT 2026-10-20 17:17:48 -07:00
Ryan Houdek c4f0ae7e55 X86Tables: Describe AVX_NE_CONVERT instructions 2026-10-20 17:17:47 -07:00
Ryan Houdek 8f927c9480 IR: Add support for BF16 conversion operations 2026-10-20 17:17:47 -07:00
Ryan Houdek 581e8d4f11 IR: Support movi 64-bit imm expansion
Explicit option to make it obvious.
2026-10-20 17:17:47 -07:00
LC fd8a601772 Merge pull request #6042 from Sonicadvance1/275
OpcodeDispatcher: Add undefined flags acid test
2026-10-20 12:27:42 -04:00
Ryan Houdek f256d97ddb FEXCore: Wire up support for SERIALIZE
Trivial instruction.
2026-10-19 14:11:06 -07:00
Ryan Houdek 651b94f435 OpcodeDispatcher: Add undefined flags acid test
Useful debug feature to make sure FEX returns consistent flag data for
instructions that have undefined flags. Just sets everything that is
undefined to zero always.

Manually walked through all the instructions in the architecture manual
to check for ones doing undefined flag setting, then glued the handler
on to the end.

Also fixes a comment that has incorrect information about undefined
flags.
2026-10-19 13:50:34 -07:00
Ryan Houdek 27cfd41bf9 FEXCore: Wire up the fault free synchronous fault handling
Changes the code generation on arm64ec so the version needs to bump.
2026-10-13 19:55:36 -07:00
Ryan Houdek 461b286a8a Dispatcher: Adds unused synchronous dispatch handler 2026-10-13 18:07:22 -07:00
Ryan Houdek b49837f0c3 DiskCache: Fixes a race condition on the data blob
Found this through introspection, only a real problem with -O0.
We were moving a fextl::vector in to a shared pointer so it can be long
living, this causes a change in ownership which was causing the
`BlobData` pointer to be stale. This was then passed to the work queue
to be consumed. In -O1 and above a std::move of a fextl::vector is a
proper move, but -O0 it turns in to a copy.

Easy fix is to just create the shared_ptr early and reference that, so
the pointer is long lived and no references become stale.
2026-10-12 15:57:06 -07:00
Ryan Houdek e9373bfaec Merge pull request #6011 from javelina-pkwy/perf/gather-all-ones
Peephole optimization for VPCMPEQD + VGATHERDPS
2026-10-07 09:13:24 -07:00
Justin Becker e638b8ef37 clang format 2026-10-06 10:59:36 -07:00
Justin Becker b2dffb5a8a InstCountCI: Bump DiskCache version 2026-10-05 15:17:58 -07:00
Justin Becker 5ec147109e Implement peephole optimization for vpcmpeqd + vgatherdps
This peephole removes unnecessary masking operations when the mask is
provably all 1s. This improves performance in GB7 'Asset Compression' by
about 2% with SVE and about 4% without SVE.
2026-10-05 15:17:58 -07:00
Ryan Houdek d2b6e371e2 Merge pull request #6008 from Sonicadvance1/265
DiskCache: Support FileID hash with gnu build-id
2026-10-05 11:26:53 -07:00
Ryan Houdek e3f402a38a DiskCache: Support FileID hash with gnu build-id
This doesn't fully fix #5912 but gets a step closer. Instead of just
hashing the filename, hash in the build-id as well when it exists.

This isn't all encompassing because the build-id may not exist in all
cases. Crypt Of the Necrodancer for example doesn't ship with the
build-id on their 64-bit build. Although their legacy 32-bit build had
it.

The build-id is always a hash, depending on tool it is either 64-bit or
160-bit in all the executables I found. Although it can be anything so
make sure to be flexible enough to support everything.
2026-10-02 17:38:09 -07:00
Justin Becker 079a69dde2 Style nits 2026-09-30 15:22:22 -07:00
Justin Becker c724742243 Bump diskcache version 2026-09-30 15:07:32 -07:00
Justin Becker 6788bcf264 x87: complete FXAM implementation 2026-09-30 15:07:32 -07:00
Ryan Houdek 47557a6184 FEXCore/DiskCache: Prune old entries automatically
Adds a config option to disable pruning if desired.

Had to change FEXCore::HostFeatures slightly to remove the HostType from
the Hash for caching, as we don't want the bucket to inadvertently
delete wow64,arm64ec,linux buckets when executing in the same namespace.

Minor changes to the DiskCache::Init code to handle returning two
values, moving the HostType to be a part of the "ProcessBucketHash"
instead of the "MachineBucketHash".

Then uses the directory walking function added in the previous commit to
find mismatched/old "MachineBucketHash" directories and remove them.
2026-09-24 15:21:48 -07:00
Pierre-Loup A. Griffais b37aae728f DiskCache: adjust key strategy
The base directory is now the machine bucket, which is everything that affects
codegen that you can ask FEX about offline: FEX compiler version, host features.

The DB files now carry a process bucket, which is everything else that can
affect codegen, on the user/process side: 32-bitness and config.

Both together are still the bucket hash that gets laced into every lookup key,
so we still won't load mismatching code because a file is in the wrong spot.
2026-09-24 00:08:11 -07:00
Justin Becker af8770005b Clang format 2026-09-22 12:53:05 -07:00
Justin Becker 0ddd46ba44 Bump DiskCacheVersion 2026-09-22 12:53:05 -07:00
Justin Becker e2f0cf41d8 More cleanup 2026-09-22 12:53:05 -07:00
Justin Becker 638329278c Inlined PCMPXSTRX
Improves performance for SSE4.2 String operations by ~10x by emitting inline ASM instead of jumping to a C++ helper.

Performance numbers from a simple microbenchmark vs the existing C++ implementation:
|               | Equal Any | Ranges | Equal Each | Equal Ordered |
|---------------|-----------|--------|------------|---------------|
| **pcmpestri** | 13.40×    | 9.71×  | 19.38×     | 14.07×        |
| **pcmpestrm** | 13.12×    | 9.54×  | 18.73×     | 13.80×        |
| **pcmpistri** | 11.75×    | 9.19×  | 17.63×     | 12.80×        |
| **pcmpistrm** | 11.39×    | 8.83×  | 16.31×     | 12.26×        |
2026-09-22 12:50:02 -07:00
LC 08f451d3bc Merge pull request #5980 from Plagman/plagman/maxrwsize_mr
DiskCache: configurable max file size
2026-09-22 11:10:40 -04:00
Pierre-Loup A. Griffais 83d8317dae DiskCache: configurable max file size 2026-09-22 00:05:10 -07:00
Ryan Houdek 4b418a81aa FEXCore: Have ThreadRemoveCodeEntry IR op jump to dispatcher
In order to reuse code buffers, when invalidating we will no longer be
able to invalidate code while inside the code we are invalidating.

Changes the IR operation to be a block ender itself and control jumping
to the new RIP. This way it can invalidate from the dispatcher and just
restart JIT execution.
2026-09-21 20:53:27 -07:00
Ryan Houdek 229151f878 FEXCore: Have the Syscall IR op jump to the dispatcher
Have it treated as a block terminator IR and instead of doing
syscall+exitfunction, just do syscall and jump in to the dispatcher.

This is necessary for code invalidation and reuse for code that is stuck
in long running syscalls. We'll need to do something similar for thunks
later, although the recursive nature of thunk+callback can make that a
little squirrely.
2026-09-21 14:46:34 -07:00
Ryan Houdek 5006e02498 Dispatcher: Fixes range check of InterruptFaultPage
This one wasn't updated and it's right at the limit of what it can
handle.
2026-09-21 14:45:56 -07:00
Ryan Houdek 9c871c51c9 Config: Add check to see if a config option is default
Either the option missing entirely or it's set to the default.
2026-09-20 14:58:48 -07:00
Ryan Houdek a0ba36eb1b SharedCodeBuffer: Skip VMA naming when JITSymbols are enabled
For some reason `perf top` prefers VMA names over perf symbols. So
disable them when any JIT symbol option is enabled. Breaks WTF tracking
for those buffers but because it's debug, we kind of have to.
2026-09-18 17:01:26 -07:00
Ryan Houdek 69a3da4f31 JITSymbols: Grab PID from the frontend
This is necessary to get JIT Symbols working under arm64ec/wow64
2026-09-18 17:00:17 -07:00
Ryan Houdek 1405755a31 Merge pull request #5968 from javelina-pkwy/feat/rdrand-fallback
Add software fallback for RDRAND/RDSEED
2026-09-18 13:33:09 -07:00
Pierre-Loup A. Griffais 7a82b07bfd DiskCache: optional memory buffer for faster lookups
May reserve a tiny area for small blocks in general, but will also be useful
for LuaJIT in anon-diskless mode.
2026-09-17 21:21:28 -07:00
Justin Becker 54b178d151 InstrCountCI: Bump disk cache version and regen 2026-09-17 11:25:52 -07:00
Justin Becker 26f0e5017f Fix Linux test failure, and formatting 2026-09-17 11:25:38 -07:00
Justin Becker c91c6efc87 Software fallback for RDRAND/RDSEED 2026-09-16 16:08:40 -07:00