emit_x64_vector_floating_point: AVX implementation of ForceToDefaultNaN

This commit is contained in:
MerryMage 2018-07-31 20:33:50 +01:00
parent 746dc521b9
commit 8252efd7b1

View file

@ -154,11 +154,16 @@ template<size_t fsize>
void ForceToDefaultNaN(BlockOfCode& code, EmitContext& ctx, Xbyak::Xmm result) { void ForceToDefaultNaN(BlockOfCode& code, EmitContext& ctx, Xbyak::Xmm result) {
if (ctx.FPSCR_DN()) { if (ctx.FPSCR_DN()) {
const Xbyak::Xmm nan_mask = ctx.reg_alloc.ScratchXmm(); const Xbyak::Xmm nan_mask = ctx.reg_alloc.ScratchXmm();
code.movaps(nan_mask, result); if (code.DoesCpuSupport(Xbyak::util::Cpu::tAVX)) {
FCODE(cmpordp)(nan_mask, nan_mask); FCODE(vcmpunordp)(nan_mask, result, result);
code.andps(result, nan_mask); FCODE(vblendvp)(result, result, GetNaNVector<fsize>(code), nan_mask);
code.andnps(nan_mask, GetNaNVector<fsize>(code)); } else {
code.orps(result, nan_mask); code.movaps(nan_mask, result);
FCODE(cmpordp)(nan_mask, nan_mask);
code.andps(result, nan_mask);
code.andnps(nan_mask, GetNaNVector<fsize>(code));
code.orps(result, nan_mask);
}
} }
} }