[fpc-pascal] rotating bits

Jonas Maebe jonas.maebe at elis.ugent.be
Sun May 28 15:51:44 CEST 2006

On 28 May 2006, at 15:45, Florian Klaempfl wrote:

>> It is possible to implement a peephole optimization to change the
>> shift/or into the native variant of rol/ror if it exists.
> The code currently generated is rather lengthy.

Of course, but it's going to be a pretty consistent pattern which can  
be recognised by the peephole optimizer (if someone implements it).

>> And I don't
>> think any architecture apart from x86 support rol/ror for anything  
>> but
>> the native word size (at least ppc doesn't).
> But it can be done on ppc with two rlw* instructions which is also ok,
> no?

I think it needs three: to to rotate left/right, one to insert the  
overflow at the end/start, and one to mask the overfow at the end/ 
start. But peephole optimizations to turn a number of shift and or  
operations into a sequence of rlw* is needed for ppc anyway (e.g. for  
record regvars).


More information about the fpc-pascal mailing list