[llvm] r277813 - LLLexer.cpp: Avoid using BitsToDouble() to preserve SNaN like "double 0x7FF4000000000000".

NAKAMURA Takumi via llvm-commits llvm-commits at lists.llvm.org
Fri Aug 5 04:59:49 PDT 2016


Author: chapuni
Date: Fri Aug  5 06:59:49 2016
New Revision: 277813

URL: http://llvm.org/viewvc/llvm-project?rev=277813&view=rev
Log:
LLLexer.cpp: Avoid using BitsToDouble() to preserve SNaN like "double 0x7FF4000000000000".

We should not use double (or float) in the LLVM, unless it is really needed. x87 FP register doesn't preserve SNaN to move the value.

FIXME: APFloat() may have the constructor by raw bit.

Modified:
    llvm/trunk/lib/AsmParser/LLLexer.cpp

Modified: llvm/trunk/lib/AsmParser/LLLexer.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/AsmParser/LLLexer.cpp?rev=277813&r1=277812&r2=277813&view=diff
==============================================================================
--- llvm/trunk/lib/AsmParser/LLLexer.cpp (original)
+++ llvm/trunk/lib/AsmParser/LLLexer.cpp Fri Aug  5 06:59:49 2016
@@ -871,7 +871,8 @@ lltok::Kind LLLexer::Lex0x() {
     // HexFPConstant - Floating point constant represented in IEEE format as a
     // hexadecimal number for when exponential notation is not precise enough.
     // Half, Float, and double only.
-    APFloatVal = APFloat(BitsToDouble(HexIntToVal(TokStart + 2, CurPtr)));
+    APFloatVal = APFloat(APFloat::IEEEdouble,
+                         APInt(64, HexIntToVal(TokStart + 2, CurPtr)));
     return lltok::APFloat;
   }
 




More information about the llvm-commits mailing list