Commit Graph
185 Commits
Author SHA1 Message Date
Ryan Houdek 7c9dca0de9 Fixes x86 JIT's RA for 16bit and 8bit registers
There were four independent arrays for each size of the RA.
Missed the 16bit and 8bit registers when removing a register.
This removes the redundant arrays and just uses one and transforms the
register to the right size depending on what the JIT wants
2020-04-18 11:31:56 -07:00
Stefanos Kornilios Mitsis Poiitidis 3edaf6e46e Merge pull request #120 from Sonicadvance1/cpuid_amd
Add a compile define for choosing CPUID manufacturer id
2020-04-18 04:12:49 +03:00
Stefanos Kornilios Mitsis Poiitidis 86b13a9ff7 Merge pull request #119 from Sonicadvance1/implement_movbe
Implements MOVBE
2020-04-18 04:11:43 +03:00
Stefanos Kornilios Mitsis Poiitidis 8642a64733 Merge pull request #118 from Sonicadvance1/remove_bmi
Removes BMI1/BMI2 CPUID bits
2020-04-18 04:10:37 +03:00
Stefanos Kornilios Mitsis Poiitidis 98c00ba6b1 Merge pull request #106 from Sonicadvance1/vector_op_ir
Move vector op RegisterSize and ElementSize values in to the header struct
2020-04-18 04:00:52 +03:00
Stefanos Kornilios Mitsis Poiitidis 2bb3543827 Merge pull request #102 from Sonicadvance1/ra_class_in_json
Minor IR cleanup
2020-04-18 03:57:46 +03:00
Ryan Houdek 8c8216584a Add a compile define for choosing CPUID manufacturer id
This can prove useful for applications that change some of their checks
depending what the vendor is
2020-04-15 11:08:32 -07:00
Ryan Houdek 46402e3244 Implements MOVBE in the OpDispatcher
This is pretty easy to implement. Kind of flies in the face of why the
instruction implementation exists (icache and frontend issue overhead
savings) but it is easy to implement.
2020-04-13 17:43:33 -07:00
Ryan Houdek 494e27c87d Fixes the MOVBE instruction table definitions
CRC32 was overlapping the MOVBE instruction with 66 prefix
2020-04-13 17:43:33 -07:00
Ryan Houdek faa596f735 Fixes 16bit REV in the JITs 2020-04-13 17:43:33 -07:00
Ryan Houdek d431223710 Removes BMI1/BMI2 CPUID bits
BMI1 would be straightforward to implement, BMI2 would take a bit more
effort because of the PDEP, PEXT, and BZHI instructions.

Bigger problem is that we don't support VEX three operand decoding in
the frontend at all.
Disable these until then
2020-04-13 17:34:01 -07:00
Stefanos Kornilios Mitsis Poiitidis bf130e28a5 Merge pull request #114 from Sonicadvance1/cvtsd2si
Implements CVTSD2SI
2020-04-13 09:57:13 +03:00
Ryan Houdek b79083e510 Implements CVTSD2SI 2020-04-12 17:46:42 -07:00
Ryan Houdek f74bca4fdb Fixes a race condition in WaitForIdle
This is something that TSAN caught was happening.
Grabs the thread creation mutex when checking for idle and extends the
sleep time for WaitForIdle to something that is still below unit test
run time
2020-04-12 17:31:11 -07:00
Ryan Houdek 8d7a512b16 Move vector op RegisterSize and ElementSize values in to the header struct
Sadly this is a fairly substantial change that can't be broken in to
something smaller.
The gist of the problem is that most of the vector ops declared their
own uint8_t RegisterSize and ElementSize variables in their structs.
This was initially done because there were assumptions elsewhere in the
source that sometimes mixed up the IROp member `Size` and `Elements` as
sometimes meaning `Size` elements and `Elements` number of elements.
Other times there was an assumption that `Size` was the full register
size and `Elements` was the number of elements inside that size.
ex: `Size`: 16, `Elements` 8 would sometimes be interpreted as i8v16 OR i128v8

