[LLVMdev] [PATCH] Emit rbit, clz on ARM for __builtin_ctz

Jim Grosbach grosbach at apple.com
Fri Jan 15 14:52:34 PST 2010


On Jan 15, 2010, at 11:37 AM, Richard Osborne wrote:

>
> On 15 Jan 2010, at 18:03, Chris Lattner wrote:
>
>> On Jan 14, 2010, at 10:13 PM, David Conrad wrote:
>>
>>> Other targets that I know of that could potentially benefit from
>>> this optimization being global (that have a clz and bitreverse
>>> instruction but not ctz) are AVR32 and C64x, neither of which llvm
>>> has backends for yet.
>>
>> When/if another target wants this, we could add a ISD::RBIT  
>> operation,
>> it doesn't need to be added at the llvm ir level,
>
> The XCore also has ctlz and bitreverse instructions and not cttz. At  
> the moment in the XCore backend cttz is marked as legal and expanded  
> to this pair of instructions in a pattern in the InstrInfo.td.

In that case, perhaps it makes sense to add it as an ISD::RBIT  
operation straight away.

The rest of the patch looks good to me.

-Jim



More information about the llvm-dev mailing list