[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Error in accel/tcg?

From: Peter Maydell
Subject: Re: Error in accel/tcg?
Date: Tue, 20 Jul 2021 16:21:57 +0100

On Tue, 20 Jul 2021 at 16:13, Kenneth Adam Miller
<kennethadammiller@gmail.com> wrote:
> See of course I thought about editing code outside of my target too, but 
> thought against it.

Yeah, it's a bit of a hard one to judge. Mostly new target code shouldn't
need to result in changes to core code, but sometimes if the target is
doing something nobody else has needed before then the best approach
is to update the core code to provide the necessary facilities for it.

> And doing it that way may make the compiler happier, but then would it be 
> inviting a runtime error

In this case what the code is testing is "can I fit a value into the low bits
of a page-aligned address?": if it can, there's a faster codepath it uses,
and it has a fallback to a slower approach otherwise. If TARGET_PAGE_BITS
is 16 or more, then it is always true that the value will fit into the
low bits, and we can always use the fastpath. The compiler is correct that
the comparison is always true, and that is OK here.

-- PMM

reply via email to

[Prev in Thread] Current Thread [Next in Thread]