Assem Bsoul via llvm-dev
2016-Jun-23  15:32 UTC
[llvm-dev] DAGCombiner folds (xor (and x, y), y) -> (and (not x), y). Can I do the reverse for a target?
I am not sure what is the format for matching this (and (xor x, -1), y) and generating 2 machine instructions? can you please help! Thanks, Assem -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20160623/3cf56fef/attachment.html>
Roel Jordans via llvm-dev
2016-Jun-23  15:54 UTC
[llvm-dev] DAGCombiner folds (xor (and x, y), y) -> (and (not x), y). Can I do the reverse for a target?
Hi Assem,
I believe you can do this with a pattern node in tablegen.  That allows 
you to match a pattern of operations and replace it with some new 
operations.
Something like the following might work:
def : Pat<(and (xor REGS:$x, (i32 -1), REGS:$y),
           (INST1 REGS:$x (INST2 REGS:$y, ...))>;
The first part will do the match, so it should be in normal LLVM 
operations, the second part should be your MI pattern to insert.
Cheers,
  Roel
On 23/06/16 17:32, Assem Bsoul via llvm-dev wrote:> I am not sure what is the format for matching this (and (xor x, -1), y)
> and generating 2 machine instructions? can you please help!
>
> Thanks,
> Assem
>
>
>
> _______________________________________________
> LLVM Developers mailing list
> llvm-dev at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev
>