Skip to content

Commit

Permalink
Added 1 more opcode
Browse files Browse the repository at this point in the history
  • Loading branch information
ksco committed Oct 3, 2024
1 parent 1179a5e commit c16d512
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 5 deletions.
10 changes: 6 additions & 4 deletions src/dynarec/rv64/dynarec_rv64_660f_vector.c
Original file line number Diff line number Diff line change
Expand Up @@ -1498,19 +1498,21 @@ uintptr_t dynarec64_660F_vector(dynarec_rv64_t* dyn, uintptr_t addr, uintptr_t i
}
break;
case 0xD7:
if (rv64_xtheadvector) { DEFAULT_VECTOR; } // TODO: VMASK convertion

INST_NAME("PMOVMSKB Gd, Ex");
nextop = F8;
SET_ELEMENT_WIDTH(x1, VECTOR_SEW8, 1);
GETGD;
GETEX_vector(q0, 0, 0, VECTOR_SEW8);
v0 = fpu_get_scratch(dyn);
v0 = fpu_get_scratch_lmul(dyn, VECTOR_LMUL8);
VSRL_VI(v0, q0, 7, VECTOR_UNMASKED);
if (rv64_xtheadvector) {
// Force VMASK element size to 1bit
vector_vsetvli(dyn, ninst, x4, VECTOR_SEW8, VECTOR_LMUL8, 1);
}
VMSNE_VX(VMASK, v0, xZR, VECTOR_UNMASKED);
SET_ELEMENT_WIDTH(x1, VECTOR_SEW16, 1);
VMV_X_S(gd, VMASK);
ZEXTH(gd, gd);
if (!rv64_xtheadvector) { ZEXTH(gd, gd); }
break;
case 0xD8:
case 0xD9:
Expand Down
2 changes: 1 addition & 1 deletion src/dynarec/rv64/dynarec_rv64_helper.c
Original file line number Diff line number Diff line change
Expand Up @@ -2609,7 +2609,7 @@ int vector_vsetvli(dynarec_rv64_t* dyn, int ninst, int s1, int sew, int vlmul, f

uint32_t vl = (int)((float)(16 >> sew) * multiple);
uint32_t vtypei = (sew << (3 - !!rv64_xtheadvector)) | vlmul;
if (dyn->inst_sew == VECTOR_SEWNA || dyn->inst_vl == 0 || dyn->inst_sew != sew || dyn->inst_vl != vl) {
if (dyn->inst_sew == VECTOR_SEWNA || dyn->inst_vl == 0 || dyn->inst_sew != sew || dyn->inst_vl != vl || dyn->inst_vlmul != vlmul) {
if (vl <= 31 && !rv64_xtheadvector) {
VSETIVLI(xZR, vl, vtypei);
} else {
Expand Down
1 change: 1 addition & 0 deletions src/dynarec/rv64/rv64_emitter.h
Original file line number Diff line number Diff line change
Expand Up @@ -1630,6 +1630,7 @@ f28–31 ft8–11 FP temporaries Caller
#define VAADDU_VV(vd, vs2, vs1, vm) EMIT(R_type(0b0010000 | (vm), vs2, vs1, 0b010, vd, 0b1010111)) // 001000...........010.....1010111
#define VASUBU_VV(vd, vs2, vs1, vm) EMIT(R_type(0b0010100 | (vm), vs2, vs1, 0b010, vd, 0b1010111)) // 001010...........010.....1010111

// Warning: zero-extended on xtheadvector!
#define VMV_X_S(rd, vs2) EMIT(R_type((rv64_xtheadvector ? 0b0011001 : 0b0100001), vs2, 0b00000, 0b010, rd, 0b1010111)) // 0100001.....00000010.....1010111

// Vector Integer Extension Instructions
Expand Down

0 comments on commit c16d512

Please sign in to comment.