From: Dale Johannesen Date: Sun, 30 Sep 2007 18:17:01 +0000 (+0000) Subject: Simplify and fix signed int -> FP conversions. X-Git-Url: http://plrg.eecs.uci.edu/git/?a=commitdiff_plain;h=cce23a4c3585d9d7df538bbc71151624a18f40cd;p=oota-llvm.git Simplify and fix signed int -> FP conversions. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@42483 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Support/APFloat.cpp b/lib/Support/APFloat.cpp index 278e546d8a3..8e1580bd4a7 100644 --- a/lib/Support/APFloat.cpp +++ b/lib/Support/APFloat.cpp @@ -1519,17 +1519,9 @@ APFloat::convertFromInteger(const integerPart *parts, unsigned int width, integerPart *copy = new integerPart[partCount]; sign = false; - if(isSigned) { - if (APInt::tcExtractBit(parts, width - 1)) { - sign = true; - if (width < partCount * integerPartWidth) - api = api.sext(partCount * integerPartWidth); - } - else if (width < partCount * integerPartWidth) - api = api.zext(partCount * integerPartWidth); - } else { - if (width < partCount * integerPartWidth) - api = api.zext(partCount * integerPartWidth); + if(isSigned && APInt::tcExtractBit(parts, width - 1)) { + sign = true; + api = -api; } APInt::tcAssign(copy, api.getRawData(), partCount);