[llvm-commits] [llvm] r52887 - in /llvm/trunk: lib/CodeGen/SelectionDAG/LegalizeDAG.cpp test/CodeGen/Generic/select-cc.ll
Chris Lattner
sabre at nondot.org
Sun Jun 29 19:43:01 PDT 2008
Author: lattner
Date: Sun Jun 29 21:43:01 2008
New Revision: 52887
URL: http://llvm.org/viewvc/llvm-project?rev=52887&view=rev
Log:
Implement split and scalarize for SELECT_CC, fixing PR2504
Added:
llvm/trunk/test/CodeGen/Generic/select-cc.ll
Modified:
llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp
Modified: llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp?rev=52887&r1=52886&r2=52887&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp (original)
+++ llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp Sun Jun 29 21:43:01 2008
@@ -6895,6 +6895,22 @@
}
break;
}
+ case ISD::SELECT_CC: {
+ SDOperand CondLHS = Node->getOperand(0);
+ SDOperand CondRHS = Node->getOperand(1);
+ SDOperand CondCode = Node->getOperand(4);
+
+ SDOperand LL, LH, RL, RH;
+ SplitVectorOp(Node->getOperand(2), LL, LH);
+ SplitVectorOp(Node->getOperand(3), RL, RH);
+
+ // Handle a simple select with vector operands.
+ Lo = DAG.getNode(ISD::SELECT_CC, NewVT_Lo, CondLHS, CondRHS,
+ LL, RL, CondCode);
+ Hi = DAG.getNode(ISD::SELECT_CC, NewVT_Hi, CondLHS, CondRHS,
+ LH, RH, CondCode);
+ break;
+ }
case ISD::VSETCC: {
SDOperand LL, LH, RL, RH;
SplitVectorOp(Node->getOperand(0), LL, LH);
@@ -7122,6 +7138,13 @@
ScalarizeVectorOp(Op.getOperand(1)),
ScalarizeVectorOp(Op.getOperand(2)));
break;
+ case ISD::SELECT_CC:
+ Result = DAG.getNode(ISD::SELECT_CC, NewVT, Node->getOperand(0),
+ Node->getOperand(1),
+ ScalarizeVectorOp(Op.getOperand(2)),
+ ScalarizeVectorOp(Op.getOperand(3)),
+ Node->getOperand(4));
+ break;
case ISD::VSETCC: {
SDOperand Op0 = ScalarizeVectorOp(Op.getOperand(0));
SDOperand Op1 = ScalarizeVectorOp(Op.getOperand(1));
Added: llvm/trunk/test/CodeGen/Generic/select-cc.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/Generic/select-cc.ll?rev=52887&view=auto
==============================================================================
--- llvm/trunk/test/CodeGen/Generic/select-cc.ll (added)
+++ llvm/trunk/test/CodeGen/Generic/select-cc.ll Sun Jun 29 21:43:01 2008
@@ -0,0 +1,9 @@
+; RUN: llvm-as < %s | llc
+; PR2504
+
+define <2 x double> @vector_select(<2 x double> %x, <2 x double> %y) nounwind {
+ %x.lo = extractelement <2 x double> %x, i32 0 ; <double> [#uses=1]
+ %x.lo.ge = fcmp oge double %x.lo, 0.000000e+00 ; <i1> [#uses=1]
+ %a.d = select i1 %x.lo.ge, <2 x double> %y, <2 x double> %x ; <<2 x double>> [#uses=1]
+ ret <2 x double> %a.d
+}
More information about the llvm-commits
mailing list