<html><head><meta http-equiv="Content-Type" content="text/html charset=us-ascii"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;"><br><div><div>On Mar 5, 2014, at 9:55 AM, Hal Finkel <<a href="mailto:hfinkel@anl.gov">hfinkel@anl.gov</a>> wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div style="font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;">----- Original Message -----<br><blockquote type="cite">From: "Nadav Rotem" <<a href="mailto:nrotem@apple.com">nrotem@apple.com</a>><br>To: "Andrea Di Biagio" <<a href="mailto:andrea.dibiagio@gmail.com">andrea.dibiagio@gmail.com</a>><br>Cc: "<a href="mailto:llvm-commits@cs.uiuc.edu">llvm-commits@cs.uiuc.edu</a> for LLVM" <<a href="mailto:llvm-commits@cs.uiuc.edu">llvm-commits@cs.uiuc.edu</a>><br>Sent: Wednesday, March 5, 2014 11:47:53 AM<br>Subject: Re: [PATCH] Teach the DAGCombiner how to fold a OR of two<span class="Apple-tab-span" style="white-space: pre;">    </span>shufflevector into a single shufflevector node<br><br>Hi Andrea,<br><br>Thanks for working on this.  Lowering shuffles is really difficult<br>and we have >1000 LOC in the x86 backends for lowering shuffles.  It<br>is really difficult to predict which shuffles are supported and<br>which patterns result in slow code. Until now LLVM was *not* to<br>introducing new shuffle patterns. The idea was that the users that<br>generate the shuffle patterns should know if the patterns are<br>supported by the target. This makes sense for users that write their<br>own math libraries using the clang vector syntax. Your patch<br>introduces new shuffle patterns that some backends may not know how<br>to lower. I think that the code should be okay for AVX and AVX2<br>because you are not introducing cross-lane shuffles. So, I suggest<br>that you move this patch into the X86 backend and protect it with<br>the hasAVX flags. Does that make sense?<br></blockquote><br>Is this not what TLI->isShuffleMaskLegal is for? We avoid introducing new shuffle patterns at the IR level, especially during canonicalization, because we don't want to use target information at that stage. In the SDAG, I think that the situation is different. There we should use TLI->isShuffleMaskLegal (at the other associated legality checks) to control these kinds of optimizations. Opinions?<br></div></blockquote><div><br></div><div>This is also a good solution. The advantage is that multiple targets would be able to benefit from Andrea's new optimization. The disadvantage is that the coverage of isShuffleMaskLegal is minimal. </div><br><blockquote type="cite"><div style="font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><br>-Hal<br><br><blockquote type="cite"><br>Thanks,<br>Nadav<br><br><br><br>On Feb 26, 2014, at 7:07 AM, Andrea Di Biagio<br><<a href="mailto:andrea.dibiagio@gmail.com">andrea.dibiagio@gmail.com</a>> wrote:<br><br><blockquote type="cite"><patch-dagcombine.diff><br></blockquote><br>_______________________________________________<br>llvm-commits mailing list<br><a href="mailto:llvm-commits@cs.uiuc.edu">llvm-commits@cs.uiuc.edu</a><br>http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits<br><br></blockquote><br>--<span class="Apple-converted-space"> </span><br>Hal Finkel<br>Assistant Computational Scientist<br>Leadership Computing Facility<br>Argonne National Laboratory</div></blockquote></div><br></body></html>