From bb893fea6b142c52d7d73fb3fd4332e31d11644d Mon Sep 17 00:00:00 2001 From: Rafael Espindola Date: Fri, 27 Jan 2012 23:33:07 +0000 Subject: Add r149110 back with a fix for when the vector and the int have the same width. llvm-svn: 149151 --- llvm/lib/Support/APInt.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'llvm/lib/Support/APInt.cpp') diff --git a/llvm/lib/Support/APInt.cpp b/llvm/lib/Support/APInt.cpp index b5411be..c580dd3 100644 --- a/llvm/lib/Support/APInt.cpp +++ b/llvm/lib/Support/APInt.cpp @@ -1123,6 +1123,18 @@ APInt APInt::sextOrTrunc(unsigned width) const { return *this; } +APInt APInt::zextOrSelf(unsigned width) const { + if (BitWidth < width) + return zext(width); + return *this; +} + +APInt APInt::sextOrSelf(unsigned width) const { + if (BitWidth < width) + return sext(width); + return *this; +} + /// Arithmetic right-shift this APInt by shiftAmt. /// @brief Arithmetic right-shift function. APInt APInt::ashr(const APInt &shiftAmt) const { -- cgit v1.1