mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-04 00:03:54 -06:00
target/loongarch: Implement vsat
This patch includes: - VSAT.{B/H/W/D}[U]. Reviewed-by: Richard Henderson <richard.henderson@linaro.org> Signed-off-by: Song Gao <gaosong@loongson.cn> Message-Id: <20230504122810.4094787-18-gaosong@loongson.cn>
This commit is contained in:
parent
4cc4c0f78b
commit
cbe44190cc
5 changed files with 168 additions and 0 deletions
|
@ -590,3 +590,40 @@ VDIV(vmod_bu, 8, UB, DO_REMU)
|
|||
VDIV(vmod_hu, 16, UH, DO_REMU)
|
||||
VDIV(vmod_wu, 32, UW, DO_REMU)
|
||||
VDIV(vmod_du, 64, UD, DO_REMU)
|
||||
|
||||
#define VSAT_S(NAME, BIT, E) \
|
||||
void HELPER(NAME)(void *vd, void *vj, uint64_t max, uint32_t v) \
|
||||
{ \
|
||||
int i; \
|
||||
VReg *Vd = (VReg *)vd; \
|
||||
VReg *Vj = (VReg *)vj; \
|
||||
typedef __typeof(Vd->E(0)) TD; \
|
||||
\
|
||||
for (i = 0; i < LSX_LEN/BIT; i++) { \
|
||||
Vd->E(i) = Vj->E(i) > (TD)max ? (TD)max : \
|
||||
Vj->E(i) < (TD)~max ? (TD)~max: Vj->E(i); \
|
||||
} \
|
||||
}
|
||||
|
||||
VSAT_S(vsat_b, 8, B)
|
||||
VSAT_S(vsat_h, 16, H)
|
||||
VSAT_S(vsat_w, 32, W)
|
||||
VSAT_S(vsat_d, 64, D)
|
||||
|
||||
#define VSAT_U(NAME, BIT, E) \
|
||||
void HELPER(NAME)(void *vd, void *vj, uint64_t max, uint32_t v) \
|
||||
{ \
|
||||
int i; \
|
||||
VReg *Vd = (VReg *)vd; \
|
||||
VReg *Vj = (VReg *)vj; \
|
||||
typedef __typeof(Vd->E(0)) TD; \
|
||||
\
|
||||
for (i = 0; i < LSX_LEN/BIT; i++) { \
|
||||
Vd->E(i) = Vj->E(i) > (TD)max ? (TD)max : Vj->E(i); \
|
||||
} \
|
||||
}
|
||||
|
||||
VSAT_U(vsat_bu, 8, UB)
|
||||
VSAT_U(vsat_hu, 16, UH)
|
||||
VSAT_U(vsat_wu, 32, UW)
|
||||
VSAT_U(vsat_du, 64, UD)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue