aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Support/APInt.cpp
diff options
context:
space:
mode:
authorSimon Pilgrim <llvm-dev@redking.me.uk>2020-02-15 13:27:06 +0000
committerSimon Pilgrim <llvm-dev@redking.me.uk>2020-02-15 13:27:06 +0000
commit366ae9c90fe6d3a590c0a0d4283c019f11799516 (patch)
tree7d7936de386571394722489480eb8d79a45cbd98 /llvm/lib/Support/APInt.cpp
parentdc0b8159890134a59fdf34b20e8b2052d9456441 (diff)
downloadllvm-366ae9c90fe6d3a590c0a0d4283c019f11799516.zip
llvm-366ae9c90fe6d3a590c0a0d4283c019f11799516.tar.gz
llvm-366ae9c90fe6d3a590c0a0d4283c019f11799516.tar.bz2
[APInt] byteSwap - handle any whole byte bitwidth greater than 16-bits
As noted on D74621, the bswap intrinsic has a self imposed limitation that the type's bitwidth must be divisible by 16, but there's no reason that APInt::byteSwap must have the same limitation, given that it can already handle any byte width.
Diffstat (limited to 'llvm/lib/Support/APInt.cpp')
-rw-r--r--llvm/lib/Support/APInt.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/llvm/lib/Support/APInt.cpp b/llvm/lib/Support/APInt.cpp
index 3a5fada..faef9a3 100644
--- a/llvm/lib/Support/APInt.cpp
+++ b/llvm/lib/Support/APInt.cpp
@@ -670,7 +670,7 @@ bool APInt::isSubsetOfSlowCase(const APInt &RHS) const {
}
APInt APInt::byteSwap() const {
- assert(BitWidth >= 16 && BitWidth % 16 == 0 && "Cannot byteswap!");
+ assert(BitWidth >= 16 && BitWidth % 8 == 0 && "Cannot byteswap!");
if (BitWidth == 16)
return APInt(BitWidth, ByteSwap_16(uint16_t(U.VAL)));
if (BitWidth == 32)