[LLVMdev] ICmp documentation clarification

Baptiste Lepilleur gaiacrtn at free.fr
Fri Jan 5 13:10:47 PST 2007


Reid Spencer wrote:
> Hi Baptiste,
>
> On Fri, 2007-01-05 at 09:44 +0100, Baptiste Lepilleur wrote:
>> I just want to make sure I understand the semantic of the icmp
>> function correctly as assumption are dangerous in this domain.
>>
>> The syntax is specified as follow:
>> <result> = icmp <cond> <ty> <var1>, <var2>   ; yields {bool}:result
>>
>> But I can not find the documentation for <ty>.
>
> <ty> is any of the integer types or a pointer type. It cannot be any
> other type. The type of var1 and var2 must be identical and must be
> <ty>

Thanks this clear things up.

What is the rational behind the existance of both icmp and fcmp as the i/f 
prefix seems to be redundant with <ty> ? Is it for performance purpose when 
analysing the code ?

>> [...]
> Yes. When you truncate to bool, it really truncates so only the least
> significant bit is retained.
>
>> %Y = trunc i32 122 to bool               ; yields bool:false

Maybe this example should be added to the doc to clarify this point.

Thanks,
Baptiste. 




More information about the llvm-dev mailing list