[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v5 16/49] target/ppc: implement vclrrb
From: |
matheus . ferst |
Subject: |
[PATCH v5 16/49] target/ppc: implement vclrrb |
Date: |
Fri, 25 Feb 2022 18:09:03 -0300 |
From: Matheus Ferst <matheus.ferst@eldorado.org.br>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: Matheus Ferst <matheus.ferst@eldorado.org.br>
---
target/ppc/insn32.decode | 1 +
target/ppc/translate/vmx-impl.c.inc | 32 +++++++++++++++++++++--------
2 files changed, 25 insertions(+), 8 deletions(-)
diff --git a/target/ppc/insn32.decode b/target/ppc/insn32.decode
index 31cdbba86b..b20f1eaa8e 100644
--- a/target/ppc/insn32.decode
+++ b/target/ppc/insn32.decode
@@ -530,6 +530,7 @@ VSTRIHL 000100 ..... 00010 ..... . 0000001101
@VX_tb_rc
VSTRIHR 000100 ..... 00011 ..... . 0000001101 @VX_tb_rc
VCLRLB 000100 ..... ..... ..... 00110001101 @VX
+VCLRRB 000100 ..... ..... ..... 00111001101 @VX
# VSX Load/Store Instructions
diff --git a/target/ppc/translate/vmx-impl.c.inc
b/target/ppc/translate/vmx-impl.c.inc
index d43fba00ed..4db5656669 100644
--- a/target/ppc/translate/vmx-impl.c.inc
+++ b/target/ppc/translate/vmx-impl.c.inc
@@ -1940,7 +1940,7 @@ TRANS(VSTRIBR, do_vstri, gen_helper_VSTRIBR)
TRANS(VSTRIHL, do_vstri, gen_helper_VSTRIHL)
TRANS(VSTRIHR, do_vstri, gen_helper_VSTRIHR)
-static bool trans_VCLRLB(DisasContext *ctx, arg_VX *a)
+static bool do_vclrb(DisasContext *ctx, arg_VX *a, bool right)
{
TCGv_i64 rb, mh, ml, tmp,
ones = tcg_constant_i64(-1),
@@ -1954,15 +1954,28 @@ static bool trans_VCLRLB(DisasContext *ctx, arg_VX *a)
tcg_gen_extu_tl_i64(rb, cpu_gpr[a->vrb]);
tcg_gen_andi_i64(tmp, rb, 7);
tcg_gen_shli_i64(tmp, tmp, 3);
- tcg_gen_shl_i64(tmp, ones, tmp);
+ if (right) {
+ tcg_gen_shr_i64(tmp, ones, tmp);
+ } else {
+ tcg_gen_shl_i64(tmp, ones, tmp);
+ }
tcg_gen_not_i64(tmp, tmp);
- tcg_gen_movcond_i64(TCG_COND_LTU, ml, rb, tcg_constant_i64(8),
- tmp, ones);
- tcg_gen_movcond_i64(TCG_COND_LTU, mh, rb, tcg_constant_i64(8),
- zero, tmp);
- tcg_gen_movcond_i64(TCG_COND_LTU, mh, rb, tcg_constant_i64(16),
- mh, ones);
+ if (right) {
+ tcg_gen_movcond_i64(TCG_COND_LTU, mh, rb, tcg_constant_i64(8),
+ tmp, ones);
+ tcg_gen_movcond_i64(TCG_COND_LTU, ml, rb, tcg_constant_i64(8),
+ zero, tmp);
+ tcg_gen_movcond_i64(TCG_COND_LTU, ml, rb, tcg_constant_i64(16),
+ ml, ones);
+ } else {
+ tcg_gen_movcond_i64(TCG_COND_LTU, ml, rb, tcg_constant_i64(8),
+ tmp, ones);
+ tcg_gen_movcond_i64(TCG_COND_LTU, mh, rb, tcg_constant_i64(8),
+ zero, tmp);
+ tcg_gen_movcond_i64(TCG_COND_LTU, mh, rb, tcg_constant_i64(16),
+ mh, ones);
+ }
get_avr64(tmp, a->vra, true);
tcg_gen_and_i64(tmp, tmp, mh);
@@ -1980,6 +1993,9 @@ static bool trans_VCLRLB(DisasContext *ctx, arg_VX *a)
return true;
}
+TRANS(VCLRLB, do_vclrb, false)
+TRANS(VCLRRB, do_vclrb, true)
+
#define GEN_VAFORM_PAIRED(name0, name1, opc2) \
static void glue(gen_, name0##_##name1)(DisasContext *ctx) \
{ \
--
2.25.1
- [PATCH v5 06/49] target/ppc: Implement vmsumudm instruction, (continued)
- [PATCH v5 06/49] target/ppc: Implement vmsumudm instruction, matheus . ferst, 2022/02/25
- [PATCH v5 07/49] target/ppc: Move vexts[bhw]2[wd] to decodetree, matheus . ferst, 2022/02/25
- [PATCH v5 08/49] target/ppc: Implement vextsd2q, matheus . ferst, 2022/02/25
- [PATCH v5 09/49] target/ppc: Move Vector Compare Equal/Not Equal/Greater Than to decodetree, matheus . ferst, 2022/02/25
- [PATCH v5 10/49] target/ppc: Move Vector Compare Not Equal or Zero to decodetree, matheus . ferst, 2022/02/25
- [PATCH v5 12/49] target/ppc: Implement Vector Compare Greater Than Quadword, matheus . ferst, 2022/02/25
- [PATCH v5 11/49] target/ppc: Implement Vector Compare Equal Quadword, matheus . ferst, 2022/02/25
- [PATCH v5 14/49] target/ppc: implement vstri[bh][lr], matheus . ferst, 2022/02/25
- [PATCH v5 13/49] target/ppc: Implement Vector Compare Quadword, matheus . ferst, 2022/02/25
- [PATCH v5 15/49] target/ppc: implement vclrlb, matheus . ferst, 2022/02/25
- [PATCH v5 16/49] target/ppc: implement vclrrb,
matheus . ferst <=
- [PATCH v5 17/49] target/ppc: implement vcntmb[bhwd], matheus . ferst, 2022/02/25
- [PATCH v5 19/49] target/ppc: move vs[lr][a][bhwd] to decodetree, matheus . ferst, 2022/02/25
- [PATCH v5 18/49] target/ppc: implement vgnb, matheus . ferst, 2022/02/25
- [PATCH v5 21/49] target/ppc: implement vsrq, matheus . ferst, 2022/02/25
- [PATCH v5 20/49] target/ppc: implement vslq, matheus . ferst, 2022/02/25
- [PATCH v5 22/49] target/ppc: implement vsraq, matheus . ferst, 2022/02/25
- [PATCH v5 23/49] target/ppc: move vrl[bhwd] to decodetree, matheus . ferst, 2022/02/25
- [PATCH v5 24/49] target/ppc: move vrl[bhwd]nm/vrl[bhwd]mi to decodetree, matheus . ferst, 2022/02/25
- [PATCH v5 25/49] target/ppc: implement vrlq, matheus . ferst, 2022/02/25