52 Commits

Author SHA1 Message Date
Lioncache
95393b07fb OpcodeDispatcher: Share MOVHPD implementation with MOVHPS
These instructions essentially have the same behavior. This also allows
us to remove the only used instance of FLAGS_SF_HIGH_XMM_REG, which,
given that we now support AVX, has ambiguous use.

While we're at it, we can expand the tests to make use of the store to
memory variant.

Also removes an erroneous copy-pasted comment about ZEXTing. This is
from the MOVQ implementation function. MOVHPS/MOVHPD don't do any
ZEXTing, they either store to memory or insert into a register.
2023-02-23 14:07:22 -05:00
Ryan Houdek
edad24479b unittests: Support skipping unit tests based on host feature support
For these unit tests we no longer need to put them in the disabled tests
file. Instead it will be skipped if the host doesn't support the feature
required.
2022-08-14 20:04:26 -07:00
Ryan Houdek
13b14b857b unittests: Fixes known failures
These were just incorrect results and I had failed to fix them.
2021-12-07 22:06:36 -08:00
Tony Wasserka
68587cd02c unittests/ASM: Drop OP_THUNK test
This test doesn't increase coverage significantly, since OP_THUNK is called
with an invalid library name. An ideal test should verify that thunk symbols
are loaded properly, whereas currently it's only ensured the opcode 0xF 0x3F
is recognized by FEX at all. That's better than nothing, but a regression
here would likely show up in other tests anyway.
2021-11-30 17:39:01 +01:00
Ryan Houdek
59a4481e5b unittests: Adds explicit 16bit, 32bit, 64bit unaligned unit tests 2021-07-10 23:40:18 -07:00
Ryan Houdek
31a672b1d5 unittests: Adds explicit 128bit vector unaligned load test 2021-07-10 23:39:04 -07:00
Ryan Houdek
b7b9d4089f unittests: Adds more imul unit tests for flags 2021-07-03 21:48:18 -07:00
Ryan Houdek
62c446a5f9 Adds more unit tests for conversion operations 2021-06-08 06:54:11 -07:00
Ryan Houdek
4dc2cf2b32 Adds more cmpxchg <reg>, <reg> unit tests
This will catch the previous fix
2021-03-10 17:47:54 -08:00
Stefanos Kornilios Mitsis Poiitidis
aecea294d5
Merge pull request #792 from Sonicadvance1/implemented_unaligned_memory_ops
Implements unaligned atomic memory ops for ARMv8.1+
2021-02-26 12:50:06 +02:00
Ryan Houdek
ebac071ae1 Adds cmpxchg to register zext and flags unit test 2021-02-23 23:22:24 -08:00
Ryan Houdek
68db163efc Adds cmpxchg to memory zext and flag unit test 2021-02-23 23:22:00 -08:00
Ryan Houdek
55ddc5b6e4 Adds unit tests to ensure cmpxchg flag correctness 2021-02-23 22:02:39 -08:00
Stefanos Kornilios Mitsis Poiitidis
56d10dcbbb IR: Make OP_THUNK use an inline sha256 hash of the thunk name, update thunk scripts 2021-02-23 12:08:57 +02:00
Ryan Houdek
8a39f4b25c Implements BTC, BTR, BTS atomic unit tests
This just takes the regular non-atomic unit tests and changes them to
have lock prefixes.
These are all handled as byte sized atomics so there aren't any
alignment problems.
2021-02-22 22:29:31 -08:00
Ryan Houdek
f848957e17 Implements unit tests for the new unaligned atomics
Tests all the unaligned atomic ops we support now
2021-02-22 18:25:25 -08:00
Ryan Houdek
633ea045e5 Handles unaligned cmpxchg/cmpxchg8b in SIGBUS handler
cmpxchg/cmpxchg8b doesn't have alignment requirements on x86, which means
applications rely on unaligned behaviour support with it.

Steam relies on this to work for a linked list array of jobs in some
internal job queueing system. It will end up always aligning by offsets
of 4 since it stores a couple of pointers.

Doesn't currently support the case of unaligned cmpxchg8b crossing a
cacheline, which ends up being semi-broken depending on which x86
behaviour the application is expected.
Intel CPUs do the "Big ring lock" or "split locks". Which means accesses
across cachelines are atomic.
AMD CPUs will tear the value across the cacheline, which is expected x86
behaviour by spec.

