From 9ac324aed32501a379ab2a81baa55f11cfa2af32 Mon Sep 17 00:00:00 2001 From: Sintendo Date: Sat, 3 Oct 2020 16:32:40 +0200 Subject: [PATCH] Jit64: fselx - Skip MOVSD (AVX) For the non-packed variant of this instruction, a MOVSD instruction was generated to copy only the lower 64 bits of XMM1 to the destination register. This was done in order to keep the destination register's upper half intact. However, when register c and the destination register are the same, there is no need for this copy. Because the registers match and due to the way the mask is generated, VBLENDVPD will end up taking the upper half from the destination register, as intended. Before: 66 0F 57 C0 xorpd xmm0,xmm0 F2 41 0F C2 C6 06 cmpnlesd xmm0,xmm14 C4 C3 09 4B CA 00 vblendvpd xmm1,xmm14,xmm10,xmm0 F2 44 0F 10 F1 movsd xmm14,xmm1 After: 66 0F 57 C0 xorpd xmm0,xmm0 F2 41 0F C2 C6 06 cmpnlesd xmm0,xmm14 C4 43 09 4B F2 00 vblendvpd xmm14,xmm14,xmm10,xmm0 --- Source/Core/Core/PowerPC/Jit64/Jit_FloatingPoint.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/Core/Core/PowerPC/Jit64/Jit_FloatingPoint.cpp b/Source/Core/Core/PowerPC/Jit64/Jit_FloatingPoint.cpp index f520520601..c2199471e7 100644 --- a/Source/Core/Core/PowerPC/Jit64/Jit_FloatingPoint.cpp +++ b/Source/Core/Core/PowerPC/Jit64/Jit_FloatingPoint.cpp @@ -449,7 +449,7 @@ void Jit64::fselx(UGeckoInstruction inst) MOVAPD(XMM1, Rc); } - if (packed) + if (d == c || packed) { VBLENDVPD(Rd, src1, Rb, XMM0); return;