about summary refs log tree commit diff stats
path: root/src
diff options
context:
space:
mode:
authorptitSeb <sebastien.chev@gmail.com>2021-03-30 21:46:13 +0200
committerptitSeb <sebastien.chev@gmail.com>2021-03-30 21:46:13 +0200
commite6e420d9a3463df03905bede027ab724f3b001f2 (patch)
treeae40f0ef63560ffe6398a75d153010178671a59c /src
parentbde4adcdefac3e15faddd2a6a0396ded1e64f866 (diff)
downloadbox64-e6e420d9a3463df03905bede027ab724f3b001f2.tar.gz
box64-e6e420d9a3463df03905bede027ab724f3b001f2.zip
Added 66 0F 38 01/02/03/04/05 opcodes
Diffstat (limited to 'src')
-rw-r--r--src/emu/x64run660f.c65
1 files changed, 65 insertions, 0 deletions
diff --git a/src/emu/x64run660f.c b/src/emu/x64run660f.c
index 2c6ead7c..be2e8d9b 100644
--- a/src/emu/x64run660f.c
+++ b/src/emu/x64run660f.c
@@ -182,6 +182,71 @@ int Run660F(x64emu_t *emu, rex_t rex)
                         GX->ub[i] = eax1.ub[EX->ub[i]&15];

                 }

                 break;

+            case 0x01:  /* PHADDW Gx, Ex */

+                nextop = F8;

+                GETEX(0);

+                GETGX;

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

+                    GX->sw[i] = GX->sw[i*2+0]+GX->sw[i*2+1];

+                if(GX == EX) {

+                    GX->q[1] = GX->q[0];

+                } else {

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

+                        GX->sw[4+i] = EX->sw[i*2+0] + EX->sw[i*2+1];

+                }

+                break;

+            case 0x02:  /* PHADDD Gx, Ex */

+                nextop = F8;

+                GETEX(0);

+                GETGX;

+                GX->sd[0] += GX->sd[1];

+                GX->sd[1] = GX->sd[2] + GX->sd[3];

+                if(GX == EX) {

+                    GX->q[1] = GX->q[0];

+                } else {

+                    GX->sd[2] = EX->sd[0] + EX->sd[1];

+                    GX->sd[3] = EX->sd[2] + EX->sd[3];

+                }

+                break;

+            case 0x03:  /* PHADDSW Gx, Ex */

+                nextop = F8;

+                GETEX(0);

+                GETGX;

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

+                    tmp32s = GX->sw[i*2+0]+GX->sw[i*2+1];

+                    GX->sw[i] = (tmp32s<-32768)?-32768:((tmp32s>32767)?32767:tmp32s);

+                }

+                if(GX == EX) {

+                    GX->q[1] = GX->q[0];

+                } else {

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

+                        tmp32s = EX->sw[i*2+0] + EX->sw[i*2+1];

+                        GX->sw[4+i] = (tmp32s<-32768)?-32768:((tmp32s>32767)?32767:tmp32s);

+                    }

+                }

+                break;

+            case 0x04:  /* PMADDUBSW Gx,Ex */

+                nextop = F8;

+                GETEX(0);

+                GETGX;

+                for (int i=0; i<8; ++i) {

+                    tmp32s = (int32_t)(GX->ub[i*2+0])*EX->sb[i*2+0] + (int32_t)(GX->ub[i*2+1])*EX->sb[i*2+1];

+                    GX->sw[i] = (tmp32s>32767)?32767:((tmp32s<-32768)?-32768:tmp32s);

+                }

+                break;

+            case 0x05:  /* PHSUBW Gx, Ex */

+                nextop = F8;

+                GETEX(0);

+                GETGX;

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

+                    GX->sw[i] = GX->sw[i*2+0] - GX->sw[i*2+1];

+                if(GX == EX) {

+                    GX->q[1] = GX->q[0];

+                } else {

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

+                        GX->sw[4+i] = EX->sw[i*2+0] - EX->sw[i*2+1];

+                }

+                break;

 

             default:

                 return 1;