[LLVMdev] Simplifying selects + arm stuff

Chris Lattner sabre at nondot.org
Fri Nov 12 11:53:18 PST 2010


On Nov 12, 2010, at 11:46 AM, Evan Cheng wrote:

> 
> This should be
> 
>        cmp     r0, r1
>        movlt.w r2, #-1     @ or mvnlt r2, #0
>        and.w   r0, r2, r3
>        bx      lr
> 
> which we gets right in Thumb2 mode (I need to check why it's not matching in ARM mode). How can we use a conditional and here? The result is either (y & -1) or (y & x), the "and" is not conditional.

y&-1 == y.  There is no need to materialize -1 as a constant.

-Chris



More information about the llvm-dev mailing list