Fix a bug where we were not emitting a cvt rnd sat node for converting
authorMon P Wang <wangmp@apple.com>
Thu, 5 Feb 2009 04:47:42 +0000 (04:47 +0000)
committerMon P Wang <wangmp@apple.com>
Thu, 5 Feb 2009 04:47:42 +0000 (04:47 +0000)
between a unsigned integer and signed integer.

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

lib/CodeGen/SelectionDAG/SelectionDAG.cpp

index dd00e97b9efbb5a3af89cbfbf0cd8df4e17db1b7..524f5fffb5e2df802aeb45332d874104d7099bf1 100644 (file)
@@ -1170,8 +1170,10 @@ SDValue SelectionDAG::getConvertRndSat(MVT VT, DebugLoc dl,
                                        SDValue Val, SDValue DTy,
                                        SDValue STy, SDValue Rnd, SDValue Sat,
                                        ISD::CvtCode Code) {
-  // If the src and dest types are the same, no conversion is necessary.
-  if (DTy == STy)
+  // If the src and dest types are the same and the conversion is between
+  // integer types of the same sign or two floats, no conversion is necessary.
+  if (DTy == STy &&
+      (Code == ISD::CVT_UU || Code == ISD::CVT_SS || Code == ISD::CVT_FF))
     return Val;
 
   FoldingSetNodeID ID;