Commit Graph
52 Commits
Author SHA1 Message Date
Stefanos Kornilios Mitsis Poiitidis 93e372c7a4 IR/JITs: Inline Constants Implementation
Based on @phire's idea, Inline constants are constants that can be used as imms in instructions.

This
- Adds OP_INLINECONSTANT to represent them in the IR
- Modifies the ConstProp pass to transform OP_CONSTANT to OP_INLINECONSTANT based on per-platform heuristics
- Modifies the backends to use imms
- Supported opcodes: Add, Sub, Lsl, Lsr, Asr, Ror, Rol
2020-10-22 18:49:17 +03:00
Ryan Houdek 2c2d73839b Adds new AES IR ops 2020-09-30 00:05:55 -07:00
Ryan Houdek badc7f6562 Merge pull request #434 from Sonicadvance1/pmulhrsw
Implements SSSE3 PMULHRSW
2020-09-27 10:38:14 -07:00
Ryan Houdek 62158d4f8c Implements new VectorImm IR op 2020-09-26 15:30:20 -07:00
Ryan Houdek 83ac23be21 Implements new VTBL1 IR op
This perfectly matches the AArch64 variant and almost perfectly matches
x86's pshufb instruction
2020-09-26 12:59:34 -07:00
Stefanos Kornilios Mitsis Poiitidis 83db01f505 Merge pull request #429 from Sonicadvance1/psign
Implements support for SSSE3 PSIGN{B,W,D}
2020-09-26 20:20:06 +03:00
Stefanos Kornilios Mitsis Poiitidis de62124b95 Merge pull request #428 from Sonicadvance1/lzcnt
Implements ABM's LZCNT instruction
2020-09-26 20:11:47 +03:00
Ryan Houdek c6385093eb Adds a few new IR ops
VectorZero, useful to generate a zero vector without any previous
dependencies

and comparisons with zero which ARM supports faster versions of
2020-09-24 19:34:19 -07:00
Ryan Houdek 479505b069 Implements new CountLeadingZeroes IR op 2020-09-23 22:13:28 -07:00
Ryan Houdek 6c37a4dea6 Adds support for BCD x87 intructions 2020-09-22 23:56:03 -07:00
Ryan Houdek e4182108f6 Adds new IR ops for supporting host rounding mode conversion 2020-09-22 18:42:23 -07:00
Scott Mansell 5048753e37 Undo limitation of ASHR to 32/64bit
This should really be done later in a sperate PR.

 1. We don't have proper unit test coverage
 2. I still didn't get this right at time of removal
 3. I haven't done the jit changes to go along with this.
2020-09-17 16:26:41 +12:00
Scott Mansell 96603495ec OpcodeDispatcher: Remove BFEs from flag-gen calls 2020-09-17 14:59:50 +12:00
Ryan Houdek d424cf0eee Merge pull request #365 from phire/IR_iterators
Refactor the IR Interface to prevent "foot-shooting"
2020-09-16 11:24:44 -07:00
Ryan Houdek addcb824e2 Merge pull request #390 from FEX-Emu/skmp/add-pendatic-smc
SMC: Add --smc-full-checks, implement frontend, irint, irjit, unit test
2020-09-16 09:26:35 -07:00
Stefanos Kornilios Mitsis Poiitidis df3bdf361f SMC: Add --smc-full-checks, implement frontend, irint, irjit, unit test 2020-09-16 01:15:21 +03:00
Ryan Houdek 8878278402 Implements new EXTR IR op
This maps directly to AArch64's EXTR op.
Maps closely to x86's SHRD instruction
2020-09-13 17:28:09 -07:00
Ryan Houdek e9b74b0230 Initial Callback support
This interface is for native host code to be able to call back in to JIT
to execute guest code.
This is mainly for thunks but could be used for other purposes.
This can cross a couple ABI boundaries so one must be careful when
calling in to this
2020-09-11 15:48:51 -07:00
Scott Mansell e756b46189 Allow AllNodes to iterate in reverse
We replace Dummy with the old unused BeginBlock
and pointing it at block header like EndBlock
2020-09-11 21:50:30 +12:00
Scott Mansell 446b261f24 Iterator for blocks 2020-09-11 21:48:03 +12:00
Scott Mansell 65af0335dd DCSE: Refactor LoadContext slightly
* Use a single path for both truncated and non-truncated reads
  * Support more truncation types
  * Support truncating partial reads
2020-08-26 00:47:40 +12:00
Scott Mansell 5119a0bdb3 Elimiante ALU IR nodes that don't zero extend
Add and substract were the main culprits here.

We are trying to more towards a state where:
  * Every IR op can expect it isn't given extra bits
     on it's input
  * Every IR op never sets more bits than it's size
  * All unnessicary BFEs are never emitted
  * ARM doesn't have to implement special 8 and 16bit versions of IR ops
      All masking required to implement 8/16bit math on
      arm should be explictly generated from Opcode decoder
2020-08-26 00:47:40 +12:00
Scott Mansell 66aa9d1953 Formalise that store* ops should zext/truncate
The IR mostly worked this way already.
The one change I needed to make was in DCSE.

