Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Jit64: Prefer MOVAPS where possible #8027

Merged
merged 3 commits into from May 22, 2019

Conversation

4 participants
@MerryMage
Copy link
Member

commented Apr 23, 2019

Microoptimization.

Prefer MOVAPS to MOVAPD

There is no reason to use MOVAPD over MOVAPS:

  • They have equivalent functionality.
  • There has never been a microarchitecture with separate single and double domains.
  • MOVAPD is one byte longer than MOVAPS.

Prefer MOVAPS to MOVSD (where possible)

In cases where the high half of the destination is immediately overwritten, MOVSD has no benefit over MOVAPS:

  • MOVSD produces an unnecessary dependency on the high half of regOp.
  • MOVAPS is implemented as a register rename on modern microarchitectures (zero latency).

@MerryMage MerryMage force-pushed the MerryMage:MOVAPS branch 2 times, most recently from d2a471c to d7e0219 Apr 24, 2019

@Tilka

This comment has been minimized.

Copy link
Member

commented Apr 26, 2019

Regarding MOVAPD->MOVAPS, I remember considering this and deciding against it on the basis that it would make the source code even less readable. Have you considered changing the emitter instead? That would also be a good place to put a comment with an explanation.

@MerryMage

This comment has been minimized.

Copy link
Member Author

commented Apr 27, 2019

Have you considered changing the emitter instead?

Makes sense.

MerryMage added some commits Apr 27, 2019

x64Emitter: Prefer MOVAPS to MOVAPD
There is no reason to use MOVAPD over MOVAPS, for two reasons:
* There has never been a microarchitecture with separate single and double domains.
* MOVAPD is one byte longer than MOVAPS
x64Emitter: Prefer MOVAPS to MOVSD
* The high half of regOp is immediately overwritten so the value in it is irrelevant.
* MOVSD produces an unnecessary dependency on the high half of regOp.
* MOVAPS is implemented as a register rename on modern microarchitectures.
EmuCodeBlock: Prefer MOVAPS to MOVSD in ConvertDoubleToSingle
* The high half of the register is immediately masked so the value in it is irrelevant.
* MOVSD produces an unnecessary dependency on the high half of regOp.
* MOVAPS is implemented as a register rename on modern microarchitectures.

@MerryMage MerryMage force-pushed the MerryMage:MOVAPS branch from d7e0219 to e06111e Apr 27, 2019

@Tilka

Tilka approved these changes May 4, 2019

@stenzek stenzek merged commit 68877c5 into dolphin-emu:master May 22, 2019

10 checks passed

default Very basic checks passed, handed off to Buildbot.
Details
lint Build succeeded on builder lint
Details
pr-android Build succeeded on builder pr-android
Details
pr-deb-dbg-x64 Build succeeded on builder pr-deb-dbg-x64
Details
pr-deb-x64 Build succeeded on builder pr-deb-x64
Details
pr-freebsd-x64 Build succeeded on builder pr-freebsd-x64
Details
pr-osx-x64 Build succeeded on builder pr-osx-x64
Details
pr-ubu-x64 Build succeeded on builder pr-ubu-x64
Details
pr-win-dbg-x64 Build succeeded on builder pr-win-dbg-x64
Details
pr-win-x64 Build succeeded on builder pr-win-x64
Details

@MerryMage MerryMage deleted the MerryMage:MOVAPS branch May 22, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.