diff --git a/src/backend_x64/emit_x64_vector_floating_point.cpp b/src/backend_x64/emit_x64_vector_floating_point.cpp index 455f7058..4d468c36 100644 --- a/src/backend_x64/emit_x64_vector_floating_point.cpp +++ b/src/backend_x64/emit_x64_vector_floating_point.cpp @@ -123,31 +123,32 @@ void HandleNaNs(BlockOfCode& code, EmitContext& ctx, std::array +Xbyak::Address GetVectorOf(BlockOfCode& code) { + if constexpr (fsize == 32) { + return code.MConst(xword, (value << 32) | value, (value << 32) | value); + } else { + return code.MConst(xword, value, value); + } +} + template Xbyak::Address GetNaNVector(BlockOfCode& code) { - if constexpr (fsize == 32) { - return code.MConst(xword, 0x7fc0'0000'7fc0'0000, 0x7fc0'0000'7fc0'0000); - } else { - return code.MConst(xword, 0x7ff8'0000'0000'0000, 0x7ff8'0000'0000'0000); - } + using FPT = mp::unsigned_integer_of_size; + return GetVectorOf::DefaultNaN()>(code); } template Xbyak::Address GetNegativeZeroVector(BlockOfCode& code) { - if constexpr (fsize == 32) { - return code.MConst(xword, 0x8000'0000'8000'0000, 0x8000'0000'8000'0000); - } else { - return code.MConst(xword, 0x8000'0000'0000'0000, 0x8000'0000'0000'0000); - } + using FPT = mp::unsigned_integer_of_size; + return GetVectorOf::Zero(true)>(code); } template Xbyak::Address GetSmallestNormalVector(BlockOfCode& code) { - if constexpr (fsize == 32) { - return code.MConst(xword, 0x0080'0000'0080'0000, 0x0080'0000'0080'0000); - } else { - return code.MConst(xword, 0x0010'0000'0000'0000, 0x0010'0000'0000'0000); - } + using FPT = mp::unsigned_integer_of_size; + constexpr FPT smallest_normal_number = FP::FPValue::exponent_min, FP::FPInfo::implicit_leading_bit>(); + return GetVectorOf(code); } template