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,12 +154,17 @@ 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();
if (code.DoesCpuSupport(Xbyak::util::Cpu::tAVX)) {
FCODE(vcmpunordp)(nan_mask, result, result);
FCODE(vblendvp)(result, result, GetNaNVector<fsize>(code), nan_mask);
} else {
code.movaps(nan_mask, result); code.movaps(nan_mask, result);
FCODE(cmpordp)(nan_mask, nan_mask); FCODE(cmpordp)(nan_mask, nan_mask);
code.andps(result, nan_mask); code.andps(result, nan_mask);
code.andnps(nan_mask, GetNaNVector<fsize>(code)); code.andnps(nan_mask, GetNaNVector<fsize>(code));
code.orps(result, nan_mask); code.orps(result, nan_mask);
} }
}
} }
template<size_t fsize> template<size_t fsize>