Commit Graph
1504 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
Stefanos Kornilios Mitsis Poiitidis 462cb39043 Merge pull request #478 from Sonicadvance1/x87_double_pop
Fixes FCOMPP, FUCOMPP, and FCOMP
2020-10-28 16:23:38 +02:00
Ryan Houdek 4b6914ad80 Implements unit tests to test the stack popping
Only tests the stack popping for FCOMP, FUCOMP, FCOMPP, and FUCOMPP.
2020-10-27 23:11:30 -07: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 4700edaac4 Merge pull request #465 from FEX-Emu/skmp/inline-const
IR/JIT: Inline constants
2020-10-22 19:33:13 -07:00
Ryan Houdek 9cf047317d Adds unit tests for 32bit segment register push and pop
This only tests to ensure we are pushing the correct amount data rather
than the segment registers being correct.

Bit difficult to test for anything other than null descriptor
2020-10-22 19:10:28 -07:00
Ryan Houdek 68f3a04f5b Adds unit tests for 32bit popa 2020-10-22 19:10:28 -07:00
Ryan Houdek d6c3518b74 Adds unit tests for 32bit pusha 2020-10-22 19:10:28 -07:00
Ryan Houdek 2a81468663 Adds a new test for push 8bit immediate
On 64bit this will operate as a 64bit or a 16bit push, with the
immediate being sign extended.

We were only previously testing the 64bit variant
2020-10-22 19:10:28 -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
Stefanos Kornilios Mitsis Poiitidis e8efb399f8 Merge pull request #471 from Sonicadvance1/static_sonicutils
Switches SonicUtils over to be a static library
2020-10-21 11:55:35 +03:00
Stefanos Kornilios Mitsis Poiitidis b6fa4cfe2f Merge pull request #470 from Sonicadvance1/fix_ppoll
Fixes 64bit ppoll
2020-10-21 11:54:40 +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 177cf1979f Switches SonicUtils over to be a static library
Removes installing since it doens't make sense anymore
2020-10-20 19:16:22 -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
Stefanos Kornilios Mitsis Poiitidis c31b32cb48 Merge pull request #463 from Sonicadvance1/more_32bit_fixes
More 32bit fixes
2020-10-18 11:44:59 +03:00
Ryan Houdek 7f8c2eef25 Adds 32bit call unit tests
Specifically written to test sign extension on the offset
2020-10-17 20:29:19 -07:00
Ryan Houdek 19f29c14a7 Adds 32bit move offset unit tests 2020-10-17 20:27:24 -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 6741b9d23f Fixes Unit Test loader offset
This was causing 32bit unit tests to load in to high 64bits.
Loads at offset constant 0x1'0000 so we always know where the code is
loaded
2020-10-17 20:17:45 -07:00
Ryan Houdek 8d3a4d58a9 Merge pull request #462 from Sonicadvance1/enable_cpp20
Enables C++20 feature level
2020-10-17 16:20:03 -07:00
Ryan Houdek 551f6b49cd Enables C++20 feature level
There are a few nice features in C++20 that can make our life easier.
This isn't requiring the full C++20 suite of features, but instead
should allow us to start bringing in features that were at least in
Clang 10.

LLVM 11 came out yesterday (2020-10-12) so it would be a shame to have
that as a minimum requirement.
2020-10-17 16:03:12 -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
Ryan Houdek f1861b0bd4 Merge pull request #459 from Sonicadvance1/32Bit_ELFLoader_improvements
Fixes 32bit ELF Loading
2020-10-17 15:59:50 -07:00
Stefanos Kornilios Mitsis Poiitidis c10f534122 Merge pull request #461 from Sonicadvance1/support_iwyu
Adds support for cmake IWYU option
2020-10-16 09:54:08 +03: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
Stefanos Kornilios Mitsis Poiitidis bd476bb8ea Merge pull request #457 from Sonicadvance1/cpu_family
Changes CPU family reported by CPUID
2020-10-15 19:28:49 +03:00
Ryan Houdek 4adadaba6b Adds support for cmake IWYU option
Only adds the option to enable the Include-What-You-Use program.
This will be useful for cleaning up includes
2020-10-13 17:39:52 -07:00
Ryan Houdek db77d5f580 Shuffles more x86-64 specific syscalls to the correct folder 2020-10-13 16:56:09 -07:00
Ryan Houdek 7a62fad444 Fixes 32bit ELF Loading
This requires some changes to how the ELF memory bases are calculated
and which auxp variables are passed in
2020-10-13 15:46:27 -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
Stefanos Kornilios Mitsis Poiitidis c2f6534084 Merge pull request #456 from Sonicadvance1/segment_registers
32bit and Segment register fixes
2020-10-10 19:15:45 +03: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 02d029877c Adds segment register flags mask 2020-10-09 23:33:07 -07:00
Ryan Houdek b7759060ab Merge pull request #450 from Sonicadvance1/32bit_syscalls
Fixes 32bit syscalls
2020-10-07 11:16:27 -07:00