[LLVMdev] Is there a reason why memcmp isn't an intrinsic?

Chris Lattner sabre at nondot.org
Sun Apr 13 13:24:57 PDT 2008


On Apr 13, 2008, at 1:13 PM, Talin wrote:

> Chris Lattner wrote:
>> On Apr 13, 2008, at 12:40 PM, Talin wrote:
>>
>>
>>> Since you have memcpy, memmove, and memset in there, I was wondering
>>> why
>>> memcmp wasn't there as well. It seems obvious - which makes me think
>>> that if it's not there, then there must be some reason for it.
>>>
>>
>> Why do you want it to be an intrinsic?  What does that provide?
>>
> I can't really answer that question, since I don't know why memcpy, et
> al, are intrinsics either. I was assuming that whatever rationale made
> it beneficial to make the mem.* functions intrinsics would apply to
> memcmp as well...but perhaps this is not the case?

The reason memcpy is an intrinsic is so that it can capture alignment  
information about the pointers, and someday we may add volatility info  
to it.  Since memcmp isn't currently expanded inline by any code  
generators, this alignment info wouldn't be used for anything.  When/ 
if someone is interested in doing this in the codegen, it would make  
sense to add the intrinsic.

-Chris



More information about the llvm-dev mailing list