From f6afce781fa367f077e96da563edd0f349bdcd83 Mon Sep 17 00:00:00 2001 From: MerryMage Date: Sat, 25 May 2019 23:01:06 +0100 Subject: [PATCH] Jit64AsmCommon: Use PEXT in GenConvertDoubleToSingle --- .../PowerPC/Jit64Common/Jit64AsmCommon.cpp | 29 ++++++++++++------- 1 file changed, 19 insertions(+), 10 deletions(-) diff --git a/Source/Core/Core/PowerPC/Jit64Common/Jit64AsmCommon.cpp b/Source/Core/Core/PowerPC/Jit64Common/Jit64AsmCommon.cpp index f841a216c2..1047934104 100644 --- a/Source/Core/Core/PowerPC/Jit64Common/Jit64AsmCommon.cpp +++ b/Source/Core/Core/PowerPC/Jit64Common/Jit64AsmCommon.cpp @@ -68,18 +68,27 @@ void CommonAsmRoutines::GenConvertDoubleToSingle() // Don't Denormalize - // We want bits 0, 1 - MOVAPD(XMM1, R(XMM0)); - PAND(XMM1, MConst(double_top_two_bits)); - PSRLQ(XMM1, 32); + if (cpu_info.bBMI2) + { + // Extract bits 0-1 and 5-34 + MOV(64, R(RSCRATCH), Imm64(0xc7ffffffe0000000)); + PEXT(64, RSCRATCH, RSCRATCH2, R(RSCRATCH)); + } + else + { + // We want bits 0, 1 + MOVAPD(XMM1, R(XMM0)); + PAND(XMM1, MConst(double_top_two_bits)); + PSRLQ(XMM1, 32); - // And 5 through to 34 - PAND(XMM0, MConst(double_bottom_bits)); - PSRLQ(XMM0, 29); + // And 5 through to 34 + PAND(XMM0, MConst(double_bottom_bits)); + PSRLQ(XMM0, 29); - // OR them togther - POR(XMM0, R(XMM1)); - MOVD_xmm(R(RSCRATCH), XMM0); + // OR them togther + POR(XMM0, R(XMM1)); + MOVD_xmm(R(RSCRATCH), XMM0); + } RET(); // Denormalise