Skip to content

Commit 827f0ee

Browse files
zengdageksco
authored andcommitted
[RV64_DYNAREC] Optimitize VSHUFPS and VPERMILPS 128-bit case
1 parent 0b0a31c commit 827f0ee

2 files changed

Lines changed: 18 additions & 10 deletions

File tree

‎src/dynarec/rv64/dynarec_rv64_avx_0f_vector.c‎

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -520,11 +520,15 @@ uintptr_t dynarec64_AVX_0F_vector(dynarec_rv64_t* dyn, uintptr_t addr, uintptr_t
520520
v2 = fpu_get_scratch(dyn);
521521
MOV64x(x4, (uint64_t)(u8 & 3) | ((uint64_t)((u8 >> 2) & 3) << 16) | ((uint64_t)((u8 >> 4) & 3) << 32) | ((uint64_t)((u8 >> 6) & 3) << 48));
522522
vector_vsetvli(dyn, ninst, x1, VECTOR_SEW64, VECTOR_LMUL1, 1);
523-
VMV_V_X(q2, x4);
524-
vector_vsetvli(dyn, ninst, x1, VECTOR_SEW16, VECTOR_LMUL1, 1);
525-
VID_V(VMASK, VECTOR_UNMASKED);
526-
VMSGT_VI(VMASK, VMASK, 3, VECTOR_UNMASKED);
527-
VOR_VI(q2, q2, 4, VECTOR_MASKED);
523+
if (vex.l) {
524+
VMV_V_X(q2, x4);
525+
vector_vsetvli(dyn, ninst, x1, VECTOR_SEW16, VECTOR_LMUL1, 1);
526+
VID_V(VMASK, VECTOR_UNMASKED);
527+
VMSGT_VI(VMASK, VMASK, 3, VECTOR_UNMASKED);
528+
VOR_VI(q2, q2, 4, VECTOR_MASKED);
529+
} else {
530+
VMV_S_X(q2, x4);
531+
}
528532
avx_set_vector_width(dyn, ninst, x1, VECTOR_SEW32, 16 << vex.l);
529533
VRGATHEREI16_VV(v1, q0, q2, VECTOR_UNMASKED);
530534
VRGATHEREI16_VV(v2, q1, q2, VECTOR_UNMASKED);

‎src/dynarec/rv64/dynarec_rv64_avx_66_0f3a_vector.c‎

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -96,11 +96,15 @@ uintptr_t dynarec64_AVX_66_0F3A_vector(dynarec_rv64_t* dyn, uintptr_t addr, uint
9696
q1 = fpu_get_scratch(dyn);
9797
MOV64x(x4, (uint64_t)(u8 & 3) | ((uint64_t)((u8 >> 2) & 3) << 16) | ((uint64_t)((u8 >> 4) & 3) << 32) | ((uint64_t)((u8 >> 6) & 3) << 48));
9898
vector_vsetvli(dyn, ninst, x1, VECTOR_SEW64, VECTOR_LMUL1, 1);
99-
VMV_V_X(q1, x4);
100-
vector_vsetvli(dyn, ninst, x1, VECTOR_SEW16, VECTOR_LMUL1, 1);
101-
VID_V(VMASK, VECTOR_UNMASKED);
102-
VMSGT_VI(VMASK, VMASK, 3, VECTOR_UNMASKED);
103-
VOR_VI(q1, q1, 4, VECTOR_MASKED);
99+
if (vex.l) {
100+
VMV_V_X(q1, x4);
101+
vector_vsetvli(dyn, ninst, x1, VECTOR_SEW16, VECTOR_LMUL1, 1);
102+
VID_V(VMASK, VECTOR_UNMASKED);
103+
VMSGT_VI(VMASK, VMASK, 3, VECTOR_UNMASKED);
104+
VOR_VI(q1, q1, 4, VECTOR_MASKED);
105+
} else {
106+
VMV_S_X(q1, x4);
107+
}
104108
avx_set_vector_width(dyn, ninst, x1, VECTOR_SEW32, 16 << vex.l);
105109
VRGATHEREI16_VV(v0, q0, q1, VECTOR_UNMASKED);
106110
PUTGY_vector(v0, VECTOR_SEW32);

0 commit comments

Comments
 (0)