diff --git a/llvm/lib/Target/M68k/M68kISelLowering.h b/llvm/lib/Target/M68k/M68kISelLowering.h --- a/llvm/lib/Target/M68k/M68kISelLowering.h +++ b/llvm/lib/Target/M68k/M68kISelLowering.h @@ -43,7 +43,7 @@ CMP, /// M68k bit-test instructions. - BT, + BTST, /// M68k Select SELECT, @@ -204,8 +204,8 @@ const CCValAssign &VA, ISD::ArgFlagsTy Flags) const; SDValue LowerXALUO(SDValue Op, SelectionDAG &DAG) const; - SDValue LowerToBT(SDValue And, ISD::CondCode CC, const SDLoc &DL, - SelectionDAG &DAG) const; + SDValue LowerToBTST(SDValue And, ISD::CondCode CC, const SDLoc &DL, + SelectionDAG &DAG) const; SDValue LowerSETCC(SDValue Op, SelectionDAG &DAG) const; SDValue LowerSETCCCARRY(SDValue Op, SelectionDAG &DAG) const; SDValue LowerSELECT(SDValue Op, SelectionDAG &DAG) const; diff --git a/llvm/lib/Target/M68k/M68kISelLowering.cpp b/llvm/lib/Target/M68k/M68kISelLowering.cpp --- a/llvm/lib/Target/M68k/M68kISelLowering.cpp +++ b/llvm/lib/Target/M68k/M68kISelLowering.cpp @@ -1409,32 +1409,32 @@ return DAG.getNode(ISD::MERGE_VALUES, DL, N->getVTList(), Arith, SetCC); } -/// Create a BT (Bit Test) node - Test bit \p BitNo in \p Src and set condition -/// according to equal/not-equal condition code \p CC. +/// Create a BTST (Bit Test) node - Test bit \p BitNo in \p Src and set +/// condition according to equal/not-equal condition code \p CC. static SDValue getBitTestCondition(SDValue Src, SDValue BitNo, ISD::CondCode CC, const SDLoc &DL, SelectionDAG &DAG) { - // If Src is i8, promote it to i32 with any_extend. There is no i8 BT + // If Src is i8, promote it to i32 with any_extend. There is no i8 BTST // instruction. Since the shift amount is in-range-or-undefined, we know // that doing a bittest on the i32 value is ok. if (Src.getValueType() == MVT::i8 || Src.getValueType() == MVT::i16) Src = DAG.getNode(ISD::ANY_EXTEND, DL, MVT::i32, Src); // If the operand types disagree, extend the shift amount to match. Since - // BT ignores high bits (like shifts) we can use anyextend. + // BTST ignores high bits (like shifts) we can use anyextend. if (Src.getValueType() != BitNo.getValueType()) BitNo = DAG.getNode(ISD::ANY_EXTEND, DL, Src.getValueType(), BitNo); - SDValue BT = DAG.getNode(M68kISD::BT, DL, MVT::i32, Src, BitNo); + SDValue BTST = DAG.getNode(M68kISD::BTST, DL, MVT::i32, Src, BitNo); // NOTE BTST sets CCR.Z flag M68k::CondCode Cond = CC == ISD::SETEQ ? M68k::COND_NE : M68k::COND_EQ; return DAG.getNode(M68kISD::SETCC, DL, MVT::i8, - DAG.getConstant(Cond, DL, MVT::i8), BT); + DAG.getConstant(Cond, DL, MVT::i8), BTST); } -/// Result of 'and' is compared against zero. Change to a BT node if possible. -static SDValue LowerAndToBT(SDValue And, ISD::CondCode CC, const SDLoc &DL, - SelectionDAG &DAG) { +/// Result of 'and' is compared against zero. Change to a BTST node if possible. +static SDValue LowerAndToBTST(SDValue And, ISD::CondCode CC, const SDLoc &DL, + SelectionDAG &DAG) { SDValue Op0 = And.getOperand(0); SDValue Op1 = And.getOperand(1); if (Op0.getOpcode() == ISD::TRUNCATE) @@ -1468,7 +1468,7 @@ RHS = AndLHS.getOperand(1); } - // Use BT if the immediate can't be encoded in a TEST instruction. + // Use BTST if the immediate can't be encoded in a TEST instruction. if (!isUInt<32>(AndRHSVal) && isPowerOf2_64(AndRHSVal)) { LHS = AndLHS; RHS = DAG.getConstant(Log2_64_Ceil(AndRHSVal), DL, LHS.getValueType()); @@ -1592,8 +1592,8 @@ } // Convert (truncate (srl X, N) to i1) to (bt X, N) -static SDValue LowerTruncateToBT(SDValue Op, ISD::CondCode CC, const SDLoc &DL, - SelectionDAG &DAG) { +static SDValue LowerTruncateToBTST(SDValue Op, ISD::CondCode CC, + const SDLoc &DL, SelectionDAG &DAG) { assert(Op.getOpcode() == ISD::TRUNCATE && Op.getValueType() == MVT::i1 && "Expected TRUNCATE to i1 node"); @@ -1889,14 +1889,14 @@ } /// Result of 'and' or 'trunc to i1' is compared against zero. -/// Change to a BT node if possible. -SDValue M68kTargetLowering::LowerToBT(SDValue Op, ISD::CondCode CC, - const SDLoc &DL, - SelectionDAG &DAG) const { +/// Change to a BTST node if possible. +SDValue M68kTargetLowering::LowerToBTST(SDValue Op, ISD::CondCode CC, + const SDLoc &DL, + SelectionDAG &DAG) const { if (Op.getOpcode() == ISD::AND) - return LowerAndToBT(Op, CC, DL, DAG); + return LowerAndToBTST(Op, CC, DL, DAG); if (Op.getOpcode() == ISD::TRUNCATE && Op.getValueType() == MVT::i1) - return LowerTruncateToBT(Op, CC, DL, DAG); + return LowerTruncateToBTST(Op, CC, DL, DAG); return SDValue(); } @@ -1909,14 +1909,14 @@ SDLoc DL(Op); ISD::CondCode CC = cast(Op.getOperand(2))->get(); - // Optimize to BT if possible. - // Lower (X & (1 << N)) == 0 to BT(X, N). - // Lower ((X >>u N) & 1) != 0 to BT(X, N). - // Lower ((X >>s N) & 1) != 0 to BT(X, N). - // Lower (trunc (X >> N) to i1) to BT(X, N). + // Optimize to BTST if possible. + // Lower (X & (1 << N)) == 0 to BTST(X, N). + // Lower ((X >>u N) & 1) != 0 to BTST(X, N). + // Lower ((X >>s N) & 1) != 0 to BTST(X, N). + // Lower (trunc (X >> N) to i1) to BTST(X, N). if (Op0.hasOneUse() && isNullConstant(Op1) && (CC == ISD::SETEQ || CC == ISD::SETNE)) { - if (SDValue NewSetCC = LowerToBT(Op0, CC, DL, DAG)) { + if (SDValue NewSetCC = LowerToBTST(Op0, CC, DL, DAG)) { if (VT == MVT::i1) return DAG.getNode(ISD::TRUNCATE, DL, MVT::i1, NewSetCC); return NewSetCC; @@ -2099,7 +2099,7 @@ bool IllegalFPCMov = false; - if ((isM68kLogicalCmp(Cmp) && !IllegalFPCMov) || Opc == M68kISD::BT) { + if ((isM68kLogicalCmp(Cmp) && !IllegalFPCMov) || Opc == M68kISD::BTST) { Cond = Cmp; addTest = false; } @@ -2163,7 +2163,7 @@ // We know the result of AND is compared against zero. Try to match // it to BT. if (Cond.getOpcode() == ISD::AND && Cond.hasOneUse()) { - if (SDValue NewSetCC = LowerToBT(Cond, ISD::SETNE, DL, DAG)) { + if (SDValue NewSetCC = LowerToBTST(Cond, ISD::SETNE, DL, DAG)) { CC = NewSetCC.getOperand(0); Cond = NewSetCC.getOperand(1); addTest = false; @@ -2282,7 +2282,7 @@ SDValue Cmp = Cond.getOperand(1); unsigned Opc = Cmp.getOpcode(); - if (isM68kLogicalCmp(Cmp) || Opc == M68kISD::BT) { + if (isM68kLogicalCmp(Cmp) || Opc == M68kISD::BTST) { Cond = Cmp; AddTest = false; } else { @@ -2427,7 +2427,7 @@ // We know the result is compared against zero. Try to match it to BT. if (Cond.hasOneUse()) { - if (SDValue NewSetCC = LowerToBT(Cond, ISD::SETNE, DL, DAG)) { + if (SDValue NewSetCC = LowerToBTST(Cond, ISD::SETNE, DL, DAG)) { CC = NewSetCC.getOperand(0); Cond = NewSetCC.getOperand(1); AddTest = false; @@ -3391,8 +3391,8 @@ return "M68kISD::AND"; case M68kISD::CMP: return "M68kISD::CMP"; - case M68kISD::BT: - return "M68kISD::BT"; + case M68kISD::BTST: + return "M68kISD::BTST"; case M68kISD::SELECT: return "M68kISD::SELECT"; case M68kISD::CMOV: diff --git a/llvm/lib/Target/M68k/M68kInstrBits.td b/llvm/lib/Target/M68k/M68kInstrBits.td --- a/llvm/lib/Target/M68k/M68kInstrBits.td +++ b/llvm/lib/Target/M68k/M68kInstrBits.td @@ -51,24 +51,24 @@ let Defs = [CCR] in { class MxBTST_RR : MxInst<(outs), (ins TYPE.ROp:$dst, TYPE.ROp:$bitno), "btst\t$bitno, $dst", - [(set CCR, (MxBt TYPE.VT:$dst, TYPE.VT:$bitno))], + [(set CCR, (MxBtst TYPE.VT:$dst, TYPE.VT:$bitno))], MxBTSTEnc_R, MxEncEAd_0, MxExtEmpty>>; class MxBTST_RI : MxInst<(outs), (ins TYPE.ROp:$dst, TYPE.IOp:$bitno), "btst\t$bitno, $dst", - [(set CCR, (MxBt TYPE.VT:$dst, TYPE.IPat:$bitno))], + [(set CCR, (MxBtst TYPE.VT:$dst, TYPE.IPat:$bitno))], MxBTSTEnc_I, MxEncEAd_0, MxExtEmpty>>; class MxBTST_MR : MxInst<(outs), (ins MEMOpd:$dst, TYPE.ROp:$bitno), "btst\t$bitno, $dst", - [(set CCR, (MxBt (TYPE.Load MEMPat:$dst), TYPE.VT:$bitno))], + [(set CCR, (MxBtst (TYPE.Load MEMPat:$dst), TYPE.VT:$bitno))], MxBTSTEnc_R, EA, EXT>>; class MxBTST_MI : MxInst<(outs), (ins MEMOpd:$dst, TYPE.IOp:$bitno), "btst\t$bitno, $dst", - [(set CCR, (MxBt (TYPE.Load MEMPat:$dst), TYPE.IPat:$bitno))], + [(set CCR, (MxBtst (TYPE.Load MEMPat:$dst), TYPE.IPat:$bitno))], MxBTSTEnc_I, EA, EXT>>; } // Defs = [CCR] diff --git a/llvm/lib/Target/M68k/M68kInstrInfo.td b/llvm/lib/Target/M68k/M68kInstrInfo.td --- a/llvm/lib/Target/M68k/M68kInstrInfo.td +++ b/llvm/lib/Target/M68k/M68kInstrInfo.td @@ -137,7 +137,7 @@ def MxUMul : SDNode<"M68kISD::UMUL", MxSDT_2BiArithCCROut, [SDNPCommutative]>; def MxCmp : SDNode<"M68kISD::CMP", MxSDT_CmpTest>; -def MxBt : SDNode<"M68kISD::BT", MxSDT_CmpTest>; +def MxBtst : SDNode<"M68kISD::BTST", MxSDT_CmpTest>; def MxCmov : SDNode<"M68kISD::CMOV", MxSDT_Cmov>; def MxBrCond : SDNode<"M68kISD::BRCOND", MxSDT_BrCond, [SDNPHasChain]>;