aboutsummaryrefslogtreecommitdiff
path: root/target/ppc/translate/fixedpoint-impl.c.inc
diff options
context:
space:
mode:
authorRichard Henderson <richard.henderson@linaro.org>2021-06-01 16:35:18 -0300
committerDavid Gibson <david@gibson.dropbear.id.au>2021-06-03 18:10:31 +1000
commit5e560864234e78461879c632c414e4fe97a9a506 (patch)
tree78f7450611e3f29d29c1a0e3f1b93a1d54b1f515 /target/ppc/translate/fixedpoint-impl.c.inc
parent99082815f17f40d3527b281c7e3e6e5556fad8f1 (diff)
downloadqemu-5e560864234e78461879c632c414e4fe97a9a506.zip
qemu-5e560864234e78461879c632c414e4fe97a9a506.tar.gz
qemu-5e560864234e78461879c632c414e4fe97a9a506.tar.bz2
target/ppc: Move ADDI, ADDIS to decodetree, implement PADDI
Signed-off-by: Richard Henderson <richard.henderson@linaro.org> Signed-off-by: Matheus Ferst <matheus.ferst@eldorado.org.br> Message-Id: <20210601193528.2533031-5-matheus.ferst@eldorado.org.br> Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Diffstat (limited to 'target/ppc/translate/fixedpoint-impl.c.inc')
-rw-r--r--target/ppc/translate/fixedpoint-impl.c.inc44
1 files changed, 44 insertions, 0 deletions
diff --git a/target/ppc/translate/fixedpoint-impl.c.inc b/target/ppc/translate/fixedpoint-impl.c.inc
index be75085..344a3ed 100644
--- a/target/ppc/translate/fixedpoint-impl.c.inc
+++ b/target/ppc/translate/fixedpoint-impl.c.inc
@@ -16,3 +16,47 @@
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, see <http://www.gnu.org/licenses/>.
*/
+
+/*
+ * Incorporate CIA into the constant when R=1.
+ * Validate that when R=1, RA=0.
+ */
+static bool resolve_PLS_D(DisasContext *ctx, arg_D *d, arg_PLS_D *a)
+{
+ d->rt = a->rt;
+ d->ra = a->ra;
+ d->si = a->si;
+ if (a->r) {
+ if (unlikely(a->ra != 0)) {
+ gen_invalid(ctx);
+ return false;
+ }
+ d->si += ctx->cia;
+ }
+ return true;
+}
+
+static bool trans_ADDI(DisasContext *ctx, arg_D *a)
+{
+ if (a->ra) {
+ tcg_gen_addi_tl(cpu_gpr[a->rt], cpu_gpr[a->ra], a->si);
+ } else {
+ tcg_gen_movi_tl(cpu_gpr[a->rt], a->si);
+ }
+ return true;
+}
+
+static bool trans_PADDI(DisasContext *ctx, arg_PLS_D *a)
+{
+ arg_D d;
+ if (!resolve_PLS_D(ctx, &d, a)) {
+ return true;
+ }
+ return trans_ADDI(ctx, &d);
+}
+
+static bool trans_ADDIS(DisasContext *ctx, arg_D *a)
+{
+ a->si <<= 16;
+ return trans_ADDI(ctx, a);
+}