diff --git a/core/hw/sh4/dyna/shil_canonical.h b/core/hw/sh4/dyna/shil_canonical.h index 9620cb533..0af91477b 100644 --- a/core/hw/sh4/dyna/shil_canonical.h +++ b/core/hw/sh4/dyna/shil_canonical.h @@ -719,6 +719,8 @@ shil_opc_end() //shop_cvt_f2i_t //float to integer : truncate shil_opc(cvt_f2i_t) + +#if HOST_CPU == CPU_X86 || HOST_CPU == CPU_X64 shil_canonical ( u32,f1,(f32 f1), @@ -727,14 +729,24 @@ u32,f1,(f32 f1), else { s32 res = (s32)f1; -#if HOST_CPU == CPU_X86 || HOST_CPU == CPU_X64 + // Fix result sign for Intel CPUs if (res == 0x80000000 && *(s32 *)&f1 > 0) res = 0x7fffffff; -#endif + return res; } ) +#else +shil_canonical +( +u32,f1,(f32 f1), + if (f1 > 2147483520.0f) // IEEE 754: 0x4effffff + return 0x7fffffff; + else + return (s32)f1; +) +#endif shil_compile (