[llvm-commits] [llvm] r116196 - /llvm/trunk/lib/Target/ARM/ARMFastISel.cpp

Eric Christopher echristo at apple.com
Mon Oct 11 01:37:26 PDT 2010


Author: echristo
Date: Mon Oct 11 03:37:26 2010
New Revision: 116196

URL: http://llvm.org/viewvc/llvm-project?rev=116196&view=rev
Log:
Add srem libcall support to ARM fast isel.

Modified:
    llvm/trunk/lib/Target/ARM/ARMFastISel.cpp

Modified: llvm/trunk/lib/Target/ARM/ARMFastISel.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMFastISel.cpp?rev=116196&r1=116195&r2=116196&view=diff
==============================================================================
--- llvm/trunk/lib/Target/ARM/ARMFastISel.cpp (original)
+++ llvm/trunk/lib/Target/ARM/ARMFastISel.cpp Mon Oct 11 03:37:26 2010
@@ -127,6 +127,7 @@
     virtual bool SelectSIToFP(const Instruction *I);
     virtual bool SelectFPToSI(const Instruction *I);
     virtual bool SelectSDiv(const Instruction *I);
+    virtual bool SelectSRem(const Instruction *I);
     virtual bool SelectCall(const Instruction *I);
     virtual bool SelectSelect(const Instruction *I);
 
@@ -1120,6 +1121,28 @@
   return ARMEmitLibcall(I, LC);
 }
 
+bool ARMFastISel::SelectSRem(const Instruction *I) {
+  EVT VT;
+  const Type *Ty = I->getType();
+  if (!isTypeLegal(Ty, VT))
+    return false;
+
+  RTLIB::Libcall LC = RTLIB::UNKNOWN_LIBCALL;
+  if (VT == MVT::i8)
+    LC = RTLIB::SREM_I8;
+  else if (VT == MVT::i16)
+    LC = RTLIB::SREM_I16;
+  else if (VT == MVT::i32)
+    LC = RTLIB::SREM_I32;
+  else if (VT == MVT::i64)
+    LC = RTLIB::SREM_I64;
+  else if (VT == MVT::i128)
+    LC = RTLIB::SREM_I128;
+  assert(LC != RTLIB::UNKNOWN_LIBCALL && "Unsupported SDIV!");
+    
+  return ARMEmitLibcall(I, LC);
+}
+
 bool ARMFastISel::SelectBinaryOp(const Instruction *I, unsigned ISDOpcode) {
   EVT VT  = TLI.getValueType(I->getType(), true);
 
@@ -1519,6 +1542,8 @@
       return SelectBinaryOp(I, ISD::FMUL);
     case Instruction::SDiv:
       return SelectSDiv(I);
+    case Instruction::SRem:
+      return SelectSRem(I);
     case Instruction::Call:
       return SelectCall(I);
     case Instruction::Select:





More information about the llvm-commits mailing list