From 1de18d422e8386600f28c710ab7925fc6ce88c1b Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Sun, 16 Jan 2005 00:37:38 +0000 Subject: [PATCH] Add support for targets that require promotions. llvm-svn: 19579 --- lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp b/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp index 3250760acad..94aab323378 100644 --- a/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp +++ b/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp @@ -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.