qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] tcg shift ops and magnitudes larger than register size


From: Stuart Brady
Subject: Re: [Qemu-devel] tcg shift ops and magnitudes larger than register size
Date: Fri, 14 Jan 2011 23:26:21 +0000
User-agent: Mutt/1.5.20 (2009-06-14)

On Thu, Jan 13, 2011 at 09:56:35AM +0100, Edgar E. Iglesias wrote:
> On Wed, Jan 12, 2011 at 08:13:45PM -0500, Mike Frysinger wrote:
> > are there any rules with the tcg sar/shl/shr ops and their magnitudes
> > ?  such as "magnitudes cannot be larger than the register size" ?
> 
> Yes, the result is undefined in those cases.

The result is also undefined if the magnitude is *equal* to the width of
the variable.

> You need to handle it in the translator. CRIS has similar semantics
> as your arch. See target-cris/translate.c:t_gen_lsl() for one way
> of doing it. There might be better ways though.

How widely used would a set of optional shift ops be, where the magnitude
may be equal to (or exceed?) the width?

Are there other helpers or op sequences that are commonly shared between
targets that would be candidates for splitting out into common code?

I know that a proliferation of ops is to be avoided -- the not, neg,
andc, orc, eqv, nand and nor ops have been useful though, despite not
being strictly essential, and the same could be said for the ext*s, ext*z
and bswap ops.

One of nice side-benefits of moving to TCG was that simple arithmetic ops
and loads/stores worked the same way on all targets.  Targets using
different orderings for dest / source parameters was not really fun when
switching constantly between SPARC, MIPS and x86 targets. :-/

Cheers,
-- 
Stuart Brady



reply via email to

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