diff options
| author | Dale Johannesen <dalej@apple.com> | 2007-09-11 18:32:33 +0000 |
|---|---|---|
| committer | Dale Johannesen <dalej@apple.com> | 2007-09-11 18:32:33 +0000 |
| commit | 245dceb06d5d4ef8a4edace1cfddf54cf0122a64 (patch) | |
| tree | 5eecd813137e3673308a5f0e3ba38adc6f6dede4 /llvm/lib/AsmParser/llvmAsmParser.y | |
| parent | 32ef96186f13d5fa1ca9aad369f1198fbba6a56d (diff) | |
| download | bcm5719-llvm-245dceb06d5d4ef8a4edace1cfddf54cf0122a64.tar.gz bcm5719-llvm-245dceb06d5d4ef8a4edace1cfddf54cf0122a64.zip | |
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).
llvm-svn: 41858
Diffstat (limited to 'llvm/lib/AsmParser/llvmAsmParser.y')
| -rw-r--r-- | llvm/lib/AsmParser/llvmAsmParser.y | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/llvm/lib/AsmParser/llvmAsmParser.y b/llvm/lib/AsmParser/llvmAsmParser.y index 6364b29bcd7..c0374daf3f1 100644 --- a/llvm/lib/AsmParser/llvmAsmParser.y +++ b/llvm/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; |

