aboutsummaryrefslogtreecommitdiffstats
path: root/lib/AsmParser/llvmAsmParser.y
diff options
context:
space:
mode:
authorDale Johannesen <dalej@apple.com>2007-09-11 18:32:33 +0000
committerDale Johannesen <dalej@apple.com>2007-09-11 18:32:33 +0000
commit3f6eb7419de437436265831fce92f62498556e08 (patch)
treecb752d4a86ec5c5dd783cfc421e30d0cf7600e87 /lib/AsmParser/llvmAsmParser.y
parent6320260e060ce4fc5d199d757b15a0f43be66029 (diff)
downloadexternal_llvm-3f6eb7419de437436265831fce92f62498556e08.zip
external_llvm-3f6eb7419de437436265831fce92f62498556e08.tar.gz
external_llvm-3f6eb7419de437436265831fce92f62498556e08.tar.bz2
Add APInt interfaces to APFloat (allows directly
access to bits). Use them in place of float and double interfaces where appropriate. First bits of x86 long double constants handling (untested, probably does not work). git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@41858 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/AsmParser/llvmAsmParser.y')
-rw-r--r--lib/AsmParser/llvmAsmParser.y13
1 files changed, 7 insertions, 6 deletions
diff --git a/lib/AsmParser/llvmAsmParser.y b/lib/AsmParser/llvmAsmParser.y
index 6364b29..c0374da 100644
--- a/lib/AsmParser/llvmAsmParser.y
+++ b/lib/AsmParser/llvmAsmParser.y
@@ -416,9 +416,10 @@ static Value *getExistingVal(const Type *Ty, const ValID &D) {
GenerateError("FP constant invalid for type");
return 0;
}
- // Lexer has no type info, so builds all FP constants as double.
- // Fix this here.
- if (Ty==Type::FloatTy)
+ // Lexer has no type info, so builds all float and double FP constants
+ // as double. Fix this here. Long double does not need this.
+ if (&D.ConstPoolFP->getSemantics() == &APFloat::IEEEdouble &&
+ Ty==Type::FloatTy)
D.ConstPoolFP->convert(APFloat::IEEEsingle, APFloat::rmNearestTiesToEven);
return ConstantFP::get(Ty, *D.ConstPoolFP);
@@ -1868,9 +1869,9 @@ ConstVal: Types '[' ConstVector ']' { // Nonempty unsized arr
| FPType FPVAL { // Float & Double constants
if (!ConstantFP::isValueValidForType($1, *$2))
GEN_ERROR("Floating point constant invalid for type");
- // Lexer has no type info, so builds all FP constants as double.
- // Fix this here.
- if ($1==Type::FloatTy)
+ // Lexer has no type info, so builds all float and double FP constants
+ // as double. Fix this here. Long double is done right.
+ if (&$2->getSemantics()==&APFloat::IEEEdouble && $1==Type::FloatTy)
$2->convert(APFloat::IEEEsingle, APFloat::rmNearestTiesToEven);
$$ = ConstantFP::get($1, *$2);
delete $2;