target/loongarch: Implement xvmskltz/xvmskgez/xvmsknz

This patch includes:
- XVMSKLTZ.{B/H/W/D};
- XVMSKGEZ.B;
- XVMSKNZ.B.

Signed-off-by: Song Gao <gaosong@loongson.cn>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <20230914022645.1151356-33-gaosong@loongson.cn>
This commit is contained in:
Song Gao 2023-09-14 10:26:20 +08:00
parent 3a2752179a
commit 97074674a9
No known key found for this signature in database
GPG key ID: 40A2FFF239263EDF
4 changed files with 74 additions and 24 deletions

View file

@ -2015,6 +2015,13 @@ INSN_LASX(xvsigncov_h, vvv)
INSN_LASX(xvsigncov_w, vvv)
INSN_LASX(xvsigncov_d, vvv)
INSN_LASX(xvmskltz_b, vv)
INSN_LASX(xvmskltz_h, vv)
INSN_LASX(xvmskltz_w, vv)
INSN_LASX(xvmskltz_d, vv)
INSN_LASX(xvmskgez_b, vv)
INSN_LASX(xvmsknz_b, vv)
INSN_LASX(xvreplgr2vr_b, vr)
INSN_LASX(xvreplgr2vr_h, vr)
INSN_LASX(xvreplgr2vr_w, vr)

View file

@ -3423,6 +3423,12 @@ TRANS(vmskltz_w, LSX, gen_vv, gen_helper_vmskltz_w)
TRANS(vmskltz_d, LSX, gen_vv, gen_helper_vmskltz_d)
TRANS(vmskgez_b, LSX, gen_vv, gen_helper_vmskgez_b)
TRANS(vmsknz_b, LSX, gen_vv, gen_helper_vmsknz_b)
TRANS(xvmskltz_b, LASX, gen_xx, gen_helper_vmskltz_b)
TRANS(xvmskltz_h, LASX, gen_xx, gen_helper_vmskltz_h)
TRANS(xvmskltz_w, LASX, gen_xx, gen_helper_vmskltz_w)
TRANS(xvmskltz_d, LASX, gen_xx, gen_helper_vmskltz_d)
TRANS(xvmskgez_b, LASX, gen_xx, gen_helper_vmskgez_b)
TRANS(xvmsknz_b, LASX, gen_xx, gen_helper_vmsknz_b)
#define EXPAND_BYTE(bit) ((uint64_t)(bit ? 0xff : 0))

View file

@ -1598,6 +1598,13 @@ xvsigncov_h 0111 01010010 11101 ..... ..... ..... @vvv
xvsigncov_w 0111 01010010 11110 ..... ..... ..... @vvv
xvsigncov_d 0111 01010010 11111 ..... ..... ..... @vvv
xvmskltz_b 0111 01101001 11000 10000 ..... ..... @vv
xvmskltz_h 0111 01101001 11000 10001 ..... ..... @vv
xvmskltz_w 0111 01101001 11000 10010 ..... ..... @vv
xvmskltz_d 0111 01101001 11000 10011 ..... ..... @vv
xvmskgez_b 0111 01101001 11000 10100 ..... ..... @vv
xvmsknz_b 0111 01101001 11000 11000 ..... ..... @vv
xvreplgr2vr_b 0111 01101001 11110 00000 ..... ..... @vr
xvreplgr2vr_h 0111 01101001 11110 00001 ..... ..... @vr
xvreplgr2vr_w 0111 01101001 11110 00010 ..... ..... @vr

View file

