[llvm] r184011 - Add getSelect helper function
Matt Arsenault
Matthew.Arsenault at amd.com
Fri Jun 14 15:04:32 PDT 2013
Author: arsenm
Date: Fri Jun 14 17:04:32 2013
New Revision: 184011
URL: http://llvm.org/viewvc/llvm-project?rev=184011&view=rev
Log:
Add getSelect helper function
Patch by Micah Villmow from last year that was reviewed, but never committed
Modified:
llvm/trunk/include/llvm/CodeGen/SelectionDAG.h
Modified: llvm/trunk/include/llvm/CodeGen/SelectionDAG.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/SelectionDAG.h?rev=184011&r1=184010&r2=184011&view=diff
==============================================================================
--- llvm/trunk/include/llvm/CodeGen/SelectionDAG.h (original)
+++ llvm/trunk/include/llvm/CodeGen/SelectionDAG.h Fri Jun 14 17:04:32 2013
@@ -609,9 +609,23 @@ public:
"Cannot compare scalars to vectors");
assert(LHS.getValueType().isVector() == VT.isVector() &&
"Cannot compare scalars to vectors");
+ assert(Cond != ISD::SETCC_INVALID &&
+ "Cannot create a setCC of an invalid node.");
return getNode(ISD::SETCC, DL, VT, LHS, RHS, getCondCode(Cond));
}
+ // getSelect - Helper function to make it easier to build Select's if you just
+ // have operands and don't want to check for vector.
+ SDValue getSelect(SDLoc DL, EVT VT, SDValue Cond,
+ SDValue LHS, SDValue RHS) {
+ assert(LHS.getValueType() == RHS.getValueType() &&
+ "Cannot use select on differing types");
+ assert(VT.isVector() == LHS.getValueType().isVector() &&
+ "Cannot mix vectors and scalars");
+ return getNode(Cond.getValueType().isVector() ? ISD::VSELECT : ISD::SELECT, DL, VT,
+ Cond, LHS, RHS);
+ }
+
/// getSelectCC - Helper function to make it easier to build SelectCC's if you
/// just have an ISD::CondCode instead of an SDValue.
///
More information about the llvm-commits
mailing list