[PATCH] Teach DAGCombiner to fold inverted bit tests

David Majnemer david.majnemer at gmail.com
Mon May 6 13:24:44 PDT 2013


Thanks, fixed.


On Mon, May 6, 2013 at 1:01 PM, Rafael EspĂ­ndola <rafael.espindola at gmail.com
> wrote:

> On 6 May 2013 15:37, David Majnemer <david.majnemer at gmail.com> wrote:
> > It cannot go into InstCombine because then it would be in a non-canonical
> > form, SimplifyDemandedUseBits will undo the operation.
>
> That is a bit strange. On the patch itself, don't you have to put
>
> define i32 @test9(i32 %a) #0 {
>   %1 = and i32 %a, 4096
>   %2 = xor i32 %1, 4096
>   ret i32 %2
> }
>
> as the testcase? With
>
> define i32 @test9(i32 %a) nounwind {
>   %1 = xor i32 %a, -1
>   %2 = and i32 %1, 4096
>   ret i32 %2
> }
>
>
> llc is already producing
>
> notl %edi
> andl $4096, %edi
>
> Cheers,
> Rafael
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20130506/205c476f/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: fold-inverted-bit-test.patch
Type: application/octet-stream
Size: 2531 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20130506/205c476f/attachment.obj>


More information about the llvm-commits mailing list