summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorMatt Arsenault <Matthew.Arsenault@amd.com>2013-06-14 22:04:32 +0000
committerMatt Arsenault <Matthew.Arsenault@amd.com>2013-06-14 22:04:32 +0000
commit85cc4d840256841ac231858c3c916e91fe469269 (patch)
treeea1dea371dddd35a980b7459e5e870d1e0805b94 /include
parent9e89fe77ce532e1d2704f55159d5474b35645685 (diff)
downloadllvm-85cc4d840256841ac231858c3c916e91fe469269.tar.gz
llvm-85cc4d840256841ac231858c3c916e91fe469269.tar.bz2
llvm-85cc4d840256841ac231858c3c916e91fe469269.tar.xz
Add getSelect helper function
Patch by Micah Villmow from last year that was reviewed, but never committed git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@184011 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include')
-rw-r--r--include/llvm/CodeGen/SelectionDAG.h14
1 files changed, 14 insertions, 0 deletions
diff --git a/include/llvm/CodeGen/SelectionDAG.h b/include/llvm/CodeGen/SelectionDAG.h
index 487ab28ccf..263907455f 100644
--- a/include/llvm/CodeGen/SelectionDAG.h
+++ b/include/llvm/CodeGen/SelectionDAG.h
@@ -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.
///