Revisión | b35aec8597e86911d5553c94769f914a52a8b389 (tree) |
---|---|
Tiempo | 2019-03-08 10:43:12 |
Autor | Richard Henderson <richard.henderson@lina...> |
Commiter | Richard Henderson |
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>
@@ -3488,12 +3488,16 @@ static bool trans_b_gate(DisasContext *ctx, arg_b_gate *a) | ||
3488 | 3488 | |
3489 | 3489 | static bool trans_blr(DisasContext *ctx, arg_blr *a) |
3490 | 3490 | { |
3491 | - TCGv_reg tmp = get_temp(ctx); | |
3492 | - | |
3493 | - tcg_gen_shli_reg(tmp, load_gpr(ctx, a->x), 3); | |
3494 | - tcg_gen_addi_reg(tmp, tmp, ctx->iaoq_f + 8); | |
3495 | - /* The computation here never changes privilege level. */ | |
3496 | - return do_ibranch(ctx, tmp, a->l, a->n); | |
3491 | + if (a->x) { | |
3492 | + TCGv_reg tmp = get_temp(ctx); | |
3493 | + tcg_gen_shli_reg(tmp, load_gpr(ctx, a->x), 3); | |
3494 | + tcg_gen_addi_reg(tmp, tmp, ctx->iaoq_f + 8); | |
3495 | + /* The computation here never changes privilege level. */ | |
3496 | + return do_ibranch(ctx, tmp, a->l, a->n); | |
3497 | + } else { | |
3498 | + /* BLR R0,RX is a good way to load PC+8 into RX. */ | |
3499 | + return do_dbranch(ctx, ctx->iaoq_f + 8, a->l, a->n); | |
3500 | + } | |
3497 | 3501 | } |
3498 | 3502 | |
3499 | 3503 | static bool trans_bv(DisasContext *ctx, arg_bv *a) |