<div dir="ltr">Test case added in r282473</div><div class="gmail_extra"><br clear="all"><div><div class="gmail_signature" data-smartmail="gmail_signature">~Craig</div></div>
<br><div class="gmail_quote">On Mon, Sep 26, 2016 at 7:02 PM, Craig Topper <span dir="ltr"><<a href="mailto:craig.topper@gmail.com" target="_blank">craig.topper@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">I didn't have a small test case. The bug report had pretty large IR. I'll see if I can reduce it.<div><br></div><div>I'm not very familiar with this code. Adding Andrea who originally wrote the code and Simon who has been doing a lot shuffle combining change recently.</div></div><div class="gmail_extra"><span class="HOEnZb"><font color="#888888"><br clear="all"><div><div data-smartmail="gmail_signature">~Craig</div></div></font></span><div><div class="h5">
<br><div class="gmail_quote">On Mon, Sep 26, 2016 at 12:22 PM, Friedman, Eli <span dir="ltr"><<a href="mailto:efriedma@codeaurora.org" target="_blank">efriedma@codeaurora.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">On 9/24/2016 2:42 PM, Craig Topper via llvm-commits wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Author: ctopper<br>
Date: Sat Sep 24 16:42:49 2016<br>
New Revision: 282341<br>
<br>
URL: <a href="http://llvm.org/viewvc/llvm-project?rev=282341&view=rev" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-pr<wbr>oject?rev=282341&view=rev</a><br>
Log:<br>
[X86] Teach combineShuffle to avoid creating floating point operations with integer types and integer operations with floating point types. Seems isOperationLegal lies for mismatched types and operations.<br>
<br>
Fixes PR30511.<br>
<br>
Modified:<br>
     llvm/trunk/lib/Target/X86/X86<wbr>ISelLowering.cpp<br>
</blockquote>
<br>
Missing testcase.<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Modified: llvm/trunk/lib/Target/X86/X86I<wbr>SelLowering.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86ISelLowering.cpp?rev=282341&r1=282340&r2=282341&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-pr<wbr>oject/llvm/trunk/lib/Target/X8<wbr>6/X86ISelLowering.cpp?rev=2823<wbr>41&r1=282340&r2=282341&view=di<wbr>ff</a><br>
==============================<wbr>==============================<wbr>==================<br>
--- llvm/trunk/lib/Target/X86/X86I<wbr>SelLowering.cpp (original)<br>
+++ llvm/trunk/lib/Target/X86/X86I<wbr>SelLowering.cpp Sat Sep 24 16:42:49 2016<br>
@@ -26424,13 +26424,18 @@ static SDValue combineShuffle(SDNode *N,<br>
        bool CanFold = false;<br>
        switch (Opcode) {<br>
        default : break;<br>
-      case ISD::ADD :<br>
-      case ISD::FADD :<br>
-      case ISD::SUB :<br>
-      case ISD::FSUB :<br>
-      case ISD::MUL :<br>
-      case ISD::FMUL :<br>
-        CanFold = true;<br>
+      case ISD::ADD:<br>
+      case ISD::SUB:<br>
+      case ISD::MUL:<br>
+        // isOperationLegal lies for integer ops on floating point types.<br>
+        CanFold = VT.isInteger();<br>
+        break;<br>
+      case ISD::FADD:<br>
+      case ISD::FSUB:<br>
+      case ISD::FMUL:<br>
+        // isOperationLegal lies for floating point ops on integer types.<br>
+        CanFold = VT.isFloatingPoint();<br>
+        break;<br>
</blockquote>
<br>
Why are we checking for FADD here in the first place?  This transformation isn't legal for floating-point numbers.<br>
<br>
Also, it's legal to transform ADD even if VT is floating-point; we just need to come up with an appropriate integer type to use to perform the operation, then insert an extra bitcast.<span><font color="#888888"><br>
<br>
-Eli<br>
<br>
-- <br>
Employee of Qualcomm Innovation Center, Inc.<br>
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, a Linux Foundation Collaborative Project<br>
<br>
</font></span></blockquote></div><br></div></div></div>
</blockquote></div><br></div>