mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-03 07:43:54 -06:00
target/loongarch: Implement vfrstp
This patch includes: - VFRSTP[I].{B/H}. Acked-by: Richard Henderson <richard.henderson@linaro.org> Signed-off-by: Song Gao <gaosong@loongson.cn> Message-Id: <20230504122810.4094787-33-gaosong@loongson.cn>
This commit is contained in:
parent
0b1e67051d
commit
ac95a0b975
5 changed files with 61 additions and 0 deletions
|
@ -2019,3 +2019,44 @@ DO_BITI(vbitrevi_b, 8, UB, DO_BITREV)
|
|||
DO_BITI(vbitrevi_h, 16, UH, DO_BITREV)
|
||||
DO_BITI(vbitrevi_w, 32, UW, DO_BITREV)
|
||||
DO_BITI(vbitrevi_d, 64, UD, DO_BITREV)
|
||||
|
||||
#define VFRSTP(NAME, BIT, MASK, E) \
|
||||
void HELPER(NAME)(CPULoongArchState *env, \
|
||||
uint32_t vd, uint32_t vj, uint32_t vk) \
|
||||
{ \
|
||||
int i, m; \
|
||||
VReg *Vd = &(env->fpr[vd].vreg); \
|
||||
VReg *Vj = &(env->fpr[vj].vreg); \
|
||||
VReg *Vk = &(env->fpr[vk].vreg); \
|
||||
\
|
||||
for (i = 0; i < LSX_LEN/BIT; i++) { \
|
||||
if (Vj->E(i) < 0) { \
|
||||
break; \
|
||||
} \
|
||||
} \
|
||||
m = Vk->E(0) & MASK; \
|
||||
Vd->E(m) = i; \
|
||||
}
|
||||
|
||||
VFRSTP(vfrstp_b, 8, 0xf, B)
|
||||
VFRSTP(vfrstp_h, 16, 0x7, H)
|
||||
|
||||
#define VFRSTPI(NAME, BIT, E) \
|
||||
void HELPER(NAME)(CPULoongArchState *env, \
|
||||
uint32_t vd, uint32_t vj, uint32_t imm) \
|
||||
{ \
|
||||
int i, m; \
|
||||
VReg *Vd = &(env->fpr[vd].vreg); \
|
||||
VReg *Vj = &(env->fpr[vj].vreg); \
|
||||
\
|
||||
for (i = 0; i < LSX_LEN/BIT; i++) { \
|
||||
if (Vj->E(i) < 0) { \
|
||||
break; \
|
||||
} \
|
||||
} \
|
||||
m = imm % (LSX_LEN/BIT); \
|
||||
Vd->E(m) = i; \
|
||||
}
|
||||
|
||||
VFRSTPI(vfrstpi_b, 8, B)
|
||||
VFRSTPI(vfrstpi_h, 16, H)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue