emit_x64_vector_floating_point: Implement workaround for issue 678
This commit is contained in:
parent
af0d4a7c18
commit
9f88f234a1
@ -1170,8 +1170,6 @@ void EmitX64::EmitFPVectorRecipStepFused64(EmitContext& ctx, IR::Inst* inst) {
|
|||||||
|
|
||||||
template<size_t fsize>
|
template<size_t fsize>
|
||||||
void EmitFPVectorRoundInt(BlockOfCode& code, EmitContext& ctx, IR::Inst* inst) {
|
void EmitFPVectorRoundInt(BlockOfCode& code, EmitContext& ctx, IR::Inst* inst) {
|
||||||
using FPT = mp::unsigned_integer_of_size<fsize>;
|
|
||||||
|
|
||||||
const auto rounding = static_cast<FP::RoundingMode>(inst->GetArg(1).GetU8());
|
const auto rounding = static_cast<FP::RoundingMode>(inst->GetArg(1).GetU8());
|
||||||
const bool exact = inst->GetArg(2).GetU1();
|
const bool exact = inst->GetArg(2).GetU1();
|
||||||
|
|
||||||
@ -1211,6 +1209,7 @@ void EmitFPVectorRoundInt(BlockOfCode& code, EmitContext& ctx, IR::Inst* inst) {
|
|||||||
|
|
||||||
static const auto lut = Common::GenerateLookupTableFromList(
|
static const auto lut = Common::GenerateLookupTableFromList(
|
||||||
[](auto arg) {
|
[](auto arg) {
|
||||||
|
using FPT = mp::unsigned_integer_of_size<fsize>;
|
||||||
return std::pair{
|
return std::pair{
|
||||||
mp::lower_to_tuple_v<decltype(arg)>,
|
mp::lower_to_tuple_v<decltype(arg)>,
|
||||||
Common::FptrCast(
|
Common::FptrCast(
|
||||||
@ -1356,8 +1355,6 @@ void EmitX64::EmitFPVectorSub64(EmitContext& ctx, IR::Inst* inst) {
|
|||||||
|
|
||||||
template<size_t fsize, bool unsigned_>
|
template<size_t fsize, bool unsigned_>
|
||||||
void EmitFPVectorToFixed(BlockOfCode& code, EmitContext& ctx, IR::Inst* inst) {
|
void EmitFPVectorToFixed(BlockOfCode& code, EmitContext& ctx, IR::Inst* inst) {
|
||||||
using FPT = mp::unsigned_integer_of_size<fsize>;
|
|
||||||
|
|
||||||
const size_t fbits = inst->GetArg(1).GetU8();
|
const size_t fbits = inst->GetArg(1).GetU8();
|
||||||
const auto rounding = static_cast<FP::RoundingMode>(inst->GetArg(2).GetU8());
|
const auto rounding = static_cast<FP::RoundingMode>(inst->GetArg(2).GetU8());
|
||||||
|
|
||||||
@ -1446,6 +1443,7 @@ void EmitFPVectorToFixed(BlockOfCode& code, EmitContext& ctx, IR::Inst* inst) {
|
|||||||
// Saturate to max
|
// Saturate to max
|
||||||
FCODE(orp)(src, exceed_unsigned);
|
FCODE(orp)(src, exceed_unsigned);
|
||||||
} else {
|
} else {
|
||||||
|
using FPT = mp::unsigned_integer_of_size<fsize>; // WORKAROUND: For issue 678 on MSVC
|
||||||
constexpr u64 integer_max = static_cast<FPT>(std::numeric_limits<std::conditional_t<unsigned_, FPT, std::make_signed_t<FPT>>>::max());
|
constexpr u64 integer_max = static_cast<FPT>(std::numeric_limits<std::conditional_t<unsigned_, FPT, std::make_signed_t<FPT>>>::max());
|
||||||
|
|
||||||
code.movaps(xmm0, GetVectorOf<fsize, float_upper_limit_signed>(code));
|
code.movaps(xmm0, GetVectorOf<fsize, float_upper_limit_signed>(code));
|
||||||
@ -1470,6 +1468,7 @@ void EmitFPVectorToFixed(BlockOfCode& code, EmitContext& ctx, IR::Inst* inst) {
|
|||||||
|
|
||||||
static const auto lut = Common::GenerateLookupTableFromList(
|
static const auto lut = Common::GenerateLookupTableFromList(
|
||||||
[](auto arg) {
|
[](auto arg) {
|
||||||
|
using FPT = mp::unsigned_integer_of_size<fsize>; // WORKAROUND: For issue 678 on MSVC
|
||||||
return std::pair{
|
return std::pair{
|
||||||
mp::lower_to_tuple_v<decltype(arg)>,
|
mp::lower_to_tuple_v<decltype(arg)>,
|
||||||
Common::FptrCast(
|
Common::FptrCast(
|
||||||
|
Loading…
x
Reference in New Issue
Block a user