<html><head><meta http-equiv="Content-Type" content="text/html charset=windows-1252"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;">Hi Jean-Luc, <div><br></div><div>LGTM.  I remember that ISPC was generating code like this (for vectors). One nit picking, there is an extra pair of braces around the second swap statement.  </div><div><br></div><div>Thanks,</div><div>Nadav</div><div><br><div><div>On May 3, 2013, at 6:43 PM, Jean-Luc Duprat <<a href="mailto:jduprat@apple.com">jduprat@apple.com</a>> wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div style="letter-spacing: 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;">And now the patch really is attached…<br><br>JL<br><span><mix.patch></span><br><br><br><br><br><br>On May 3, 2013, at 18:35 , Jean-Luc Duprat <<a href="mailto:jduprat@apple.com">jduprat@apple.com</a>> wrote:<br><br><blockquote type="cite">The attached patch provides instcombines for the following 3 cases:<br><br>A * (1 - (uitofp i1 C)) -> select C, 0, A<br>B * (uitofp i1 C) -> select C, B, 0<br>select C, 0, A + select C, B, 0 -> select C, B, A<br><br>These come up in code that has been hand-optimized from a select to a linear blend, on platforms where that may have mattered; that is we want to do the following transform:<br>A*(1 - uitofp i1 C) + B*(uitofp i1 C) -> select C, A, B<br><br>Test cases included in the patch, here are the 3 combine optimizations at work together:<br><br>$ cat foo.ll<br>define float @test3(float %A, float %B, i1 %C) {<br>EntryBlock:<br>%cf = uitofp i1 %C to float<br>%mc = fsub float 1.000000e+00, %cf<br>%p1 = fmul fast float %A, %mc<br>%p2 = fmul fast float %B, %cf<br>%s1 = fadd fast float %p1, %p2<br>ret float %s1<br>}<br><br>$ opt -instcombine -S fool.ll<br>define float @test3(float %A, float %B, i1 %C) {<br>EntryBlock:<br>%s1 = select i1 %C, float %B, float %A<br>ret float %s1<br>}<br><br><br>JL<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</div></blockquote></div><br></div></body></html>