diff mbox

[v2,36/36] target-microblaze: Use tcg_gen_movcond in eval_cond_jmp

Message ID 20180508173152.29327-37-edgar.iglesias@gmail.com (mailing list archive)
State New, archived
Headers show

Commit Message

Edgar E. Iglesias May 8, 2018, 5:31 p.m. UTC
From: "Edgar E. Iglesias" <edgar.iglesias@xilinx.com>

Cleanup eval_cond_jmp to use tcg_gen_movcond_i64().
No functional change.

Suggested-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com>
---
 target/microblaze/translate.c | 9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)

Comments

Richard Henderson May 9, 2018, 9:21 p.m. UTC | #1
On 05/08/2018 10:31 AM, Edgar E. Iglesias wrote:
> From: "Edgar E. Iglesias" <edgar.iglesias@xilinx.com>
> 
> Cleanup eval_cond_jmp to use tcg_gen_movcond_i64().
> No functional change.
> 
> Suggested-by: Richard Henderson <richard.henderson@linaro.org>
> Signed-off-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com>
> ---
>  target/microblaze/translate.c | 9 +++------
>  1 file changed, 3 insertions(+), 6 deletions(-)
> 
> diff --git a/target/microblaze/translate.c b/target/microblaze/translate.c
> index 256acce876..a4f6b307d3 100644
> --- a/target/microblaze/translate.c
> +++ b/target/microblaze/translate.c
> @@ -1167,12 +1167,9 @@ static inline void eval_cc(DisasContext *dc, unsigned int cc,
>  
>  static void eval_cond_jmp(DisasContext *dc, TCGv_i64 pc_true, TCGv_i64 pc_false)
>  {
> -    TCGLabel *l1 = gen_new_label();
> -    /* Conditional jmp.  */
> -    tcg_gen_mov_i64(cpu_SR[SR_PC], pc_false);
> -    tcg_gen_brcondi_i64(TCG_COND_EQ, env_btaken, 0, l1);
> -    tcg_gen_mov_i64(cpu_SR[SR_PC], pc_true);
> -    gen_set_label(l1);
> +    tcg_gen_movcond_i64(TCG_COND_NE, cpu_SR[SR_PC],
> +                        env_btaken, tcg_const_i64(0),
> +                        pc_true, pc_false);

Ah.  I would probably just extend env_btaken here instead of the previous patch.


r~
Edgar E. Iglesias May 16, 2018, 6:49 p.m. UTC | #2
On Wed, May 09, 2018 at 02:21:42PM -0700, Richard Henderson wrote:
> On 05/08/2018 10:31 AM, Edgar E. Iglesias wrote:
> > From: "Edgar E. Iglesias" <edgar.iglesias@xilinx.com>
> > 
> > Cleanup eval_cond_jmp to use tcg_gen_movcond_i64().
> > No functional change.
> > 
> > Suggested-by: Richard Henderson <richard.henderson@linaro.org>
> > Signed-off-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com>
> > ---
> >  target/microblaze/translate.c | 9 +++------
> >  1 file changed, 3 insertions(+), 6 deletions(-)
> > 
> > diff --git a/target/microblaze/translate.c b/target/microblaze/translate.c
> > index 256acce876..a4f6b307d3 100644
> > --- a/target/microblaze/translate.c
> > +++ b/target/microblaze/translate.c
> > @@ -1167,12 +1167,9 @@ static inline void eval_cc(DisasContext *dc, unsigned int cc,
> >  
> >  static void eval_cond_jmp(DisasContext *dc, TCGv_i64 pc_true, TCGv_i64 pc_false)
> >  {
> > -    TCGLabel *l1 = gen_new_label();
> > -    /* Conditional jmp.  */
> > -    tcg_gen_mov_i64(cpu_SR[SR_PC], pc_false);
> > -    tcg_gen_brcondi_i64(TCG_COND_EQ, env_btaken, 0, l1);
> > -    tcg_gen_mov_i64(cpu_SR[SR_PC], pc_true);
> > -    gen_set_label(l1);
> > +    tcg_gen_movcond_i64(TCG_COND_NE, cpu_SR[SR_PC],
> > +                        env_btaken, tcg_const_i64(0),
> > +                        pc_true, pc_false);
> 
> Ah.  I would probably just extend env_btaken here instead of the previous patch.
>

I've changed it according to your suggestion. I'll post v3 in a moment.

Thanks,
Edgar
diff mbox

Patch

diff --git a/target/microblaze/translate.c b/target/microblaze/translate.c
index 256acce876..a4f6b307d3 100644
--- a/target/microblaze/translate.c
+++ b/target/microblaze/translate.c
@@ -1167,12 +1167,9 @@  static inline void eval_cc(DisasContext *dc, unsigned int cc,
 
 static void eval_cond_jmp(DisasContext *dc, TCGv_i64 pc_true, TCGv_i64 pc_false)
 {
-    TCGLabel *l1 = gen_new_label();
-    /* Conditional jmp.  */
-    tcg_gen_mov_i64(cpu_SR[SR_PC], pc_false);
-    tcg_gen_brcondi_i64(TCG_COND_EQ, env_btaken, 0, l1);
-    tcg_gen_mov_i64(cpu_SR[SR_PC], pc_true);
-    gen_set_label(l1);
+    tcg_gen_movcond_i64(TCG_COND_NE, cpu_SR[SR_PC],
+                        env_btaken, tcg_const_i64(0),
+                        pc_true, pc_false);
 }
 
 static void dec_bcc(DisasContext *dc)