Commit Graph
780 Commits
Author SHA1 Message Date
Stefanos Kornilios Mitsis Poiitidis 5fa5e49c58 IR: Add DeadGPRStoreElimination
This is based on the Flag Elimination pass, and is not optimal - but does eliminate quite a few dead stores.
2020-11-05 23:57:57 +02:00
Ryan Houdek 34625441cb Fixes FCOMPP and FUCOMPP
These two instructions pop the x87 stack twice which we didn't support
Repurposes the dead pop template argument to be a "pop twice".
Everything else falls down the table flag information comparison
2020-10-27 23:09:17 -07:00
Ryan Houdek d3d57d48a0 Fixes missing pop flag in x87 table
FCOMP didn't have POP set so it wans't popping the stack.
FFREEP also didn't have it, but it was handled explicitly in the
dispatcher
2020-10-27 23:08:17 -07:00
Ryan Houdek b8b99e7f85 Merge pull request #475 from Sonicadvance1/fix_32bit_x87
Fixes 32bit x87 usage
2020-10-25 11:21:50 -07:00
Ryan Houdek 7f4836b982 Fixes 32bit x87 usage
All of the ops that were relying on a 64bit memory offset were being
downgraded to 32bit.

Abuses the XMM_FLAGS option a bit to indicate that it shouldn't
downgrade the 64bit size flag. Which isn't an issue since all these
operations can't encode a register since modrm_r is used for table
decoding
2020-10-25 11:17:00 -07:00
Stefanos Kornilios Mitsis Poiitidis 82d9b28563 Merge pull request #476 from Sonicadvance1/initial_sse4_1
Adds some initial SSE 4.1 ops
2020-10-25 06:44:58 +02:00
Stefanos Kornilios Mitsis Poiitidis 13dc69987c Merge pull request #474 from Sonicadvance1/more_32bit_fixes_2
More 32bit related fixes
2020-10-25 06:40:27 +02:00
Ryan Houdek f6c2ee40d1 Adds some initial SSE 4.1 ops
These are being used unconditionally by the steam client (browser?) and
Minit.

Push out the initial implementation without unit tests just to get
further.
Would be nice to figure out why these are using these ops instead of
checking if it is supported.
2020-10-24 21:34:23 -07:00
Ryan Houdek c050e094da Adds four new 32bit push and pop ops
push and pop for segment registers and the push/pop all instructions
2020-10-22 19:10:28 -07:00
Ryan Houdek 9888141feb Some more table fixes 2020-10-22 19:10:28 -07:00
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
Stefanos Kornilios Mitsis Poiitidis ae3261df08 Merge pull request #472 from Sonicadvance1/fix_set_roundingmode_arm64
Fixes SetRoundingMode on AArch64 JIT
2020-10-21 12:03:15 +03:00
Ryan Houdek 5af576b554 Fixes SetRoundingMode on AArch64 JIT
Just needed to make sure to use the right register size
2020-10-21 01:31:08 -07:00
Ryan Houdek a42bdd9c2f Fixes 64bit ppoll
32bit ppoll is completely wrong here.
Will be fixed in upcoming PR
2020-10-20 18:33:46 -07:00
Ryan Houdek 5d730db054 Fixes MEM_OFFSET size override.
A couple of instructions were incorrectly marked as mem offset.
Fixes the mem offset literal size which is only modified with the
address size modifier.

Previously this was causing these instructions to narrow based on
operand size override incorrectly
2020-10-17 20:22:21 -07:00
Ryan Houdek b17b3a5721 Fixes literal constant size
It is the size in the bytes unless it is extended.
Once extended it should behave like the operand size
2020-10-17 20:21:17 -07:00
Ryan Houdek dd49a04809 Fixes RIP literal sign extending on 32bit
RIP Literal isn't actually RIP literal on 32bit, it is RIP absolute.
64bit treats the 32bit as a signed offset, while 32bit treats it as a
32bit unsigned offset
2020-10-17 20:19:50 -07:00
Ryan Houdek a8175ca891 Moves away from std::is_pod
This is deprecated in C++20 and will spam warnings all over the place
2020-10-17 16:02:55 -07:00
Stefanos Kornilios Mitsis Poiitidis 196578e0bf Merge pull request #460 from Sonicadvance1/more_32bit_syscall_shuffling
Shuffles more x86-64 specific syscalls to the correct folder
2020-10-16 09:53:26 +03:00
Stefanos Kornilios Mitsis Poiitidis 4111f795bd Merge pull request #458 from Sonicadvance1/fs_only_on_64bit
Only sets up FS on 64bit
2020-10-15 19:29:31 +03:00
Ryan Houdek db77d5f580 Shuffles more x86-64 specific syscalls to the correct folder 2020-10-13 16:56:09 -07:00
Ryan Houdek 471f41fa62 Changes CPU family reported by CPUID
Java VM uses this to determine if the CPU is new enough to be a 486 or
newer.

