diff options
author | Krzysztof Parzyszek <kparzysz@codeaurora.org> | 2018-09-10 18:49:16 +0000 |
---|---|---|
committer | Krzysztof Parzyszek <kparzysz@codeaurora.org> | 2018-09-10 18:49:16 +0000 |
commit | 59b57c39fb77e149e19208b1fe9db79e1b745678 (patch) | |
tree | 48018815f9ddf483c8553ec34c88a73c71a3e441 /llvm/lib/Target/Hexagon/HexagonConstExtenders.cpp | |
parent | 691d1a40e28087d46e2e7876f9b6ddcd835604db (diff) | |
download | bcm5719-llvm-59b57c39fb77e149e19208b1fe9db79e1b745678.tar.gz bcm5719-llvm-59b57c39fb77e149e19208b1fe9db79e1b745678.zip |
[Hexagon] Split large offsets into properly aligned addends
llvm-svn: 341851
Diffstat (limited to 'llvm/lib/Target/Hexagon/HexagonConstExtenders.cpp')
-rw-r--r-- | llvm/lib/Target/Hexagon/HexagonConstExtenders.cpp | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/llvm/lib/Target/Hexagon/HexagonConstExtenders.cpp b/llvm/lib/Target/Hexagon/HexagonConstExtenders.cpp index 81bb36135d8..efbf6fe9c36 100644 --- a/llvm/lib/Target/Hexagon/HexagonConstExtenders.cpp +++ b/llvm/lib/Target/Hexagon/HexagonConstExtenders.cpp @@ -1708,6 +1708,15 @@ bool HCE::replaceInstrExpr(const ExtDesc &ED, const ExtenderInit &ExtI, // Clamp Diff to the 16 bit range. int32_t D = isInt<16>(Diff) ? Diff : (Diff > 0 ? 32767 : -32768); + if (Diff > 32767) { + // Split Diff into two values: one that is close to min/max int16, + // and the other being the rest, and such that both have the same + // "alignment" as Diff. + uint32_t UD = Diff; + OffsetRange R = getOffsetRange(MI.getOperand(0)); + uint32_t A = std::min<uint32_t>(R.Align, 1u << countTrailingZeros(UD)); + D &= ~(A-1); + } BuildMI(MBB, At, dl, HII->get(IdxOpc)) .add(MI.getOperand(0)) .add(MachineOperand(ExtR)) |