From 59e367a88e3569b7bb470cf796df0f86e5207b1a Mon Sep 17 00:00:00 2001 From: ptitSeb Date: Tue, 3 May 2022 09:57:47 +0200 Subject: Added and fixed opcodes 66 0F 38 38..3F ([DYNAREC] too) (for #299) --- src/dynarec/arm64/dynarec_arm64_660f.c | 43 +++++++++++++++++++++++++++++++++- src/emu/x64run660f.c | 43 ++++++++++++++++++++++++++++++++-- 2 files changed, 83 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/dynarec/arm64/dynarec_arm64_660f.c b/src/dynarec/arm64/dynarec_arm64_660f.c index 11e4d2be..30d99383 100755 --- a/src/dynarec/arm64/dynarec_arm64_660f.c +++ b/src/dynarec/arm64/dynarec_arm64_660f.c @@ -439,6 +439,13 @@ uintptr_t dynarec64_660F(dynarec_arm_t* dyn, uintptr_t addr, uintptr_t ip, int n UXTL_32(q0, q1); // 32bits->64bits break; + case 0x38: + INST_NAME("PMINSB Gx, Ex"); // SSE4 opcode! + nextop = F8; + GETEX(q1, 0, 0); + GETGX(q0, 1); + SMINQ_8(q0, q0, q1); + break; case 0x39: INST_NAME("PMINSD Gx, Ex"); // SSE4 opcode! nextop = F8; @@ -446,7 +453,27 @@ uintptr_t dynarec64_660F(dynarec_arm_t* dyn, uintptr_t addr, uintptr_t ip, int n GETGX(q0, 1); SMINQ_32(q0, q0, q1); break; - + case 0x3A: + INST_NAME("PMINUW Gx, Ex"); // SSE4 opcode! + nextop = F8; + GETEX(q1, 0, 0); + GETGX(q0, 1); + UMINQ_16(q0, q0, q1); + break; + case 0x3B: + INST_NAME("PMINUD Gx, Ex"); // SSE4 opcode! + nextop = F8; + GETEX(q1, 0, 0); + GETGX(q0, 1); + UMINQ_32(q0, q0, q1); + break; + case 0x3C: + INST_NAME("PMAXSB Gx, Ex"); // SSE4 opcode! + nextop = F8; + GETEX(q1, 0, 0); + GETGX(q0, 1); + SMAXQ_8(q0, q0, q1); + break; case 0x3D: INST_NAME("PMAXSD Gx, Ex"); // SSE4 opcode! nextop = F8; @@ -454,6 +481,20 @@ uintptr_t dynarec64_660F(dynarec_arm_t* dyn, uintptr_t addr, uintptr_t ip, int n GETGX(q0, 1); SMAXQ_32(q0, q0, q1); break; + case 0x3E: + INST_NAME("PMAXUW Gx, Ex"); // SSE4 opcode! + nextop = F8; + GETEX(q1, 0, 0); + GETGX(q0, 1); + UMAXQ_16(q0, q0, q1); + break; + case 0x3F: + INST_NAME("PMAXUD Gx, Ex"); // SSE4 opcode! + nextop = F8; + GETEX(q1, 0, 0); + GETGX(q0, 1); + UMAXQ_32(q0, q0, q1); + break; case 0xDB: INST_NAME("AESIMC Gx, Ex"); // AES-NI diff --git a/src/emu/x64run660f.c b/src/emu/x64run660f.c index ac255a0f..e3b71d4b 100644 --- a/src/emu/x64run660f.c +++ b/src/emu/x64run660f.c @@ -477,6 +477,14 @@ int Run660F(x64emu_t *emu, rex_t rex) GX->q[i] = EX->ud[i]; break; + case 0x38: /* PMINSB Gx, Ex */ + nextop = F8; + GETEX(0); + GETGX; + for(int i=0; i<16; ++i) + if(GX->sb[i]>EX->sb[i]) + GX->sb[i] = EX->sb[i]; + break; case 0x39: /* PMINSD Gx, Ex */ nextop = F8; GETEX(0); @@ -490,10 +498,25 @@ int Run660F(x64emu_t *emu, rex_t rex) GETEX(0); GETGX; for(int i=0; i<8; ++i) - if(GX->uw[i]uw[i]) + if(GX->uw[i]>EX->uw[i]) GX->uw[i] = EX->uw[i]; break; - + case 0x3B: /* PMINUD Gx, Ex */ + nextop = F8; + GETEX(0); + GETGX; + for(int i=0; i<4; ++i) + if(GX->ud[i]>EX->ud[i]) + GX->ud[i] = EX->ud[i]; + break; + case 0x3C: /* PMAXSB Gx, Ex */ + nextop = F8; + GETEX(0); + GETGX; + for(int i=0; i<16; ++i) + if(GX->sb[i]sb[i]) + GX->sb[i] = EX->sb[i]; + break; case 0x3D: /* PMAXSD Gx, Ex */ nextop = F8; GETEX(0); @@ -502,6 +525,22 @@ int Run660F(x64emu_t *emu, rex_t rex) if(GX->sd[i]sd[i]) GX->sd[i] = EX->sd[i]; break; + case 0x3E: /* PMAXUW Gx, Ex */ + nextop = F8; + GETEX(0); + GETGX; + for(int i=0; i<8; ++i) + if(GX->uw[i]uw[i]) + GX->uw[i] = EX->uw[i]; + break; + case 0x3F: /* PMAXUD Gx, Ex */ + nextop = F8; + GETEX(0); + GETGX; + for(int i=0; i<4; ++i) + if(GX->ud[i]ud[i]) + GX->ud[i] = EX->ud[i]; + break; case 0xDB: /* AESIMC Gx, Ex */ nextop = F8; -- cgit 1.4.1