diff options
| author | Dale Johannesen <dalej@apple.com> | 2009-05-13 00:24:22 +0000 |
|---|---|---|
| committer | Dale Johannesen <dalej@apple.com> | 2009-05-13 00:24:22 +0000 |
| commit | 536de01bcfa09dd175fa5f965af3e0d8a19ab7d9 (patch) | |
| tree | 467217d0079d594f833e8546d8ce6247d254203f /llvm/lib | |
| parent | 98d7164ab0b46856b7a1e475a7f173f6800a97c7 (diff) | |
| download | bcm5719-llvm-536de01bcfa09dd175fa5f965af3e0d8a19ab7d9.tar.gz bcm5719-llvm-536de01bcfa09dd175fa5f965af3e0d8a19ab7d9.zip | |
Add an int64_t variant of abs, for host environments
without one. Use it where we were using abs on
int64_t objects.
(I strongly suspect the casts to unsigned in the
fragments in LoopStrengthReduce are not doing whatever
the original intent was, but the obvious change to
uint64_t doesn't work. Maybe later.)
llvm-svn: 71612
Diffstat (limited to 'llvm/lib')
| -rw-r--r-- | llvm/lib/Target/Alpha/AlphaInstrInfo.td | 4 | ||||
| -rw-r--r-- | llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp | 6 |
2 files changed, 5 insertions, 5 deletions
diff --git a/llvm/lib/Target/Alpha/AlphaInstrInfo.td b/llvm/lib/Target/Alpha/AlphaInstrInfo.td index ae9282564d1..e73bdf9f6e9 100644 --- a/llvm/lib/Target/Alpha/AlphaInstrInfo.td +++ b/llvm/lib/Target/Alpha/AlphaInstrInfo.td @@ -69,7 +69,7 @@ def nearP2X : SDNodeXForm<imm, [{ }]>; def nearP2RemX : SDNodeXForm<imm, [{ uint64_t x = - abs(N->getZExtValue() - getNearPower2((uint64_t)N->getZExtValue())); + abs64(N->getZExtValue() - getNearPower2((uint64_t)N->getZExtValue())); return getI64Imm(Log2_64(x)); }]>; @@ -124,7 +124,7 @@ def immRemP2 : PatLeaf<(imm), [{ getNearPower2((uint64_t)N->getZExtValue())); }]>; def immUExt8ME : PatLeaf<(imm), [{ //use this imm for mulqi - int64_t d = abs((int64_t)N->getZExtValue() - + int64_t d = abs64((int64_t)N->getZExtValue() - (int64_t)getNearPower2((uint64_t)N->getZExtValue())); if (isPowerOf2_64(d)) return false; switch (d) { diff --git a/llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp b/llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp index 4f6d53179ed..ed12d8683d2 100644 --- a/llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp +++ b/llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp @@ -1013,7 +1013,7 @@ SCEVHandle LoopStrengthReduce::CheckForIVReuse(bool HasBaseReg, continue; int64_t SSInt = cast<SCEVConstant>(SI->first)->getValue()->getSExtValue(); if (SI->first != Stride && - (unsigned(abs(SInt)) < SSInt || (SInt % SSInt) != 0)) + (unsigned(abs64(SInt)) < SSInt || (SInt % SSInt) != 0)) continue; int64_t Scale = SInt / SSInt; // Check that this stride is valid for all the types used for loads and @@ -1900,7 +1900,7 @@ ICmpInst *LoopStrengthReduce::ChangeCompareStride(Loop *L, ICmpInst *Cond, continue; int64_t SSInt = cast<SCEVConstant>(SI->first)->getValue()->getSExtValue(); if (SSInt == CmpSSInt || - abs(SSInt) < abs(CmpSSInt) || + abs64(SSInt) < abs64(CmpSSInt) || (SSInt % CmpSSInt) != 0) continue; @@ -2336,7 +2336,7 @@ void LoopStrengthReduce::OptimizeLoopTermCond(Loop *L) { cast<SCEVConstant>(SI->first)->getValue()->getSExtValue(); if (SSInt == SInt) return; // This can definitely be reused. - if (unsigned(abs(SSInt)) < SInt || (SSInt % SInt) != 0) + if (unsigned(abs64(SSInt)) < SInt || (SSInt % SInt) != 0) continue; int64_t Scale = SSInt / SInt; bool AllUsesAreAddresses = true; |

