diff options
author | Kevin Enderby <enderby@apple.com> | 2011-03-29 21:11:52 +0000 |
---|---|---|
committer | Kevin Enderby <enderby@apple.com> | 2011-03-29 21:11:52 +0000 |
commit | 360d8d7a02188c694b79e5e4c8fafcfa84257938 (patch) | |
tree | 2349a486e5fa8ba4f4c5b998a2c1e75dd09f5565 /lib | |
parent | 5726005e4f1df81f47af99eebd380fca78577fa4 (diff) | |
download | external_llvm-360d8d7a02188c694b79e5e4c8fafcfa84257938.zip external_llvm-360d8d7a02188c694b79e5e4c8fafcfa84257938.tar.gz external_llvm-360d8d7a02188c694b79e5e4c8fafcfa84257938.tar.bz2 |
Added support symbolic floating point constants in the MC assembler for Infinity
and Nans with the same strings as GAS supports. rdar://8673024
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@128488 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r-- | lib/MC/MCParser/AsmParser.cpp | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/lib/MC/MCParser/AsmParser.cpp b/lib/MC/MCParser/AsmParser.cpp index 19f7bd8..ff5298f 100644 --- a/lib/MC/MCParser/AsmParser.cpp +++ b/lib/MC/MCParser/AsmParser.cpp @@ -1552,13 +1552,21 @@ bool AsmParser::ParseDirectiveRealValue(const fltSemantics &Semantics) { Lex(); if (getLexer().isNot(AsmToken::Integer) && - getLexer().isNot(AsmToken::Real)) + getLexer().isNot(AsmToken::Real) && + getLexer().isNot(AsmToken::Identifier)) return TokError("unexpected token in directive"); // Convert to an APFloat. APFloat Value(Semantics); - if (Value.convertFromString(getTok().getString(), - APFloat::rmNearestTiesToEven) == + StringRef IDVal = getTok().getString(); + if (getLexer().is(AsmToken::Identifier)) { + if (!IDVal.compare_lower("infinity") || !IDVal.compare_lower("inf")) + Value = APFloat::getInf(Semantics); + else if (!IDVal.compare_lower("nan")) + Value = APFloat::getNaN(Semantics, false, ~0); + else + return TokError("invalid floating point literal"); + } else if (Value.convertFromString(IDVal, APFloat::rmNearestTiesToEven) == APFloat::opInvalidOp) return TokError("invalid floating point literal"); if (IsNeg) |