qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Richard Henderson <rth@twiddle.net>
To: Bastian Koppelmann <kbastian@mail.uni-paderborn.de>,
	qemu-devel@nongnu.org
Cc: peter.maydell@linaro.org
Subject: Re: [Qemu-devel] [PATCH v2 15/15] target-tricore: Add instructions of SR opcode format
Date: Tue, 15 Jul 2014 09:50:33 -0700	[thread overview]
Message-ID: <53C55BD9.4070208@twiddle.net> (raw)
In-Reply-To: <1405359671-25985-16-git-send-email-kbastian@mail.uni-paderborn.de>

On 07/14/2014 10:41 AM, Bastian Koppelmann wrote:
> +static bool cdc_zero(target_ulong *psw)
> +{
> +    int cdc = *psw & MASK_PSW_CDC;
> +    /* Returns TRUE if PSW.CDC.COUNT == 0 or if PSW.CDC ==
> +       7'b1111111, otherwise returns FALSE. */
> +    if (cdc == 0x7f) {
> +        return true;
> +    }
> +    /* find CDC.COUNT */
> +    if (((1 << (6 - clo32(*psw & MASK_PSW_CDC))) - 1) == 0) {
> +        return true;
> +    }
> +
> +    return false;
> +}

You've misunderstood me wrt clo.  As written here, it'll always return 0, since
the value you're passing is zero-extended to 32 bits.

Something like

  int lo = clo32((*psw & MASK_PSW_CDC) << (32 - 7));
  int mask = (1u << (7 - lo)) - 1;
  int count = *psw & mask;
  return count == 0;

> +static void gen_saturate(TCGv ret, TCGv arg, int32_t up, int32_t low)
> +{
> +    TCGv sat_neg = tcg_const_i32(low);
> +    TCGv temp = tcg_const_i32(up);
> +
> +    /* sat_neg = (arg < low ) ? low : arg; */
> +    tcg_gen_movcond_tl(TCG_COND_LT, sat_neg, arg, sat_neg, arg, sat_neg);
> +
> +    /* ret = (sat_neg > up ) ? up  : sat_neg; */
> +    tcg_gen_movcond_tl(TCG_COND_GT, ret, sat_neg, temp, temp, sat_neg);
> +
> +    tcg_temp_free(sat_neg);

Forgot to free temp.

> +    case OPC2_16_SR_RSUB:
> +        tcg_gen_subfi_tl(cpu_gpr_d[r1], 0, cpu_gpr_d[r1]);
> +        break;

tcg_gen_neg_tl.


r~

      reply	other threads:[~2014-07-15 16:50 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-07-14 17:40 [Qemu-devel] [PATCH v2 00/15] TriCore architecture guest implementation Bastian Koppelmann
2014-07-14 17:40 ` [Qemu-devel] [PATCH v2 01/15] target-tricore: Add target stubs and qom-cpu Bastian Koppelmann
2014-07-14 17:40 ` [Qemu-devel] [PATCH v2 02/15] target-tricore: Add board for systemmode Bastian Koppelmann
2014-07-14 17:40 ` [Qemu-devel] [PATCH v2 03/15] target-tricore: Add softmmu support Bastian Koppelmann
2014-07-14 17:41 ` [Qemu-devel] [PATCH v2 04/15] target-tricore: Add initialization for translation and activate target Bastian Koppelmann
2014-07-14 17:41 ` [Qemu-devel] [PATCH v2 05/15] target-tricore: Add masks and opcodes for decoding Bastian Koppelmann
2014-07-14 17:41 ` [Qemu-devel] [PATCH v2 06/15] target-tricore: Add instructions of SRC opcode format Bastian Koppelmann
2014-07-14 21:05   ` Richard Henderson
2014-07-15  4:29     ` Bastian Koppelmann
2014-07-15 13:19     ` Bastian Koppelmann
2014-07-15 15:42       ` Richard Henderson
2014-07-14 17:41 ` [Qemu-devel] [PATCH v2 07/15] target-tricore: Add instructions of SRR " Bastian Koppelmann
2014-07-15 15:00   ` Richard Henderson
2014-07-14 17:41 ` [Qemu-devel] [PATCH v2 08/15] target-tricore: Add instructions of SSR " Bastian Koppelmann
2014-07-15 15:17   ` Richard Henderson
2014-07-14 17:41 ` [Qemu-devel] [PATCH v2 09/15] target-tricore: Add instructions of SRRS and SLRO " Bastian Koppelmann
2014-07-15 15:23   ` Richard Henderson
2014-07-14 17:41 ` [Qemu-devel] [PATCH v2 10/15] target-tricore: Add instructions of SB " Bastian Koppelmann
2014-07-15 15:31   ` Richard Henderson
2014-07-14 17:41 ` [Qemu-devel] [PATCH v2 11/15] target-tricore: Add instructions of SBC and SBRN " Bastian Koppelmann
2014-07-15 15:33   ` Richard Henderson
2014-07-14 17:41 ` [Qemu-devel] [PATCH v2 12/15] target-tricore: Add instructions of SBR " Bastian Koppelmann
2014-07-15 15:50   ` Richard Henderson
2014-07-14 17:41 ` [Qemu-devel] [PATCH v2 13/15] target-tricore: Add instructions of SC " Bastian Koppelmann
2014-07-15 15:56   ` Richard Henderson
2014-07-14 17:41 ` [Qemu-devel] [PATCH v2 14/15] target-tricore: Add instructions of SLR, SSRO and SRO " Bastian Koppelmann
2014-07-15 16:00   ` Richard Henderson
2014-07-14 17:41 ` [Qemu-devel] [PATCH v2 15/15] target-tricore: Add instructions of SR " Bastian Koppelmann
2014-07-15 16:50   ` Richard Henderson [this message]

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=53C55BD9.4070208@twiddle.net \
    --to=rth@twiddle.net \
    --cc=kbastian@mail.uni-paderborn.de \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-devel@nongnu.org \
    /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).