about summary refs log tree commit diff stats
path: root/src/emu
diff options
context:
space:
mode:
authorYang Liu <liuyang22@iscas.ac.cn>2025-09-01 17:39:21 +0800
committerGitHub <noreply@github.com>2025-09-01 11:39:21 +0200
commite5556e90df9835ad2a777c42be50d943a2c5bcc5 (patch)
tree8c51f99ed7570add4ffc3bb3636775b4eea6d8f7 /src/emu
parent1edd0eb47d207b21af0586db36abfc3625d1a849 (diff)
downloadbox64-e5556e90df9835ad2a777c42be50d943a2c5bcc5.tar.gz
box64-e5556e90df9835ad2a777c42be50d943a2c5bcc5.zip
[INTERP][DYNAREC] Aligned !fastnan handling of 0F 51/52 opcodes (#2989)
* [INTERP] Added !fastnan handling to some 0F opcodes

* [RV64_DYNAREC] Fixed/refined !fastnan handling of some 0F opcodes

* la64

* more fixes
Diffstat (limited to 'src/emu')
-rw-r--r--src/emu/x64run0f.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/emu/x64run0f.c b/src/emu/x64run0f.c
index 046861da..ee66c0ce 100644
--- a/src/emu/x64run0f.c
+++ b/src/emu/x64run0f.c
@@ -739,7 +739,10 @@ uintptr_t Run0F(x64emu_t *emu, rex_t rex, uintptr_t addr, int *step)
             GETEX(0);

             GETGX;

             for(int i=0; i<4; ++i)

-                GX->f[i] = sqrtf(EX->f[i]);

+                if (isnan(EX->f[i]))

+                    GX->f[i] = EX->f[i];

+                else

+                    GX->f[i] = (EX->f[i] < 0) ? (-NAN) : sqrtf(EX->f[i]);

             break;

         case 0x52:                      /* RSQRTPS Gx, Ex */

             nextop = F8;

@@ -763,7 +766,10 @@ uintptr_t Run0F(x64emu_t *emu, rex_t rex, uintptr_t addr, int *step)
             GETEX(0);

             GETGX;

             for(int i=0; i<4; ++i)

-                GX->f[i] = 1.0f/EX->f[i];

+                if (isnan(EX->f[i]))

+                    GX->f[i] = EX->f[i];

+                else

+                    GX->f[i] = 1.0f / EX->f[i];

             break;

         case 0x54:                      /* ANDPS Gx, Ex */

             nextop = F8;