diff options
| author | Sintendo <bram.speeckaert@gmail.com> | 2020-11-16 23:00:52 +0100 |
|---|---|---|
| committer | Sintendo <bram.speeckaert@gmail.com> | 2020-12-25 19:30:51 +0100 |
| commit | 17db359979587c588d549e3f31dc8994c96abd8b (patch) | |
| tree | 1d593511dc9f44c498a8e899853d34c1697b5778 /Source/Core/VideoCommon/TextureCacheBase.cpp | |
| parent | 2e4e2ad1ffc92ac76498f926ca88637d098ea747 (diff) | |
Jit64: srwx - Optimize shift by constant
More efficient code can be generated if the shift amount is known at
compile time. Similar optimizations were present in JitArm64 already,
but were missing in Jit64.
- By using an 8-bit immediate we can eliminate the need for ECX as a
scratch register, thereby reducing register pressure and occasionally
eliminating a spill.
Before:
B9 18 00 00 00 mov ecx,18h
45 8B C1 mov r8d,r9d
49 D3 E8 shr r8,cl
After:
45 8B C1 mov r8d,r9d
41 C1 E8 18 shr r8d,18h
- PowerPC has strange shift amount masking behavior which is emulated
using 64-bit shifts, even though we only care about a 32-bit result.
If the shift amount is known, we can handle this special case
separately, and use 32-bit shift instructions otherwise.
Before:
B9 F8 FF FF FF mov ecx,0FFFFFFF8h
45 8B C1 mov r8d,r9d
49 D3 E8 shr r8,cl
After:
Nothing, register is set to constant zero.
- A shift by zero becomes a simple MOV.
Before:
B9 00 00 00 00 mov ecx,0
45 8B C1 mov r8d,r9d
49 D3 E8 shr r8,cl
After:
45 8B C1 mov r8d,r9d
Diffstat (limited to 'Source/Core/VideoCommon/TextureCacheBase.cpp')
0 files changed, 0 insertions, 0 deletions
