From a52774ca639d01993e38dc4cc7c0010643ccfb60 Mon Sep 17 00:00:00 2001 From: Sintendo Date: Tue, 21 Jul 2020 22:46:10 +0200 Subject: [PATCH] Jit64: fselx - Add AVX path AVX has a four-operand VBLENDVPD instruction, which allows for the first input and the destination to be different. By taking advantage of this, we no longer need to copy one of the inputs around and we can just reference it directly, provided it's already in a register (I have yet to see this not be the case). Before: 66 0F 57 C0 xorpd xmm0,xmm0 F2 41 0F C2 C6 06 cmpnlesd xmm0,xmm14 41 0F 28 CE movaps xmm1,xmm14 66 41 0F 38 15 CA blendvpd xmm1,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 C3 09 4B CA 00 vblendvpd xmm1,xmm14,xmm10,xmm0 F2 44 0F 10 F1 movsd xmm14,xmm1 --- .../Core/PowerPC/Jit64/Jit_FloatingPoint.cpp | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/Source/Core/Core/PowerPC/Jit64/Jit_FloatingPoint.cpp b/Source/Core/Core/PowerPC/Jit64/Jit_FloatingPoint.cpp index dd41561944..0d6bff0b1a 100644 --- a/Source/Core/Core/PowerPC/Jit64/Jit_FloatingPoint.cpp +++ b/Source/Core/Core/PowerPC/Jit64/Jit_FloatingPoint.cpp @@ -437,7 +437,21 @@ void Jit64::fselx(UGeckoInstruction inst) else CMPSD(XMM0, Ra, CMP_NLE); - if (cpu_info.bSSE4_1) + if (cpu_info.bAVX) + { + X64Reg src1 = XMM1; + if (Rc.IsSimpleReg()) + { + src1 = Rc.GetSimpleReg(); + } + else + { + MOVAPD(XMM1, Rc); + } + + VBLENDVPD(XMM1, src1, Rb, XMM0); + } + else if (cpu_info.bSSE4_1) { MOVAPD(XMM1, Rc); BLENDVPD(XMM1, Rb);