DCSE needs to add an explict truncate whenever an eliminated store was
doing an implict trunctate.
2020-08-26 00:47:01 +12:00
Scott Mansell 3989772a4f Remove OP_Zext
Zext has confusing sematics and does excatly the same thing as BFE

 * Repace with other ops (mostly BFE)
 * Allow specifying BFE size
2020-08-26 00:47:01 +12:00
Ryan Houdek b38983df35 Implements new TSO loadstore IR ops.
These need to end up being specially handled on non-x86 platforms
2020-08-12 15:24:00 -07:00
Ryan Houdek f3099647a2 Declares new sigret x86 instruction and IR op
We are rebranding an x86-64 illegal instruction near VIA's old ALTINST
instruction as an instruction to handle returning from guest signals
cleanly.

If this ever collides with a new x86-64 (unlikely) then we will need to
change the instruction.
This ends up looking similar to what we will do for thunk callbacks
2020-08-08 06:42:06 -07:00
Stefanos Kornilios Mitsis Poiitidis 8c8e6294b6 Thunks: ALTINST, OP_THUNK, basic infrastructure 2020-07-20 13:52:28 +03:00
Stefanos Kornilios Mitsis Poiitidis c19e8b3d2f Implement PAVGB/PAVGW 2020-07-04 19:30:53 +03:00
Ryan Houdek 2f1d7f70a2 Adds new IR ops that PSADBW will need 2020-05-30 18:49:09 -07:00
Ryan Houdek 3759cbdb65 Interpreter based x87 support!
This implements support for 130 of the 132 x87 ops as interpreter
fallbacks.

The two missing ops are the BCD load and BCD store instructions and can
be implemented another time.

This allows us to no longer have to rely on a libstdc++ modification to
handle their usage of long double. This instead works entirely through
using `long double` directly in the interpreter. Which will either use
real x87 on an x86 host. Or in the case of ARM devices, fall down
glibc's long double soft float path.

This doesn't necessarily need to be quick right now. It's more important
to have the compatibility improvement from this.
2020-05-28 14:47:43 -07:00
Stefanos Kornilios Mitsis Poiitidis 2fd8e617ff Merge pull request #207 from Sonicadvance1/interpreter_fallback
Adds support for interpreter fallback
2020-05-27 14:20:58 +03:00
Ryan Houdek 38ff936c81 Adds support for interpreter fallback
The IRHeader itself contains a flag for if a block should fallback to
the interpreter.
This is necessary for the case that an IR is loaded and the Frontend
object no longer has the data necessary to know if it should do an
interpreter fallback.
This is super useful for bisecting JIT versus Intepreter failures, and
also cases where falling back to intepreter for compatibility is a lot
more simple than wiring things through the JIT (ala x87)

This isn't currently utilized, but will be once x87 work lands
2020-05-26 19:08:18 -07:00
Ryan Houdek 5569894d81 Implements fence ops
These map directly to x86 fence instructions, which have equivalent ARM
versions as well.
2020-05-26 19:04:35 -07:00
Ryan Houdek 98d6feabae Marks IR ops that have side effects in the IR file 2020-05-25 17:53:57 -07:00
Ryan Houdek bb7e58b3f1 Adds more IR documentation 2020-05-08 18:40:21 -07:00
Ryan Houdek 54ee9cbe86 Adds predefined TypeDefinition types for common sizes 2020-05-07 17:40:29 -07:00
Ryan Houdek 0e4bd4e7b7 Significantly improves IR documentation in the JSON file
Doesn't cover 100% of the IR ops but it hits about half
2020-05-07 17:24:44 -07:00
Ryan Houdek ad467c5b30 Adds new vector float negate and float add horizontal IR ops 2020-04-25 17:55:37 -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
Ryan Houdek 74f61a00bc Adds invalid class definition through the IR definitions file 2020-04-10 01:02:11 -07:00
Ryan Houdek 4ed0f61ccc Makes sure FCMP IR op destination size is set to 4
Adds a description about its operation
2020-04-10 01:02:07 -07:00
Ryan Houdek 3bb0d06a36 Adds new paired reg IR ops 2020-04-08 00:17:12 -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
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 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 a8d4d0d3c3 Adds new IR ops
vector pairwise add
vector unsigned shift right with narrowing
vector unsigned and signed extend with lengthening from upper bits
vector unsigned and signed multiply with lengthening from upper bits
2020-03-27 20:56:56 -07:00
Ryan Houdek f89ef01578 Implements the COMISS instructions
These are fairly popular so not having them around is causing headaches.
We will really want these in the future to use the host register, btu
that is more time consuming than I want to dedicate to at the moment.

So the FCMP instruction must be told which flags to generate up front,
then it generates the flags in to a GPR which are then tracked and
pulled out with a specific IR op.

This can be augmented in the future to more easily RA the host flag
register
2020-03-21 22:52:46 -07:00
Ryan Houdek 4692a761b6 Implements two new IR Op codes
Extracts a vector element to a scalar value
Inserts a scalar element in to a vector
2020-03-17 13:49:47 -07:00
Ryan Houdek 79ffd11c1d Cleans up and renames the CVT ops
Fixes issue #14.

A lot of these were named in very confusing ways.
Makes them very explicit about what the operation is doing
2020-03-13 17:42:39 -07:00