Commit Graph
2708 Commits
Author SHA1 Message Date
Lioncash e95076f321 SignalDelegator: Migrate from std::unexpected() to std::terminate()
std::unexpected() was deprecated in C++11 and removed from the standard
in C++17. The default unexpected_handler would call std::terminate
anyway, and given we don't explicitly set a termination handler (as far
as I can tell), this retains identical behavior.
2021-06-09 20:59:20 -04:00
Lioncash e2a16c53b6 SignalDelegator: std::move std::function instances
std::function is allowed to allocate if the size of captures exceeds its
internal storage buffer. It's unlikely this is regularly going to be the
case, but we can allow for avoiding it where necessary.
2021-06-09 20:59:20 -04:00
Lioncash ee89b7a794 SignalDelegator: Leverage std::array
Allows for better detection of out of bounds accesses, as library
implementations generally allow conditional enabling of bounds checks
through preprocessor defines.
2021-06-09 20:59:20 -04:00
Ryan Houdek 5ac9b45528 Merge pull request #1059 from Sonicadvance1/fix_rounding
Fixes floating point conversion rounding bugs
2021-06-09 17:58:35 -07:00
Ryan Houdek 104fabc11f Merge pull request #1061 from lioncash/dump
IRParser: Make use of fmt where applicable
2021-06-08 07:10:10 -07:00
Ryan Houdek 15b2eb48e5 Disable rounding tests that only fail on Nvidia Xavier
Spooky rounding behaviour changes.
2021-06-08 06:54:11 -07:00
Ryan Houdek 62c446a5f9 Adds more unit tests for conversion operations 2021-06-08 06:54:11 -07:00
Ryan Houdek d57a034220 Fixes floating point conversion rounding bugs
When floats and doubles were converting to integers we weren't doing the correct transformation.
AArch64 provides direct ops for all four of the op types. So lets use them
  - f32 -> int64
  - f32 -> int32
  - f64 -> int64
  - f64 -> int32

Doesn't fully fix the case of overflow for AArch64 since overflow behaviour is different.
x86 returns 0x8000'0000 or 0x8000'0000'0000'0000 while AArch64 saturates to the maximum signed
integers. Can't work around that without checking overflow flags.

This does solve the typical case though.
Fixes audio problems in all FMod games.
2021-06-08 06:54:10 -07:00
Ryan Houdek 18fe049976 Extends a couple tests to ensure correct zext 2021-06-08 06:54:08 -07:00
Stefanos Kornilios Mitsis Poiitidis c6e09ddec5 Merge pull request #1046 from Sonicadvance1/more_sse41
Implements SSE4.1
2021-06-08 16:52:12 +03:00
Lioncash 05ee4c363b IRParser: Make use of fmt where applicable 2021-06-08 09:47:13 -04:00
Lioncash 6f2f4a9bc0 IRDumper: Make use of std::string_view over std::string where applicable
Same behavior, but with a smaller footprint (and the ability to be
constant data).
2021-06-08 09:36:59 -04:00
Ryan Houdek f699726409 Merge pull request #1060 from lioncash/byte
Utils: Add header for bit-related utilities
2021-06-08 05:40:05 -07:00
Lioncash a2b8fedba5 Utils: Add header for bit-related utilities
Places a layer of separation around the remaining compiler builtins.
2021-06-08 08:25:32 -04:00
Ryan Houdek ed2336c4f2 Disables some new sse4.1 gcc tests
The SSE 4.1 path of these tests seemingly work, it's the setup code before the
test that is broken.

We will need to find out why these are failing later
2021-06-08 02:44:40 -07:00
Ryan Houdek 748c3182a7 Fixes a typo in interpreter LSHL
This was causing uint32_t pointers to sign extend on 32-bit
New tests being run were hitting this when we were expecting them to zero extend
2021-06-08 02:44:40 -07:00
Ryan Houdek dfc454873c Moves AOTIR cache queue object to be inside the context
This fixes a crash that occurs due to mixing memory allocators.
This PR has tickled the allocation just enough that it broke
2021-06-08 02:44:40 -07:00
Ryan Houdek 1b06a06a4e Makes RoundType a unique type
This allows us to have the IRDumper have unique output for the type
2021-06-08 02:44:40 -07:00
Ryan Houdek b2ad8d73ac Adds unit test for FEX frontend decoder
This could potentially show up as being ch instead of edi.
Ensure we don't regress behaviour in the future
2021-06-08 02:44:39 -07:00
Ryan Houdek fec078f924 Fixes bug in interpreter VInsGPR
If the source GPR had data that was larger than the element it would overwrite other elements
Mask it correctly. This then matches behaviour with the other CPU backends
2021-06-08 02:44:39 -07:00
Ryan Houdek 38f1cded2c Implements unit tests for all the SSE4.1 instructions 2021-06-08 02:44:39 -07:00
Ryan Houdek a313253510 Enables SSE 4.1 in CPUID 2021-06-08 02:44:39 -07:00
Ryan Houdek 7b2b2a3d07 Implements all the remaining SSE4.1 instructions
Theres a fair number of these so I won't describe them all.

A couple highlights are MPSADBW and PHMINPOSUW.
These don't really match with AArch64 very well so their IR is a bit ugly.
2021-06-08 02:44:39 -07:00
Ryan Houdek 910a25b0ed Cleans up some vector ops that don't need dedicated functions
All of these ops can use the VectorALUOp and VectorUnaryOp templated functions
2021-06-08 02:44:39 -07:00
Ryan Houdek 75bae81331 Describe the remaining SSE4.1 ops in the tables 2021-06-08 02:44:39 -07:00
Ryan Houdek 02abbd216a Fixes an issue with debug printing vectors
We need to save the vector registers otherwise we will corrupt them.
Also in the case of printing a vector register, fall down the specialized path

