inline assembly & r0 SOS
    Segher Boessenkool 
    segher at kernel.crashing.org
       
    Thu Aug  7 00:39:44 EST 2008
    
    
  
>>>> unsigned int get_PLL_range(unsigned int range, unsigned int config)
> {
>   range = range * 8 + 23;
>   return ((config << range) | (config >> (32 - range))) & 3;
> }
>
> The special pattern ((a << n) | (a >> (32 - n))) is recognized by  
> gcc as
> a rotate operation.
It's only valid for 1 <= n <= 31 though, so for input "range" 0 or 1.  
(*)
If that's the whole range needed, much simpler code is possible...
Segher
(*) or 0xffffffff or 0xfffffffe, but somehow I doubt that was intended.
    
    
More information about the Linuxppc-dev
mailing list