aboutsummaryrefslogtreecommitdiff
path: root/target/hppa/translate.c
diff options
context:
space:
mode:
authorRichard Henderson <richard.henderson@linaro.org>2019-02-21 15:29:39 -0800
committerRichard Henderson <richard.henderson@linaro.org>2019-03-07 17:43:12 -0800
commitb35aec8597e86911d5553c94769f914a52a8b389 (patch)
tree1d90c09eb3ce634d587b99102106e55525004064 /target/hppa/translate.c
parent993119fe584c3d0bc48ae9d5ed742a6bdec3d3eb (diff)
target/hppa: Optimize blr r0,rn
We can eliminate an extra TB in this case, which merely loads a "return address" into rn. Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Diffstat (limited to 'target/hppa/translate.c')
-rw-r--r--target/hppa/translate.c16
1 files changed, 10 insertions, 6 deletions
diff --git a/target/hppa/translate.c b/target/hppa/translate.c
index dad8ce563c..dc5636fe94 100644
--- a/target/hppa/translate.c
+++ b/target/hppa/translate.c
@@ -3488,12 +3488,16 @@ static bool trans_b_gate(DisasContext *ctx, arg_b_gate *a)
static bool trans_blr(DisasContext *ctx, arg_blr *a)
{
- TCGv_reg tmp = get_temp(ctx);
-
- tcg_gen_shli_reg(tmp, load_gpr(ctx, a->x), 3);
- tcg_gen_addi_reg(tmp, tmp, ctx->iaoq_f + 8);
- /* The computation here never changes privilege level. */
- return do_ibranch(ctx, tmp, a->l, a->n);
+ if (a->x) {
+ TCGv_reg tmp = get_temp(ctx);
+ tcg_gen_shli_reg(tmp, load_gpr(ctx, a->x), 3);
+ tcg_gen_addi_reg(tmp, tmp, ctx->iaoq_f + 8);
+ /* The computation here never changes privilege level. */
+ return do_ibranch(ctx, tmp, a->l, a->n);
+ } else {
+ /* BLR R0,RX is a good way to load PC+8 into RX. */
+ return do_dbranch(ctx, ctx->iaoq_f + 8, a->l, a->n);
+ }
}
static bool trans_bv(DisasContext *ctx, arg_bv *a)