[llvm] r188315 - DAG: Combine (and (setne X, 0), (setne X, -1)) -> (setuge (add X, 1), 2)
Eli Friedman
eli.friedman at gmail.com
Tue Aug 13 14:39:57 PDT 2013
- Previous message: [llvm] r188315 - DAG: Combine (and (setne X, 0), (setne X, -1)) -> (setuge (add X, 1), 2)
- Next message: [llvm] r188315 - DAG: Combine (and (setne X, 0), (setne X, -1)) -> (setuge (add X, 1), 2)
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
On Tue, Aug 13, 2013 at 2:30 PM, Jim Grosbach <grosbach at apple.com> wrote:
> Author: grosbach
> Date: Tue Aug 13 16:30:58 2013
> New Revision: 188315
>
> URL: http://llvm.org/viewvc/llvm-project?rev=188315&view=rev
> Log:
> DAG: Combine (and (setne X, 0), (setne X, -1)) -> (setuge (add X, 1), 2)
>
> A common idiom is to use zero and all-ones as sentinal values and to
> check for both in a single conditional ("x != 0 && x != (unsigned)-1").
> That generates code, for i32, like:
> testl %edi, %edi
> setne %al
> cmpl $-1, %edi
> setne %cl
> andb %al, %cl
>
> With this transform, we generate the simpler:
> incl %edi
> cmpl $1, %edi
> seta %al
>
> Similar improvements for other integer sizes and on other platforms. In
> general, combining the two setcc instructions into one is better.
>
> rdar://14689217
>
>
We already have code in InstCombiner::FoldAndOfICmps to handle this sort of
thing; it looks like it isn't catching this particular case for some
reason, though.
-Eli
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20130813/970d0950/attachment.html>
- Previous message: [llvm] r188315 - DAG: Combine (and (setne X, 0), (setne X, -1)) -> (setuge (add X, 1), 2)
- Next message: [llvm] r188315 - DAG: Combine (and (setne X, 0), (setne X, -1)) -> (setuge (add X, 1), 2)
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the llvm-commits
mailing list