These assumptions are now removed and we also save on average 16bits per
vector operation. This is a necessary evil first step for upcoming IR
considerations.
This should have zero change on runtime behaviour and unit tests confirm
that.
2020-04-11 22:17:48 -07:00
Ryan Houdek 2267bc0949 Minor IR cleanup
Changes the IR register class definition to exist in the JSON file.
Removes a couple of IR ops that were unused and weren't necessary.

Changes the CPUID IR op to the new paired op which improves perf ever so
slightly.
Changes RA class handling in the RA pass to pull directly from the new
generated helper routine until it hits a complex op

Still need RA constraints to remove extraneous moves that would crop up
2020-04-10 19:16:47 -07:00
Stefanos Kornilios Mitsis Poiitidis fec93ea573 Merge pull request #95 from FEX-Emu/skmp/block-cache-hotfix
BlockCache: Remove MemoryBase logic, check full address for match
2020-04-10 13:58:04 +03:00
Stefanos Kornilios Mitsis Poiitidis 937dbd811c BlockCache: Remove MemoryBase logic, check full address on aliased lookup 2020-04-10 13:50:09 +03:00
Ryan Houdek 30bce2468d Remove magic numbers for invalid register class definition
Consolidates usage of register class to the one that is defined in the
IR Json file.
Every magic number is replaced with InvalidClass and instead uses the
enums directly

Another bug fix is that the GetHostFlags IR ops was being declared as
using the flags register class, which isn't a real thing yet.
This would most likely have ended up with host flag usage being
scheduled to a GPR that was already scheduled and overwrite it.

Once this IR op ends up in host flags this will be changed as well
2020-04-10 01:02:29 -07:00
Ryan Houdek 2340e35c5b Fixes unordered flag FCMP result on AArch64 JIT
Was using the wrong enum
2020-04-10 01:02:20 -07:00
Ryan Houdek 17ebe1b77a Removes ShouldDump from CMPXCHG 2020-04-10 01:02:16 -07:00
Ryan Houdek 1ee5e87275 Fixes COMIS instruction table definitions
These instructions are always in xmm1, xmm2/mem format.
Incoming size needs to be 32bit or 64bit to be correct
2020-04-10 01:02:02 -07:00
Ryan Houdek 0766de70dd Merge pull request #89 from Sonicadvance1/wip_pair
CMPXCHG8B and CMPXCHG16B support
2020-04-10 00:56:26 -07:00
Ryan Houdek eed4ff8b69 Implements support for CMPXCHG8B and CMPXCHG16B
There are still some extraneous moves generated around the instruction,
but we need RA instruction constraints in order to safely (and cleanly)
remove them
2020-04-10 00:50:35 -07:00
Ryan Houdek 79255c2c12 Adds LLVM support for the new pair IR ops 2020-04-10 00:50:35 -07:00
Ryan Houdek f73d82353c Adds AArch64 support for the new pair IR ops 2020-04-10 00:50:35 -07:00
Stefanos Kornilios Mitsis Poiitidis 43ffdbdc2a Merge pull request #96 from Sonicadvance1/remove_aes
Remove CPUID flag saying that we support AES
2020-04-10 08:27:54 +03:00
Ryan Houdek fdf521ff46 Remove CPUID flag saying that we support AES
Node was found using it and we don't yet support it

