[LLVMdev] Any extend
Duncan Sands
baldrick at free.fr
Tue Jan 26 06:36:01 PST 2010
Hi Greg,
>>> 1) What causes the Initial selection DAG code to choose an any_extend
>>> over a sign_extend (or zero_extend)?
>>
>> because it is more efficient: the backend gets more choice in how to do
>> it, and at the same time it tells the optimizers that the extra bits
>> contain rubbish, which gives them more freedom to reason.
> Makes sense, though I was wondering why it would choose to sign_extend
> an 8-bit or 16-bit value, but any_extend a 32-bit value (These are all
> signed values).
I'm not sure what you mean by "these are all signed values" - in LLVM there
is no such thing as a "signed i16" or an "unsigned i16", there is only i16
with signed and unsigned operations. As to why you get a sign-extend in
some cases and any-extend in others... well, it depends on details of what
you are compiling, so without a testcase it is hard to say anything useful.
Ciao,
Duncan.
More information about the llvm-dev
mailing list