llvm.org GIT mirror llvm / 8474c35
[NVPTX] Use GreatestCommonDivisor64 from MathExtras instead of using our own. Thanks Hal! git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@211952 91177308-0d34-0410-b5e6-96231b3b80d8 Justin Holewinski 6 years ago
1 changed file(s) with 4 addition(s) and 14 deletion(s). Raw diff Collapse all Expand all
3232 #include "llvm/Support/CommandLine.h"
3333 #include "llvm/Support/Debug.h"
3434 #include "llvm/Support/ErrorHandling.h"
35 #include "llvm/Support/MathExtras.h"
3536 #include "llvm/Support/raw_ostream.h"
3637 #include
3738
6465 case MVT::v2f64:
6566 return true;
6667 }
67 }
68
69 static uint64_t GCD( int a, int b)
70 {
71 if (a < b) std::swap(a,b);
72 while (b > 0) {
73 uint64_t c = b;
74 b = a % b;
75 a = c;
76 }
77 return a;
7868 }
7969
8070 /// ComputePTXValueVTs - For the given Type \p Ty, returns the set of primitive
717707 InFlag = Chain.getValue(1);
718708 for (unsigned j = 0, je = vtparts.size(); j != je; ++j) {
719709 EVT elemtype = vtparts[j];
720 unsigned ArgAlign = GCD(align, Offsets[j]);
710 unsigned ArgAlign = GreatestCommonDivisor64(align, Offsets[j]);
721711 if (elemtype.isInteger() && (sz < 8))
722712 sz = 8;
723713 SDValue StVal = OutVals[OIdx];
942932 for (unsigned j = 0, je = vtparts.size(); j != je; ++j) {
943933 EVT elemtype = vtparts[j];
944934 int curOffset = Offsets[j];
945 unsigned PartAlign = GCD(ArgAlign, curOffset);
935 unsigned PartAlign = GreatestCommonDivisor64(ArgAlign, curOffset);
946936 SDValue srcAddr =
947937 DAG.getNode(ISD::ADD, dl, getPointerTy(), OutVals[OIdx],
948938 DAG.getConstant(curOffset, getPointerTy()));
12031193 unsigned RetAlign = getArgumentAlignment(Callee, CS, retTy, 0);
12041194 for (unsigned i = 0, e = Ins.size(); i != e; ++i) {
12051195 unsigned sz = VTs[i].getSizeInBits();
1206 unsigned AlignI = GCD(RetAlign, Offsets[i]);
1196 unsigned AlignI = GreatestCommonDivisor64(RetAlign, Offsets[i]);
12071197 bool needTruncate = sz < 8 ? true : false;
12081198 if (VTs[i].isInteger() && (sz < 8))
12091199 sz = 8;