[llvm] r194819 - [mips][msa] lowerMSABitClear() should use SelectionDAG::getNOT() instead of using a long-winded equivalent.

Daniel Sanders daniel.sanders at imgtec.com
Fri Nov 15 08:02:05 PST 2013


Author: dsanders
Date: Fri Nov 15 10:02:04 2013
New Revision: 194819

URL: http://llvm.org/viewvc/llvm-project?rev=194819&view=rev
Log:
[mips][msa] lowerMSABitClear() should use SelectionDAG::getNOT() instead of using a long-winded equivalent.

Now that getConstant(-1, MVT::v2i64) works correctly on MIPS32 we can use
SelectionDAG::getNOT() to produce the bitmask.


Modified:
    llvm/trunk/lib/Target/Mips/MipsSEISelLowering.cpp

Modified: llvm/trunk/lib/Target/Mips/MipsSEISelLowering.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Mips/MipsSEISelLowering.cpp?rev=194819&r1=194818&r2=194819&view=diff
==============================================================================
--- llvm/trunk/lib/Target/Mips/MipsSEISelLowering.cpp (original)
+++ llvm/trunk/lib/Target/Mips/MipsSEISelLowering.cpp Fri Nov 15 10:02:04 2013
@@ -1368,24 +1368,12 @@ static SDValue lowerMSABinaryBitImmIntr(
 
 static SDValue lowerMSABitClear(SDValue Op, SelectionDAG &DAG) {
   EVT ResTy = Op->getValueType(0);
-  EVT ViaVecTy = ResTy == MVT::v2i64 ? MVT::v4i32 : ResTy;
   SDLoc DL(Op);
   SDValue One = DAG.getConstant(1, ResTy);
   SDValue Bit = DAG.getNode(ISD::SHL, DL, ResTy, One, Op->getOperand(2));
 
-  SDValue AllOnes = DAG.getConstant(-1, MVT::i32);
-  SDValue AllOnesOperands[16] = { AllOnes, AllOnes, AllOnes, AllOnes,
-                                  AllOnes, AllOnes, AllOnes, AllOnes,
-                                  AllOnes, AllOnes, AllOnes, AllOnes,
-                                  AllOnes, AllOnes, AllOnes, AllOnes };
-  AllOnes = DAG.getNode(ISD::BUILD_VECTOR, DL, ViaVecTy, AllOnesOperands,
-                        ViaVecTy.getVectorNumElements());
-  if (ResTy != ViaVecTy)
-    AllOnes = DAG.getNode(ISD::BITCAST, DL, ResTy, AllOnes);
-
-  Bit = DAG.getNode(ISD::XOR, DL, ResTy, Bit, AllOnes);
-
-  return DAG.getNode(ISD::AND, DL, ResTy, Op->getOperand(1), Bit);
+  return DAG.getNode(ISD::AND, DL, ResTy, Op->getOperand(1),
+                     DAG.getNOT(DL, Bit, ResTy));
 }
 
 static SDValue lowerMSABitClearImm(SDValue Op, SelectionDAG &DAG) {





More information about the llvm-commits mailing list