[LLVMdev] XOR Optimization

me22 me22.ca at gmail.com
Tue Jul 26 17:47:01 PDT 2011


2011/7/26 Daniel Nicácio <dnicacios at gmail.com>:
>
> I also would like to see why the "XOR  A,  -1" is not turned into a NOT, any
>

Probably because NOT (like NEG) doesn't exist :)

<http://llvm.org/docs/LangRef.html#instref>

I assume the decision was made that it wasn't worth adding the extra
unary instructions when they can easily be handled in codegen by
matching "XOR X, -1" or "SUB 0, X".

~ Scott




More information about the llvm-dev mailing list