Also fixes some comment text.
Java VM scans all the leafs for hypervisor entries
Instead of adding directly which was causing our CPUID map to grow to
1500 entries.
Do the correct CPUID thing and return zeroes for non-understood leafs.
Gives us the same result since we cover almost all leaves with it anyway
2020-10-13 13:19:07 -07:00
Ryan Houdek 00849a6fee Only sets up FS on 64bit
Unnecessary when executing in 32bit since glibc will set up the TLS
2020-10-13 12:29:19 -07:00
Ryan Houdek 101ef4f42d 32Bit Opdispatcher fixes
Biggest thing is that it fixes segment register prefixing entirely.

Every op that supports segment prefixing now uses a helper to handle the
prefix
2020-10-09 23:33:10 -07:00
Ryan Houdek 9f84e3cead move with literal uses operating size mode for literal size 2020-10-09 23:33:10 -07:00
Ryan Houdek ea1bc55aef Ensures 64bit vector ops don't reduce to 32bit 2020-10-09 23:33:10 -07:00
Ryan Houdek b7759060ab Merge pull request #450 from Sonicadvance1/32bit_syscalls
Fixes 32bit syscalls
2020-10-07 11:16:27 -07:00
Ryan Houdek 910de79701 Merge pull request #452 from Sonicadvance1/32bit_move_memoffset
Fixes 32bit move with memoffset
2020-10-07 11:08:06 -07:00
Ryan Houdek d868a1b18d Fixes 32bit move with memoffset
The offset can not be 8bytes on 32bit
2020-10-06 19:57:15 -07:00
Ryan Houdek ba69f5c877 Removes 32bit assert in LEAVE
This is working correctly, just was untested
2020-10-06 19:10:45 -07:00
Ryan Houdek ee55204eaa Fixes 32bit syscalls
This doesn't change behaviour on the 64bit side of things.

Currently the 32bit syscall implementation is "best effort".
Anything that easily maps is passed through, and a few minor ones that
rely on iovec are handled.

Still around 80 syscalls that aren't punched through yet.

Few of these changes could have been split up so it's a bit of a
nightmare.
2020-10-06 18:46:26 -07:00
Ryan Houdek 31be022348 Fixes bad implementation in fallback x86 LZCNT
This was just wrong and the unit tests hadn't caught it
2020-10-04 16:13:03 -07:00
Ryan Houdek 4ff7046ddb Fixes bugs in PSHUFB
If bits were set in the reserved bits then the shuffle was incorrect
2020-10-04 16:10:03 -07:00
Ryan Houdek d9414ee8ad Implements SSE2 MOVNTPD
We apparently missed this one
2020-10-04 16:09:15 -07:00
Ryan Houdek 6287e769be Splits x86 JIT's IR handling over to a jump table
This is changes the behaviour to be exactly like the ARM64 side.
No behaviour change beyond that.
2020-09-30 13:35:00 -07:00
Stefanos Kornilios Mitsis Poiitidis c7615bf560 Merge pull request #447 from Sonicadvance1/aes_ext
Implements support for the AES instructions
2020-09-30 20:02:17 +03:00
Stefanos Kornilios Mitsis Poiitidis 56f47395db Merge pull request #446 from Sonicadvance1/umul_fix
Fixes unsigned multiply zext mechanics
2020-09-30 19:49:49 +03:00
Ryan Houdek 99a344ac62 Allows CPUID to only report AES support if the host supports it 2020-09-30 00:05:55 -07:00
Ryan Houdek 7e264533cf Implements the AES instructions in the Opcode dispatcher 2020-09-30 00:05:55 -07:00
Ryan Houdek aa8da5d70d Adds AES IR ops to the x86_64 JIT 2020-09-30 00:05:55 -07:00
Ryan Houdek 3e7407fa09 Adds AES IR ops to the Arm64 JIT 2020-09-30 00:05:55 -07:00
Ryan Houdek a26f5c0cc5 Adds AES IR ops to the interpreter 2020-09-30 00:05:55 -07:00
Ryan Houdek 2c2d73839b Adds new AES IR ops 2020-09-30 00:05:55 -07:00
Ryan Houdek 30b4a645af Adds the AES extensions to the tables 2020-09-29 23:47:53 -07:00
Ryan Houdek 10df2db7c9 Fixes a bug in the frontend decoder
This table doesn't listen to REX itself but just REX widening
Necessary to decode AESKeyGenAssist correctly
2020-09-29 23:46:09 -07:00
Ryan Houdek cf72f998f8 Add common location to see host features
Only necessary to pick up AES at the moment
2020-09-29 23:45:13 -07:00
Ryan Houdek 77511c5f92 Fixes unsigned multiply zext mechanics
32bit wasn't zexting correctly
2020-09-29 16:37:46 -07:00
Ryan Houdek 05d43945a6 Fixes a bug in 32bit signed multiply on x86_64 jit
We were storing the zexted result instead of the sexted result
2020-09-29 12:33:33 -07:00
Ryan Houdek 5c518dd96e Fixes flags calculation for signed multiply
Resulting high bits needed to be sexted to do the proper flags check
2020-09-29 12:33:33 -07:00
Stefanos Kornilios Mitsis Poiitidis 5248991a14 Merge pull request #440 from Sonicadvance1/fix_insextr_index
Ensures PEXTR and PINSR mask the element selection correctly
2020-09-29 11:22:09 +03:00