about summary refs log tree commit diff stats
path: root/src/emu/x64run0f.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/emu/x64run0f.c')
-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;