All of the instructions directly map to AArch64 instructions aside from
AESKEYGENASSIST
2020-04-09 13:40:36 -07:00
Ryan Houdek 436d988168 Adds x86-64 support for the new pair IR ops 2020-04-08 00:18:36 -07:00
Ryan Houdek 980448bcf9 Adds interpreter support for the new pair IR ops 2020-04-08 00:17:54 -07:00
Ryan Houdek 88576f187c Fixes VBitCast IR op in the x86 JIT 2020-04-06 12:25:58 -07:00
Stefanos Kornilios Mitsis Poiitidis ba3ed680a8 Merge pull request #81 from Sonicadvance1/cvttps2dq
Implements CVTTPS2DQ x86 instruction
2020-04-06 18:12:15 +03:00
Stefanos Kornilios Mitsis Poiitidis e356c6d9b4 Merge pull request #84 from Sonicadvance1/fix_x86_abi
Fixes stack alignment in x86_64 JIT
2020-04-06 18:11:28 +03:00
Stefanos Kornilios Mitsis Poiitidis 4049b30e57 Merge pull request #76 from Sonicadvance1/syscall_cleanup
Syscall cleanup
2020-04-06 18:10:05 +03:00
Ryan Houdek 75ab768a8f Let the AArch64 JIT support unified memory address space 2020-04-05 14:00:22 -07:00
Ryan Houdek 8c2beba584 Cleans up x86-64 syscall implementation
Splits out to a jump table approach and loosely classifies and groups
the syscalls.

Also defines syscalls by number of arguments so it can be optimized
2020-04-05 14:00:13 -07:00
Ryan Houdek ea4476f687 Fixes stack alignment in x86_64 JIT
SystemV ABI mandates that the stack frame is aligned to 16bytes.
Once the call instruction happens then it is offset by 8bytes, so it is
on the callee's hands to realign the stack pointer to 16bytes.
We rely on the assumption that the stack is aligned to 16bytes for spill
slots and other function calls
2020-04-05 13:45:14 -07:00
Stefanos Kornilios Mitsis Poiitidis 227d6dc8c1 Merge pull request #83 from Sonicadvance1/unordered_ordered_compare
Implements unordered and ordered compare IR op
2020-04-05 13:02:44 +03:00
Stefanos Kornilios Mitsis Poiitidis 133aa604a2 Merge pull request #79 from Sonicadvance1/fix_sign_extend
Fixes bug in CBW op
2020-04-05 12:58:14 +03:00
Stefanos Kornilios Mitsis Poiitidis aa073d9190 Merge pull request #78 from Sonicadvance1/fix_x86_fcmp
Fixes FCMP in x86-64
2020-04-05 12:56:51 +03:00
Stefanos Kornilios Mitsis Poiitidis 234799ebde Merge pull request #77 from Sonicadvance1/fix_x86_vector_cvt
Use the correct float vector op for Vector_FToZS on x86
2020-04-05 12:55:11 +03:00
Ryan Houdek 840fee77b4 Implements unordered and ordered compare IR op
Implements the remaining missed comparisons for x86's compare ops
2020-04-04 23:19:22 -07:00
Ryan Houdek 6f2726379c Implements CVTTPS2DQ x86 instruction 2020-04-04 23:16:53 -07:00
Ryan Houdek 1e9badadd0 Fixes bug in CBW op 2020-04-04 23:11:35 -07:00
Ryan Houdek 85b75b3f12 Fixes FCMP in x86-64
We were overwriting flags while reading from them.
Keep the flags in AX with LAHF/SAHF to be easy
2020-04-04 23:10:53 -07:00
Ryan Houdek 05fa263653 Use the correct float vector op for Vector_FToZS on x86 2020-04-04 23:09:34 -07:00
Ryan Houdek 3e398a1b9b Pass Context to the OpDispatcher 2020-04-04 23:05:03 -07:00
Ryan Houdek fd4fb37056 Adds a new VMOV IR op
Both AArch64 and x86 don't have optimal paths to move <64bit FPRs to
another with ZEXT.
So this is optimal for 128bit and 64bit while smaller ops have have the
expected overhead when using it
2020-04-01 20:04:05 -07:00
Ryan Houdek f06d6c8274 Makes MMX PMULUDQ more efficent and fixes unit test on LLVM+AArch64 2020-04-01 20:04:05 -07:00
Ryan Houdek 1a5cf0b8a3 Implements 80 new MMX instructiosn in the OpDispatcher 2020-04-01 20:04:05 -07:00