[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 29/34] target/ppc: implement addg6s
From: |
Daniel Henrique Barboza |
Subject: |
[PULL 29/34] target/ppc: implement addg6s |
Date: |
Wed, 6 Jul 2022 17:09:41 -0300 |
From: Matheus Ferst <matheus.ferst@eldorado.org.br>
Implements the following Power ISA v2.06 instruction:
addg6s: Add and Generate Sixes
Signed-off-by: Matheus Ferst <matheus.ferst@eldorado.org.br>
Signed-off-by: Víctor Colombo <victor.colombo@eldorado.org.br>
Reviewed-by: Víctor Colombo <victor.colombo@eldorado.org.br>
Message-Id: <20220629162904.105060-10-victor.colombo@eldorado.org.br>
Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com>
---
target/ppc/insn32.decode | 4 +++
target/ppc/translate/fixedpoint-impl.c.inc | 37 ++++++++++++++++++++++
2 files changed, 41 insertions(+)
diff --git a/target/ppc/insn32.decode b/target/ppc/insn32.decode
index e5770bcc16..af8ba9ca9b 100644
--- a/target/ppc/insn32.decode
+++ b/target/ppc/insn32.decode
@@ -311,6 +311,10 @@ CNTTZDM 011111 ..... ..... ..... 1000111011 - @X
PDEPD 011111 ..... ..... ..... 0010011100 - @X
PEXTD 011111 ..... ..... ..... 0010111100 - @X
+## BCD Assist
+
+ADDG6S 011111 ..... ..... ..... - 001001010 - @X
+
### Float-Point Load Instructions
LFS 110000 ..... ..... ................ @D
diff --git a/target/ppc/translate/fixedpoint-impl.c.inc
b/target/ppc/translate/fixedpoint-impl.c.inc
index 1aab32be03..490e49cfc7 100644
--- a/target/ppc/translate/fixedpoint-impl.c.inc
+++ b/target/ppc/translate/fixedpoint-impl.c.inc
@@ -492,3 +492,40 @@ static bool trans_PEXTD(DisasContext *ctx, arg_X *a)
#endif
return true;
}
+
+static bool trans_ADDG6S(DisasContext *ctx, arg_X *a)
+{
+ const uint64_t carry_bits = 0x1111111111111111ULL;
+ TCGv t0, t1, carry, zero = tcg_constant_tl(0);
+
+ REQUIRE_INSNS_FLAGS2(ctx, BCDA_ISA206);
+
+ t0 = tcg_temp_new();
+ t1 = tcg_const_tl(0);
+ carry = tcg_const_tl(0);
+
+ for (int i = 0; i < 16; i++) {
+ tcg_gen_shri_tl(t0, cpu_gpr[a->ra], i * 4);
+ tcg_gen_andi_tl(t0, t0, 0xf);
+ tcg_gen_add_tl(t1, t1, t0);
+
+ tcg_gen_shri_tl(t0, cpu_gpr[a->rb], i * 4);
+ tcg_gen_andi_tl(t0, t0, 0xf);
+ tcg_gen_add_tl(t1, t1, t0);
+
+ tcg_gen_andi_tl(t1, t1, 0x10);
+ tcg_gen_setcond_tl(TCG_COND_NE, t1, t1, zero);
+
+ tcg_gen_shli_tl(t0, t1, i * 4);
+ tcg_gen_or_tl(carry, carry, t0);
+ }
+
+ tcg_gen_xori_tl(carry, carry, (target_long)carry_bits);
+ tcg_gen_muli_tl(cpu_gpr[a->rt], carry, 6);
+
+ tcg_temp_free(t0);
+ tcg_temp_free(t1);
+ tcg_temp_free(carry);
+
+ return true;
+}
--
2.36.1
- [PULL 12/34] target/ppc: use int128.h methods in vpmsumd, (continued)
- [PULL 12/34] target/ppc: use int128.h methods in vpmsumd, Daniel Henrique Barboza, 2022/07/06
- [PULL 18/34] target/ppc: use int128.h methods in vsubcuq, Daniel Henrique Barboza, 2022/07/06
- [PULL 26/34] target/ppc: Implement mffscdrn[i] instructions, Daniel Henrique Barboza, 2022/07/06
- [PULL 30/34] target/ppc: implement cbcdtd, Daniel Henrique Barboza, 2022/07/06
- [PULL 21/34] target/ppc: Fix insn32.decode style issues, Daniel Henrique Barboza, 2022/07/06
- [PULL 22/34] target/ppc: Move mffscrn[i] to decodetree, Daniel Henrique Barboza, 2022/07/06
- [PULL 14/34] target/ppc: use int128.h methods in vaddecuq and vaddeuqm, Daniel Henrique Barboza, 2022/07/06
- [PULL 25/34] target/ppc: Move mffs[.] to decodetree, Daniel Henrique Barboza, 2022/07/06
- [PULL 27/34] tests/tcg/ppc64: Add mffsce test, Daniel Henrique Barboza, 2022/07/06
- [PULL 24/34] target/ppc: Move mffsl to decodetree, Daniel Henrique Barboza, 2022/07/06
- [PULL 29/34] target/ppc: implement addg6s,
Daniel Henrique Barboza <=
- [PULL 28/34] target/ppc: Add flag for ISA v2.06 BCDA instructions, Daniel Henrique Barboza, 2022/07/06
- [PULL 31/34] target/ppc: implement cdtbcd, Daniel Henrique Barboza, 2022/07/06
- [PULL 32/34] target/ppc: Return default CPU for max CPU, Daniel Henrique Barboza, 2022/07/06
- [PULL 33/34] target/ppc/cpu-models: Remove the "default" CPU alias, Daniel Henrique Barboza, 2022/07/06
- [PULL 34/34] target/ppc: Fix MPC8555 and MPC8560 core type to e500v1, Daniel Henrique Barboza, 2022/07/06
- Re: [PULL 00/34] ppc queue, Richard Henderson, 2022/07/06