All of lore.kernel.org
 help / color / mirror / Atom feed
From: Fabiano Rosas <farosas@suse.de>
To: "Richard Henderson" <richard.henderson@linaro.org>,
	"Peter Maydell" <peter.maydell@linaro.org>,
	"Philippe Mathieu-Daudé" <philmd@linaro.org>
Cc: qemu-devel@nongnu.org, qemu-arm@nongnu.org
Subject: Re: [PATCH] target/arm: gdbstub: Guard M-profile code with CONFIG_TCG
Date: Wed, 05 Jul 2023 17:38:41 -0300	[thread overview]
Message-ID: <87jzve3xgu.fsf@suse.de> (raw)
In-Reply-To: <837e45df-08c9-44c9-b4c7-489251901860@linaro.org>

Richard Henderson <richard.henderson@linaro.org> writes:

> On 7/4/23 17:44, Peter Maydell wrote:
>>> IIUC tcg_enabled(), this guard shouldn't be necessary; if CONFIG_TCG
>>> is not defined, tcg_enabled() evaluates to 0, and the compiler should
>>> elide the whole block.
>> 
>> IME it's a bit optimistic to assume that the compiler will always
>> do that, especially with no optimisation enabled.
>
> There's plenty of other places that we do.
> The compiler is usually pretty good with "if (0)".
>
> My question is if
>
>>       if (arm_feature(env, ARM_FEATURE_M) && tcg_enabled()) { 
>
> needs to be written
>
>      if (tcg_enabled()) {
>          if (arm_feature(..., M) {
>             ...
>          }
>      }

Yeah, that doesn't work either. I don't understand why in this
particular case the compiler seems unable to remove that code.

Can anyone else reproduce this or is it just happening on my setup?
Maybe something is broken on my side...

      reply	other threads:[~2023-07-05 20:39 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-06-28 16:48 [PATCH] target/arm: gdbstub: Guard M-profile code with CONFIG_TCG Fabiano Rosas
2023-06-28 20:09 ` Philippe Mathieu-Daudé
2023-06-28 21:51   ` Fabiano Rosas
2023-06-28 22:01     ` Fabiano Rosas
2023-07-04 13:15 ` Peter Maydell
2023-07-04 15:21 ` Philippe Mathieu-Daudé
2023-07-04 15:44   ` Peter Maydell
2023-07-04 15:55     ` Philippe Mathieu-Daudé
2023-07-05 14:32     ` Richard Henderson
2023-07-05 20:38       ` Fabiano Rosas [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=87jzve3xgu.fsf@suse.de \
    --to=farosas@suse.de \
    --cc=peter.maydell@linaro.org \
    --cc=philmd@linaro.org \
    --cc=qemu-arm@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    --cc=richard.henderson@linaro.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.