@ -810,14 +810,19 @@ static uint64_t do_vmskltz_b(int64_t val)
void HELPER(vmskltz_b)(void *vd, void *vj, uint32_t desc)
{
int i;
uint16_t temp = 0;
VReg *Vd = (VReg *)vd;
VReg *Vj = (VReg *)vj;
int oprsz = simd_oprsz(desc);
temp = do_vmskltz_b(Vj->D(0));
temp |= (do_vmskltz_b(Vj->D(1)) << 8);
Vd->D(0) = temp;
Vd->D(1) = 0;
for (i = 0; i < oprsz / 16; i++) {
temp = 0;
temp = do_vmskltz_b(Vj->D(2 * i));
temp |= (do_vmskltz_b(Vj->D(2 * i + 1)) << 8);
Vd->D(2 * i) = temp;
Vd->D(2 * i + 1) = 0;
}
}
static uint64_t do_vmskltz_h(int64_t val)
@ -831,14 +836,19 @@ static uint64_t do_vmskltz_h(int64_t val)
void HELPER(vmskltz_h)(void *vd, void *vj, uint32_t desc)
{
int i;
uint16_t temp = 0;
VReg *Vd = (VReg *)vd;
VReg *Vj = (VReg *)vj;
int oprsz = simd_oprsz(desc);
temp = do_vmskltz_h(Vj->D(0));
temp |= (do_vmskltz_h(Vj->D(1)) << 4);
Vd->D(0) = temp;
Vd->D(1) = 0;
for (i = 0; i < oprsz / 16; i++) {
temp = 0;
temp = do_vmskltz_h(Vj->D(2 * i));
temp |= (do_vmskltz_h(Vj->D(2 * i + 1)) << 4);
Vd->D(2 * i) = temp;
Vd->D(2 * i + 1) = 0;
}
}
static uint64_t do_vmskltz_w(int64_t val)
@ -851,14 +861,19 @@ static uint64_t do_vmskltz_w(int64_t val)
void HELPER(vmskltz_w)(void *vd, void *vj, uint32_t desc)
{
int i;
uint16_t temp = 0;
VReg *Vd = (VReg *)vd;
VReg *Vj = (VReg *)vj;
int oprsz = simd_oprsz(desc);
temp = do_vmskltz_w(Vj->D(0));
temp |= (do_vmskltz_w(Vj->D(1)) << 2);
Vd->D(0) = temp;
Vd->D(1) = 0;
for (i = 0; i < oprsz / 16; i++) {
temp = 0;
temp = do_vmskltz_w(Vj->D(2 * i));
temp |= (do_vmskltz_w(Vj->D(2 * i + 1)) << 2);
Vd->D(2 * i) = temp;
Vd->D(2 * i + 1) = 0;
}
}
static uint64_t do_vmskltz_d(int64_t val)
@ -867,26 +882,36 @@ static uint64_t do_vmskltz_d(int64_t val)
}
void HELPER(vmskltz_d)(void *vd, void *vj, uint32_t desc)
{
int i;
uint16_t temp = 0;
VReg *Vd = (VReg *)vd;
VReg *Vj = (VReg *)vj;
int oprsz = simd_oprsz(desc);
temp = do_vmskltz_d(Vj->D(0));
temp |= (do_vmskltz_d(Vj->D(1)) << 1);
Vd->D(0) = temp;
Vd->D(1) = 0;
for (i = 0; i < oprsz / 16; i++) {
temp = 0;
temp = do_vmskltz_d(Vj->D(2 * i));
temp |= (do_vmskltz_d(Vj->D(2 * i + 1)) << 1);
Vd->D(2 * i) = temp;
Vd->D(2 * i + 1) = 0;
}
}
void HELPER(vmskgez_b)(void *vd, void *vj, uint32_t desc)
{
int i;
uint16_t temp = 0;
VReg *Vd = (VReg *)vd;
VReg *Vj = (VReg *)vj;
int oprsz = simd_oprsz(desc);
temp = do_vmskltz_b(Vj->D(0));
temp |= (do_vmskltz_b(Vj->D(1)) << 8);
Vd->D(0) = (uint16_t)(~temp);
Vd->D(1) = 0;
for (i = 0; i < oprsz / 16; i++) {
temp = 0;
temp = do_vmskltz_b(Vj->D(2 * i));
temp |= (do_vmskltz_b(Vj->D(2 * i + 1)) << 8);
Vd->D(2 * i) = (uint16_t)(~temp);
Vd->D(2 * i + 1) = 0;
}
}
static uint64_t do_vmskez_b(uint64_t a)
@ -901,14 +926,19 @@ static uint64_t do_vmskez_b(uint64_t a)
void HELPER(vmsknz_b)(void *vd, void *vj, uint32_t desc)
{
int i;
uint16_t temp = 0;
VReg *Vd = (VReg *)vd;
VReg *Vj = (VReg *)vj;
int oprsz = simd_oprsz(desc);
temp = do_vmskez_b(Vj->D(0));
temp |= (do_vmskez_b(Vj->D(1)) << 8);
Vd->D(0) = (uint16_t)(~temp);
Vd->D(1) = 0;
for (i = 0; i < oprsz / 16; i++) {
temp = 0;
temp = do_vmskez_b(Vj->D(2 * i));
temp |= (do_vmskez_b(Vj->D(2 * i + 1)) << 8);
Vd->D(2 * i) = (uint16_t)(~temp);
Vd->D(2 * i + 1) = 0;
}
}
void HELPER(vnori_b)(void *vd, void *vj, uint64_t imm, uint32_t v)