Allow for copysign having f80 second argument.
authorDale Johannesen <dalej@apple.com>
Sun, 21 Oct 2007 01:07:44 +0000 (01:07 +0000)
committerDale Johannesen <dalej@apple.com>
Sun, 21 Oct 2007 01:07:44 +0000 (01:07 +0000)
Fixes 5550319.

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

lib/Target/X86/X86ISelLowering.cpp

index 2d16c3c63c62a334fb6f1a7a0150a73f2f4aac1f..4d528abb6b4b12b0585eed8b59fe84ea9c9782e3 100644 (file)
@@ -4040,6 +4040,15 @@ SDOperand X86TargetLowering::LowerFCOPYSIGN(SDOperand Op, SelectionDAG &DAG) {
     SrcVT = VT;
     SrcTy = MVT::getTypeForValueType(SrcVT);
   }
+  // And if it is bigger, shrink it first.
+  if (MVT::getSizeInBits(SrcVT) > MVT::getSizeInBits(VT)) {
+    Op1 = DAG.getNode(ISD::FP_ROUND, VT, Op1);
+    SrcVT = VT;
+    SrcTy = MVT::getTypeForValueType(SrcVT);
+  }
+
+  // At this point the operands and the result should have the same
+  // type, and that won't be f80 since that is not custom lowered.
 
   // First get the sign bit of second operand.
   std::vector<Constant*> CV;