diff options
author | Bill Wendling <isanbard@gmail.com> | 2008-11-21 02:38:44 +0000 |
---|---|---|
committer | Bill Wendling <isanbard@gmail.com> | 2008-11-21 02:38:44 +0000 |
commit | ef37546f688696b1d616dc2adb63d1b372fa483d (patch) | |
tree | d6a0dbd16fed02baff2fd48e80b2a0f608d5243c | |
parent | f6b7a47d5d6e2703591b95b10b2c5be5b5fd09cd (diff) | |
download | external_llvm-ef37546f688696b1d616dc2adb63d1b372fa483d.zip external_llvm-ef37546f688696b1d616dc2adb63d1b372fa483d.tar.gz external_llvm-ef37546f688696b1d616dc2adb63d1b372fa483d.tar.bz2 |
Combine the two add with overflow intrinsics lowerings. They differ only in DAG node type.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@59788 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp | 23 |
1 files changed, 5 insertions, 18 deletions
diff --git a/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp b/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp index 53bc88d..2a24e40 100644 --- a/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp +++ b/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp @@ -4093,8 +4093,8 @@ SelectionDAGLowering::visitIntrinsicCall(CallInst &I, unsigned Intrinsic) { return 0; } + case Intrinsic::uadd_with_overflow: case Intrinsic::sadd_with_overflow: { - // Convert to "ISD::SADDO" instruction. SDValue Op1 = getValue(I.getOperand(1)); SDValue Op2 = getValue(I.getOperand(2)); MVT Ty = Op1.getValueType(); @@ -4102,23 +4102,10 @@ SelectionDAGLowering::visitIntrinsicCall(CallInst &I, unsigned Intrinsic) { MVT ValueVTs[] = { Ty, MVT::i1 }; SDValue Ops[] = { Op1, Op2 }; - SDValue Result = DAG.getNode(ISD::SADDO, DAG.getVTList(&ValueVTs[0], 2), - &Ops[0], 2); - - setValue(&I, Result); - return 0; - } - case Intrinsic::uadd_with_overflow: { - // Convert to "ISD::UADDO" instruction. - SDValue Op1 = getValue(I.getOperand(1)); - SDValue Op2 = getValue(I.getOperand(2)); - MVT Ty = Op1.getValueType(); - - MVT ValueVTs[] = { Ty, MVT::i1 }; - SDValue Ops[] = { Op1, Op2 }; - - SDValue Result = DAG.getNode(ISD::UADDO, DAG.getVTList(&ValueVTs[0], 2), - &Ops[0], 2); + SDValue Result = + DAG.getNode((Intrinsic == Intrinsic::sadd_with_overflow) ? + ISD::SADDO : ISD::UADDO, + DAG.getVTList(&ValueVTs[0], 2), &Ops[0], 2); setValue(&I, Result); return 0; |