OSDN Git Service

[X86] Teach combineShuffle to avoid creating floating point operations with integer...
authorCraig Topper <craig.topper@gmail.com>
Sat, 24 Sep 2016 21:42:49 +0000 (21:42 +0000)
committerCraig Topper <craig.topper@gmail.com>
Sat, 24 Sep 2016 21:42:49 +0000 (21:42 +0000)
Fixes PR30511.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@282341 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Target/X86/X86ISelLowering.cpp

index 781fcd8..a777a25 100644 (file)
@@ -26424,13 +26424,18 @@ static SDValue combineShuffle(SDNode *N, SelectionDAG &DAG,
       bool CanFold = false;
       switch (Opcode) {
       default : break;
-      case ISD::ADD :
-      case ISD::FADD :
-      case ISD::SUB :
-      case ISD::FSUB :
-      case ISD::MUL :
-      case ISD::FMUL :
-        CanFold = true;
+      case ISD::ADD:
+      case ISD::SUB:
+      case ISD::MUL:
+        // isOperationLegal lies for integer ops on floating point types.
+        CanFold = VT.isInteger();
+        break;
+      case ISD::FADD:
+      case ISD::FSUB:
+      case ISD::FMUL:
+        // isOperationLegal lies for floating point ops on integer types.
+        CanFold = VT.isFloatingPoint();
+        break;
       }
 
       unsigned SVTNumElts = SVT.getVectorNumElements();