If they are expecting Intel behaviour, then that application is just
broken on non-Intel platforms unless they are fine with a tear.
2021-01-20 16:07:50 -08:00
Ryan Houdek
9e20979eff Adds imul unit tests that check flag results 2020-09-29 12:33:34 -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
Stefanos Kornilios Mitsis Poiitidis
b9d004b639
Merge pull request #439 from Sonicadvance1/cmpxchg_edgecase
Fixes edge case that wasn't covered in FEX's cmpxchg
2020-09-29 11:20:45 +03:00
Ryan Houdek
10f1641068 Extends SHLD/SHRD unit tests to ensure Zext behaviour 2020-09-28 16:58:27 -07:00
Ryan Houdek
ae7aa51b0c Extends PEXTRW and PINSRW unit tests
Ensures that an index past the max element is correctly masked
2020-09-27 18:50:25 -07:00
Ryan Houdek
3a4d5220fe Adds 32bit GPR cmpxchg unit test
Ensures only RAX is zexted from 32bits rather than both RAX and RBX when
compare fails.
2020-09-27 17:49:54 -07:00
Ryan Houdek
b878006f18 Extends the PSADBW unit tests
Weren't quite extensive enough
2020-09-27 16:54:57 -07:00
Stefanos Kornilios Mitsis Poiitidis
e168e5053a
Merge pull request #410 from Sonicadvance1/pmovmskb
Implements MMX PMOVMSKB
2020-09-23 09:51:48 +03:00
Stefanos Kornilios Mitsis Poiitidis
75109050c0
Merge pull request #409 from Sonicadvance1/maskmov
Implements MASKMOVQ and MASKMOVDQU
2020-09-23 09:49:20 +03:00
Ryan Houdek
8a62065917 Implements new unit tests for these instructions 2020-09-22 23:23:51 -07:00
Ryan Houdek
3ad8ea49e4 Implements PMOVMSKB unit test 2020-09-22 23:23:06 -07:00
Ryan Houdek
0c7c7ba670 Removes undefined behaviour in our unit tests
Most of these were relying on the upper 16bits of the 80bit MM registers
to be zero.
This isn't necessarily true as one will find out when running this under
the host runner.
2020-09-22 18:32:19 -07:00
Stefanos Kornilios Mitsis Poiitidis
2425ab994b Thunks: Generation script refactor, generic callbacks 2020-09-22 14:35:38 +03:00
Ryan Houdek
bfde44a288
Merge pull request #386 from FEX-Emu/skmp/fix-shld-shrd
x86disp: Fix shld/shrd flags
2020-09-16 12:36:51 -07:00
Stefanos Kornilios Mitsis Poiitidis
ef111eb287 unittests: Fix SH*D tests 2020-09-16 22:21:41 +03:00
Ryan Houdek
ded48258d6
Merge pull request #378 from FEX-Emu/skmp/fix-BT-offsets
x86disp: BT/BTR/BTS/BTC make bit index signed
2020-09-15 10:05:47 -07:00
Ryan Houdek
b5e354d341
Merge pull request #380 from FEX-Emu/skmp/fix-movhlps
x86disp: Add movhlps special case
2020-09-15 10:04:17 -07:00
Ryan Houdek
e11d3ed83a
Merge pull request #382 from FEX-Emu/skmp/fix-xadd-regreg
x86disp: fix xadd reg,reg
2020-09-15 10:02:04 -07:00
Ryan Houdek
cadf53c9d9 SHRD and SHLD unit tests for flag setting
Tests all flags aside from PF
2020-09-15 13:42:57 +03:00
Ryan Houdek
9e055d9ba7 Ensures xadd stores the correct result in to the destiation register
For when both source and destination is GPR
2020-09-15 13:32:24 +03:00
Ryan Houdek
68752de97c Fixes missing movhlps test and moves current to correct file
movhlps moves from top 64bits of second argument to bottom 64bits of
destination

Only supports reg<->reg movement
2020-09-15 13:26:28 +03:00
Ryan Houdek
1b6767fbac Adds BT/BTC/BTR/BTS unit tests to test negative offset
The offsets are signed integers, not unsigned
2020-09-15 13:19:17 +03:00
Stefanos Kornilios Mitsis Poiitidis
4f05fe36b6 asm tests: 0F_6E also checks mm,mem forms 2020-09-15 13:12:59 +03:00
Ryan Houdek
6e28d316df Adds MOVD unit test to ensure zext
32bit needs to zext to 64bit mmx
64bit is regular move
2020-09-15 12:59:33 +03: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
ceab504211 Implements unit tests for psadbw 2020-05-31 03:22:11 +01:00
Ryan Houdek
ee931def98 Implements three unit tests for the new conversion ops 2020-04-29 19:03:48 -07:00
Ryan Houdek
bf5dbdf143 Adds reciprocal unit tests 2020-04-24 23:36:01 -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
b0c9ae848b Implements unit tests for the unordered and ordered comparisons 2020-04-04 23:19:30 -07:00
Ryan Houdek
842ef332eb Implements 71 new MMX unit tests 2020-04-01 20:04:05 -07:00
Ryan Houdek
6899a8f53a Implements unit tests for sqrtpd, sqrtps, and rsqrtps 2020-03-20 18:14:44 -07:00