From: "Edgar E. Iglesias" <edgar.iglesias@gmail.com>
To: Richard Henderson <rth@twiddle.net>
Cc: qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH v2] target-cris: Use movcond and setcond
Date: Thu, 3 Sep 2015 13:06:28 +0200 [thread overview]
Message-ID: <20150903110628.GA15790@toto> (raw)
In-Reply-To: <1441219090-27699-1-git-send-email-rth@twiddle.net>
On Wed, Sep 02, 2015 at 11:38:10AM -0700, Richard Henderson wrote:
> Signed-off-by: Richard Henderson <rth@twiddle.net>
Reviewed-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com>
Tested-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com>
Thanks, I've added this to my CRIS queue.
Cheers,
Edgar
> ---
> This was originally posted back in February. I failed to keep
> any reply, if any, that may have been given. There's no change
> to the code after updating to mainline.
>
>
> r~
> ---
> target-cris/translate.c | 27 +++++++--------------------
> target-cris/translate_v10.c | 12 ++----------
> 2 files changed, 9 insertions(+), 30 deletions(-)
>
> diff --git a/target-cris/translate.c b/target-cris/translate.c
> index 5699826..f21373b 100644
> --- a/target-cris/translate.c
> +++ b/target-cris/translate.c
> @@ -311,7 +311,7 @@ static void t_gen_asr(TCGv d, TCGv a, TCGv b)
>
> static void t_gen_cris_dstep(TCGv d, TCGv a, TCGv b)
> {
> - TCGLabel *l1 = gen_new_label();
> + TCGv t = tcg_temp_new();
>
> /*
> * d <<= 1
> @@ -319,9 +319,9 @@ static void t_gen_cris_dstep(TCGv d, TCGv a, TCGv b)
> * d -= s;
> */
> tcg_gen_shli_tl(d, a, 1);
> - tcg_gen_brcond_tl(TCG_COND_LTU, d, b, l1);
> - tcg_gen_sub_tl(d, d, b);
> - gen_set_label(l1);
> + tcg_gen_sub_tl(t, d, b);
> + tcg_gen_movcond_tl(TCG_COND_GEU, d, d, b, t, d);
> + tcg_temp_free(t);
> }
>
> static void t_gen_cris_mstep(TCGv d, TCGv a, TCGv b, TCGv ccs)
> @@ -769,13 +769,7 @@ static void cris_alu_op_exec(DisasContext *dc, int op,
> t_gen_cris_mstep(dst, a, b, cpu_PR[PR_CCS]);
> break;
> case CC_OP_BOUND:
> - {
> - TCGLabel *l1 = gen_new_label();
> - tcg_gen_mov_tl(dst, a);
> - tcg_gen_brcond_tl(TCG_COND_LEU, a, b, l1);
> - tcg_gen_mov_tl(dst, b);
> - gen_set_label(l1);
> - }
> + tcg_gen_movcond_tl(TCG_COND_LEU, dst, a, b, a, b);
> break;
> case CC_OP_CMP:
> tcg_gen_sub_tl(dst, a, b);
> @@ -1482,15 +1476,8 @@ static int dec_scc_r(CPUCRISState *env, DisasContext *dc)
> LOG_DIS("s%s $r%u\n",
> cc_name(cond), dc->op1);
>
> - if (cond != CC_A) {
> - TCGLabel *l1 = gen_new_label();
> - gen_tst_cc(dc, cpu_R[dc->op1], cond);
> - tcg_gen_brcondi_tl(TCG_COND_EQ, cpu_R[dc->op1], 0, l1);
> - tcg_gen_movi_tl(cpu_R[dc->op1], 1);
> - gen_set_label(l1);
> - } else {
> - tcg_gen_movi_tl(cpu_R[dc->op1], 1);
> - }
> + gen_tst_cc(dc, cpu_R[dc->op1], cond);
> + tcg_gen_setcondi_tl(TCG_COND_NE, cpu_R[dc->op1], cpu_R[dc->op1], 0);
>
> cris_cc_mask(dc, 0);
> return 2;
> diff --git a/target-cris/translate_v10.c b/target-cris/translate_v10.c
> index b742c4c..618c234 100644
> --- a/target-cris/translate_v10.c
> +++ b/target-cris/translate_v10.c
> @@ -535,16 +535,8 @@ static void dec10_reg_scc(DisasContext *dc)
>
> LOG_DIS("s%s $r%u\n", cc_name(cond), dc->src);
>
> - if (cond != CC_A)
> - {
> - TCGLabel *l1 = gen_new_label();
> - gen_tst_cc (dc, cpu_R[dc->src], cond);
> - tcg_gen_brcondi_tl(TCG_COND_EQ, cpu_R[dc->src], 0, l1);
> - tcg_gen_movi_tl(cpu_R[dc->src], 1);
> - gen_set_label(l1);
> - } else {
> - tcg_gen_movi_tl(cpu_R[dc->src], 1);
> - }
> + gen_tst_cc(dc, cpu_R[dc->src], cond);
> + tcg_gen_setcondi_tl(TCG_COND_NE, cpu_R[dc->src], cpu_R[dc->src], 0);
>
> cris_cc_mask(dc, 0);
> }
> --
> 2.4.3
>
next prev parent reply other threads:[~2015-09-03 11:06 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-09-02 18:38 [Qemu-devel] [PATCH v2] target-cris: Use movcond and setcond Richard Henderson
2015-09-03 11:06 ` Edgar E. Iglesias [this message]
2015-09-08 8:56 ` Edgar E. Iglesias
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20150903110628.GA15790@toto \
--to=edgar.iglesias@gmail.com \
--cc=qemu-devel@nongnu.org \
--cc=rth@twiddle.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).