summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Target/PIC16/PIC16ISelLowering.cpp
diff options
context:
space:
mode:
authorSanjiv Gupta <sanjiv.gupta@microchip.com>2009-07-27 02:26:06 +0000
committerSanjiv Gupta <sanjiv.gupta@microchip.com>2009-07-27 02:26:06 +0000
commite334b34bfdf0a5d6c3091714bbf41b0ecb935e3a (patch)
tree69b3d6fb557559de00b13f2cea0274d85279748e /llvm/lib/Target/PIC16/PIC16ISelLowering.cpp
parentba4c6d1c91afc1d7dd83f3b3add69d9551f60123 (diff)
downloadbcm5719-llvm-e334b34bfdf0a5d6c3091714bbf41b0ecb935e3a.tar.gz
bcm5719-llvm-e334b34bfdf0a5d6c3091714bbf41b0ecb935e3a.zip
fixed incorrect lowering of ISD::SUB node. SUB has only one result value.
It wasn't caught during tests because we never got a sub generated, (i8 was always getting promoted to int, which in turn was broken into subc/sube). Though the optimizer leaves an i8 sub now. llvm-svn: 77178
Diffstat (limited to 'llvm/lib/Target/PIC16/PIC16ISelLowering.cpp')
-rw-r--r--llvm/lib/Target/PIC16/PIC16ISelLowering.cpp19
1 files changed, 14 insertions, 5 deletions
diff --git a/llvm/lib/Target/PIC16/PIC16ISelLowering.cpp b/llvm/lib/Target/PIC16/PIC16ISelLowering.cpp
index 8f59512620a..5949b7b097a 100644
--- a/llvm/lib/Target/PIC16/PIC16ISelLowering.cpp
+++ b/llvm/lib/Target/PIC16/PIC16ISelLowering.cpp
@@ -1573,11 +1573,20 @@ SDValue PIC16TargetLowering::LowerSUB(SDValue Op, SelectionDAG &DAG) {
SDValue NewVal = ConvertToMemOperand (Op.getOperand(0), DAG, dl);
SDVTList Tys = DAG.getVTList(MVT::i8, MVT::Flag);
- if (Op.getOpcode() == ISD::SUBE)
- return DAG.getNode(Op.getOpcode(), dl, Tys, NewVal, Op.getOperand(1),
- Op.getOperand(2));
- else
- return DAG.getNode(Op.getOpcode(), dl, Tys, NewVal, Op.getOperand(1));
+ switch (Op.getOpcode()) {
+ case ISD::SUBE:
+ return DAG.getNode(Op.getOpcode(), dl, Tys, NewVal, Op.getOperand(1),
+ Op.getOperand(2));
+ break;
+ case ISD::SUBC:
+ return DAG.getNode(Op.getOpcode(), dl, Tys, NewVal, Op.getOperand(1));
+ break;
+ case ISD::SUB:
+ return DAG.getNode(Op.getOpcode(), dl, MVT::i8, NewVal, Op.getOperand(1));
+ break;
+ default:
+ assert (0 && "Opcode unknown.");
+ }
}
void PIC16TargetLowering::InitReservedFrameCount(const Function *F) {
OpenPOWER on IntegriCloud