Add support for targets that require promotions.
authorChris Lattner <sabre@nondot.org>
Sun, 16 Jan 2005 00:37:38 +0000 (00:37 +0000)
committerChris Lattner <sabre@nondot.org>
Sun, 16 Jan 2005 00:37:38 +0000 (00:37 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19579 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp

index 3250760acadf8891d2ea6b283badf6e6533e3c8f..94aab32337859546c677b4ffbb75323aa63fe262 100644 (file)
@@ -77,7 +77,12 @@ namespace llvm {
       // The common case is that we will only create one register for this
       // value.  If we have that case, create and return the virtual register.
       unsigned NV = TLI.getNumElements(VT);
-      if (NV == 1) return MakeReg(VT);
+      if (NV == 1) {
+        // If we are promoting this value, pick the next largest supported type.
+        while (!TLI.hasNativeSupportFor(VT))
+          VT = (MVT::ValueType)(VT+1);
+        return MakeReg(VT);
+      }
     
       // If this value is represented with multiple target registers, make sure
       // to create enough consequtive registers of the right (smaller) type.