[RV64_DYNAREC] Added more opcodes for vector (#1991)

This commit is contained in:
Yang Liu 2024-11-02 01:07:18 +08:00 committed by GitHub
parent 5d03ad24c3
commit 9e43737e18
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 67 additions and 1 deletions

View File

@ -573,7 +573,7 @@ uintptr_t dynarec64_0F_vector(dynarec_rv64_t* dyn, uintptr_t addr, uintptr_t ip,
case 0x60 ... 0x7F:
case 0x80 ... 0xBF:
case 0xC3 ... 0xC5:
case 0xC8 ... 0xCF:
case 0xC7 ... 0xCF:
return 0;
default:
DEFAULT_VECTOR;

View File

@ -766,6 +766,51 @@ uintptr_t dynarec64_660F_vector(dynarec_rv64_t* dyn, uintptr_t addr, uintptr_t i
if (q0 != q1) VMV_V_V(q0, q1);
}
break;
case 0x16:
nextop = F8;
if (rex.w) {
INST_NAME("PEXTRQ Ed, Gx, Ib");
} else {
INST_NAME("PEXTRD Ed, Gx, Ib");
}
SET_ELEMENT_WIDTH(x1, (rex.w ? VECTOR_SEW64 : VECTOR_SEW32), 1);
GETGX_vector(q0, 1, dyn->vector_eew);
if (MODREG) {
ed = xRAX + (nextop & 7) + (rex.b << 3);
u8 = F8;
if (u8 & (rex.w ? 1 : 3)) {
if (rv64_xtheadvector) {
ADDI(x4, xZR, (u8 & (rex.w ? 1 : 3)));
VEXT_X_V(ed, q0, x4);
} else {
d0 = fpu_get_scratch(dyn);
VSLIDEDOWN_VI(d0, q0, (u8 & (rex.w ? 1 : 3)), VECTOR_UNMASKED);
VMV_X_S(ed, d0);
if (!rex.w) ZEROUP(ed);
}
} else {
VMV_X_S(ed, q0);
if (!rv64_xtheadvector && !rex.w) ZEROUP(ed);
}
} else {
addr = geted(dyn, addr, ninst, nextop, &ed, x2, x3, &fixedaddress, rex, NULL, 0, 1);
u8 = F8;
if (u8 & (rex.w ? 1 : 3)) {
if (rv64_xtheadvector) {
ADDI(x4, xZR, (u8 & (rex.w ? 1 : 3)));
VEXT_X_V(x5, q0, x4);
} else {
d0 = fpu_get_scratch(dyn);
VSLIDEDOWN_VI(d0, q0, (u8 & (rex.w ? 1 : 3)), VECTOR_UNMASKED);
VMV_X_S(x5, d0);
}
} else {
VMV_X_S(x5, q0);
}
SDxw(x5, ed, fixedaddress);
SMWRITE2();
}
break;
case 0x22:
INST_NAME("PINSRD Gx, Ed, Ib");
nextop = F8;

View File

@ -631,6 +631,27 @@ uintptr_t dynarec64_F20F_vector(dynarec_rv64_t* dyn, uintptr_t addr, uintptr_t i
VMV_S_X(d0, x2);
}
break;
case 0xE6:
if (!box64_dynarec_fastround) return 0;
INST_NAME("CVTPD2DQ Gx, Ex");
nextop = F8;
SET_ELEMENT_WIDTH(x1, VECTOR_SEW64, 1);
GETEX_vector(v1, 0, 0, VECTOR_SEW64);
GETGX_empty_vector(v0);
if (v1 & 1) {
d1 = fpu_get_scratch_lmul(dyn, VECTOR_LMUL2);
VMV_V_V(d1, v1);
} else {
d1 = v1;
}
vector_vsetvli(dyn, ninst, x1, VECTOR_SEW32, VECTOR_LMUL1, 0.5);
d0 = fpu_get_scratch_lmul(dyn, VECTOR_LMUL2);
VFNCVT_X_F_W(d0, d1, VECTOR_UNMASKED);
vector_vsetvli(dyn, ninst, x1, VECTOR_SEW64, VECTOR_LMUL1, 1);
if (!rv64_xtheadvector) VXOR_VV(v0, v0, v0, VECTOR_UNMASKED);
VMV_X_S(x4, d0);
VMV_S_X(v0, x4);
break;
default: DEFAULT_VECTOR;
}
return addr;