]> granicus.if.org Git - llvm/commitdiff
[SystemZ] implement hasDivRemOp()
authorJonas Paulsson <paulsson@linux.vnet.ibm.com>
Mon, 6 Nov 2017 13:10:31 +0000 (13:10 +0000)
committerJonas Paulsson <paulsson@linux.vnet.ibm.com>
Mon, 6 Nov 2017 13:10:31 +0000 (13:10 +0000)
SystemZ can do division and remainder in a single instruction for scalar
integer types, which are now reflected by returning true in this hook for
those cases.

Review: Ulrich Weigand

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@317477 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Target/SystemZ/SystemZTargetTransformInfo.cpp
lib/Target/SystemZ/SystemZTargetTransformInfo.h

index a4d9421e08aba272f41b049d91e4d6ed3f678cc7..6d50369e5876aa54047851b206f4682315849fe9 100644 (file)
@@ -323,6 +323,11 @@ unsigned SystemZTTIImpl::getRegisterBitWidth(bool Vector) const {
   return 0;
 }
 
+bool SystemZTTIImpl::hasDivRemOp(Type *DataType, bool IsSigned) {
+  EVT VT = TLI->getValueType(DL, DataType);
+  return (VT.isScalarInteger() && TLI->isTypeLegal(VT));
+}
+
 int SystemZTTIImpl::getArithmeticInstrCost(
     unsigned Opcode, Type *Ty,  
     TTI::OperandValueKind Op1Info, TTI::OperandValueKind Op2Info,
index 28821a2ca111605dc4b56be4d3db12a7264f05b7..4b11a6f0a837518e69ceef8bfb19235e77bf8cad 100644 (file)
@@ -62,6 +62,7 @@ public:
   unsigned getPrefetchDistance() { return 2000; }
   unsigned getMinPrefetchStride() { return 2048; }
 
+  bool hasDivRemOp(Type *DataType, bool IsSigned);
   bool prefersVectorizedAddressing() { return false; }
   bool LSRWithInstrQueries() { return true; }
   bool supportsEfficientVectorElementLoadStore() { return true; }