mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-07 01:33:56 -06:00
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>
This commit is contained in:
parent
99082815f1
commit
5e56086423
4 changed files with 64 additions and 29 deletions
|
@ -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);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue