From a9b89a790bcdbb64dd04413f90c54cc268079ec0 Mon Sep 17 00:00:00 2001 From: Ben Vanik Date: Wed, 29 Jul 2015 21:45:24 -0700 Subject: [PATCH] Some more constant support for MUL_SUB. --- src/xenia/cpu/backend/x64/x64_sequences.cc | 23 ++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) diff --git a/src/xenia/cpu/backend/x64/x64_sequences.cc b/src/xenia/cpu/backend/x64/x64_sequences.cc index 3d0fa8871..465f8b034 100644 --- a/src/xenia/cpu/backend/x64/x64_sequences.cc +++ b/src/xenia/cpu/backend/x64/x64_sequences.cc @@ -4515,15 +4515,30 @@ struct MUL_SUB_V128 // FMA extension if (e.IsFeatureEnabled(kX64EmitFMA)) { if (i.dest == i.src1) { - e.vfmsub213ps(i.dest, i.src2, i.src3); + if (i.src3.is_constant) { + e.LoadConstantXmm(e.xmm0, i.src3.constant()); + e.vfmsub213ps(i.dest, i.src2, e.xmm0); + } else { + e.vfmsub213ps(i.dest, i.src2, i.src3); + } } else if (i.dest == i.src2) { - e.vfmsub213ps(i.dest, i.src1, i.src3); + if (i.src3.is_constant) { + e.LoadConstantXmm(e.xmm0, i.src3.constant()); + e.vfmsub213ps(i.dest, i.src1, e.xmm0); + } else { + e.vfmsub213ps(i.dest, i.src1, i.src3); + } } else if (i.dest == i.src3) { e.vfmsub231ps(i.dest, i.src1, i.src2); } else { - // Dest not equal to anything + // Dest not equal to anything. e.vmovdqa(i.dest, i.src1); - e.vfmsub213ps(i.dest, i.src2, i.src3); + if (i.src3.is_constant) { + e.LoadConstantXmm(e.xmm0, i.src3.constant()); + e.vfmsub213ps(i.dest, i.src2, e.xmm0); + } else { + e.vfmsub213ps(i.dest, i.src2, i.src3); + } } } else { Xmm src3;