llvm.org GIT mirror llvm / e0ffc92
Use sublw for comparison with literals instead of subwf. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@63382 91177308-0d34-0410-b5e6-96231b3b80d8 Sanjiv Gupta 10 years ago
1 changed file(s) with 11 addition(s) and 9 deletion(s). Raw diff Collapse all Expand all
12871287 }
12881288
12891289 PIC16CC = DAG.getConstant(CondCode, MVT::i8);
1290 SDVTList VTs = DAG.getVTList (MVT::i8, MVT::Flag);
12911290
12921291 // These are signed comparisons.
12931292 SDValue Mask = DAG.getConstant(128, MVT::i8);
12941293 if (isSignedComparison(CondCode)) {
1295 LHS = DAG.getNode (ISD::XOR, MVT::i8, LHS, Mask);
1294 LHS = DAG.getNode (ISD::XOR, MVT::i8, LHS, Mask);
12961295 RHS = DAG.getNode (ISD::XOR, MVT::i8, RHS, Mask);
12971296 }
1297
1298 SDVTList VTs = DAG.getVTList (MVT::i8, MVT::Flag);
12981299 // We can use a subtract operation to set the condition codes. But
12991300 // we need to put one operand in memory if required.
1300 // Nothing to do if the first operand is already a direct load and it has
1301 // only one use.
1302 if (! (isDirectLoad(LHS) && LHS.hasOneUse()))
1303 // Put first operand on stack.
1304 LHS = ConvertToMemOperand (LHS, DAG);
1305
1306 SDVTList Tys = DAG.getVTList(MVT::i8, MVT::Flag);
1301 // Nothing to do if the first operand is already a valid type (direct load
1302 // for subwf and literal for sublw) and it is used by this operation only.
1303 if ((LHS.getOpcode() == ISD::Constant || isDirectLoad(LHS))
1304 && LHS.hasOneUse())
1305 return DAG.getNode(PIC16ISD::SUBCC, VTs, LHS, RHS);
1306
1307 // else convert the first operand to mem.
1308 LHS = ConvertToMemOperand (LHS, DAG);
13071309 return DAG.getNode(PIC16ISD::SUBCC, VTs, LHS, RHS);
13081310 }
13091311