Skip to content

Commit

Permalink
Merge pull request #13211 from Sintendo/blendvpd
Browse files Browse the repository at this point in the history
Jit_FloatingPoint: fselx - Prefer BLENDVPD over VBLENDVPD
  • Loading branch information
JMC47 authored Dec 22, 2024
2 parents a1d6aa7 + 065165f commit c528a70
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion Source/Core/Core/PowerPC/Jit64/Jit_FloatingPoint.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -644,6 +644,20 @@ void Jit64::fselx(UGeckoInstruction inst)

if (cpu_info.bAVX)
{
// Prefer BLENDVPD over VBLENDVPD if the latter doesn't save any
// instructions.
//
// VBLENDVPD allows separate source and destination registers, which can
// eliminate a MOVAPD/MOVSD. However, on Intel since Skylake, VBLENDVPD
// takes additional uops to execute compared to BLENDVPD (according to
// https://uops.info). On AMD and older Intel microarchitectures there is no
// difference.
if (d == c)
{
BLENDVPD(Rd, Rb);
return;
}

X64Reg src1 = XMM1;
if (Rc.IsSimpleReg())
{
Expand All @@ -654,7 +668,7 @@ void Jit64::fselx(UGeckoInstruction inst)
MOVAPD(XMM1, Rc);
}

if (d == c || packed)
if (packed)
{
VBLENDVPD(Rd, src1, Rb, XMM0);
return;
Expand Down

0 comments on commit c528a70

Please sign in to comment.