[llvm-commits] [PATCH] optimization of -(x != 0) to use neg in X86
Chad Rosier
mcrosier at apple.com
Mon Apr 30 09:58:32 PDT 2012
Manman,
+ if (ConstantSDNode *YC = dyn_cast<ConstantSDNode>(Y))
+ if (YC && YC->isNullValue() &&
+ (isAllOnes(Op1) == (CondCode == X86::COND_NE))) {
The dyn_cast<> operator returns null if the operand is not of the correct type. Thus, the "YC &&" check is not necessary.
Chad
On Apr 27, 2012, at 6:03 PM, manman ren wrote:
>
> This patch will optimize -(x != 0) on X86
> FROM
> cmpl $0x01,%edi
> sbbl %eax,%eax
> notl %eax
> TO
> negl %edi
> sbbl %eax %eax
>
> Please review & provide feedback,
> Thanks,
> Manman
>
> <sext_ne.patch>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
More information about the llvm-commits
mailing list