Only useful when debugging
2021-06-08 02:44:39 -07:00
Ryan Houdek 8b7a7e91c9 Implements new IR ops
Adds VBic, VUMinV, VPopcount, VUnZip, VUnZip2, VDupElement, Vector_FToI, and VUABDL

We will need these for the SSE4.1 ops
2021-06-08 02:44:39 -07:00
Ryan Houdek 130f82a310 Merge pull request #1058 from lioncash/builtins
General: Place more compiler specifics into CompilerDefs.h
2021-06-07 05:31:07 -07:00
Lioncash 18e0f2636f General: Make use of the <bit> header where applicable
Since C++20, a bunch of bit manipulation functions finally have a common
interface, so lets make use of those
2021-06-07 08:16:51 -04:00
Lioncash 2b9029623e General: Abstract trapping behind a define
Provides a layer of separation from direct usages of compiler builtins.
2021-06-07 06:18:44 -04:00
Lioncash 6798afe91f General: Abstract unreachable behind a define
Provides a layer of separation from direct use of compiler built-ins.
2021-06-07 06:13:26 -04:00
Ryan Houdek 4fa8522d9e Merge pull request #1057 from lioncash/cprop
ConstProp: Separate out constituent chunks of const prop
2021-06-05 14:08:40 -07:00
Lioncash 58272ffc47 ConstProp: Separate out constituent chunks of const prop
Makes it nicer to find where each part of the pass is, and also see how
the pass is operating at a high level.
2021-06-05 16:52:03 -04:00
Ryan Houdek 4c275ecc08 Merge pull request #1056 from lioncash/compiler-defs
Utils: Add CompilerDefs.h for compiler-specifics
2021-06-05 12:57:51 -07:00
Ryan Houdek 294ec80aaf Merge pull request #1055 from lioncash/enum-cls
InternalThreadState: Make SignalEvent an enum class
2021-06-05 12:55:10 -07:00
Ryan Houdek e78d3d1a80 Merge pull request #1054 from lioncash/fmt-1
GdbServer: Migrate logging/string handling to fmt where applicable
2021-06-05 12:54:11 -07:00
Lioncash 262389f4ea ConstProp: Mark internal functions as static
Allows them to have internal linkage.
2021-06-05 15:25:35 -04:00
Lioncash 341b811642 Utils: Add CompilerDefs.h for compiler-specifics
Puts a layer of separation around compiler specifics (and also makes
them nicer to write).
2021-06-05 13:55:54 -04:00
Lioncash 32744d074e InternalThreadState: Make SignalEvent an enum class
Makes the enumeration strongly typed, preventing implicit conversions,
minimizing the potential chances of an invalid value being used by
accident.
2021-06-05 10:52:56 -04:00
Lioncash 5f91bbe28d GdbServer: Migrate code to fmt
Simplifies a bunch of string manipulation code.

Much nicer to grok than stream formatting in many cases.
2021-06-05 10:34:59 -04:00
Ryan Houdek 69035348f5 Merge pull request #1053 from lioncash/alias
CodeLoader: Add type aliases for mapper and unmapper functions
2021-06-05 06:16:27 -07:00
Lioncash be46db10e4 CodeLoader: Add virtual destructor
Ensures that no matter the context the hierarchy tree is used
polymorphically, that the deallocation will always be well-defined.

Gets rid of a potential bug vector.
2021-06-05 08:54:09 -04:00
Lioncash aa2c18d8cc CodeLoader: Add type aliases for mapper and unmapper functions
Centralizes the long types in one place for less reading.
2021-06-05 08:51:40 -04:00
Ryan Houdek 0a7f0a3441 Merge pull request #1052 from lioncash/fmtimpl
LogManager: Add fmt-capable logging functions
2021-06-05 05:46:56 -07:00
Lioncash ca2b04b309 LogManager: Add fmt-capable logging functions
Addresses #146 a little more by providing an interface to perform
fmt-compatible logging.

No more, will people on the project be tormented by classic printf
features like:

- Accidentally passing in a non-trivial type
- PRI macros
- Not being able to add support for custom types
- Mixing up signed/unsigned printf formatting specifiers accidentally

fmt-capable versions of the logging functions are named the same as the
existing functions, just with a "Fmt" or _FMT suffix (depending on
whether or not it's a function being used or a macro, respectively).
2021-06-05 08:29:48 -04:00
Ryan Houdek 376892793f Merge pull request #1051 from lioncash/view
IRParser: Convert array of std::string over to array of std::string_view
2021-06-05 04:05:28 -07:00
Stefanos Kornilios Mitsis Poiitidis 61f73cf0bf Merge pull request #1050 from Sonicadvance1/fix_semctl_shmctl
Fixes semctl and msgctl
2021-06-05 13:54:30 +03:00
Stefanos Kornilios Mitsis Poiitidis 9716a4f0cf Merge pull request #1049 from Sonicadvance1/drm_headers
Adds drm headers to an external repository
2021-06-05 13:53:16 +03:00
Lioncash 35f3777797 IRParser: Make use of insert_or_assign where applicable
Avoids some minor potential default constructions that get overwritten
immediately.
2021-06-05 06:43:17 -04:00
Lioncash d73b79470e IRParser: Mark parameter of CheckPrintError as a const reference
Def is only ever accessed to read members, so we can signify to the
reader to not expect it to be modified.
2021-06-05 06:43:16 -04:00