mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2026-04-20 16:17:38 +00:00
The powers that be have decided that LLVM IR should now support 16-bit
"half precision" floating-point with a first-class type. This patch adds basic IR support (but not codegen support). git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@146786 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -2483,13 +2483,16 @@ bool LLParser::ConvertValIDToValue(Type *Ty, ValID &ID, Value *&V,
|
||||
!ConstantFP::isValueValidForType(Ty, ID.APFloatVal))
|
||||
return Error(ID.Loc, "floating point constant invalid for type");
|
||||
|
||||
// The 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 (&ID.APFloatVal.getSemantics() == &APFloat::IEEEdouble &&
|
||||
Ty->isFloatTy()) {
|
||||
// The lexer has no type info, so builds all half, float, and double FP
|
||||
// constants as double. Fix this here. Long double does not need this.
|
||||
if (&ID.APFloatVal.getSemantics() == &APFloat::IEEEdouble) {
|
||||
bool Ignored;
|
||||
ID.APFloatVal.convert(APFloat::IEEEsingle, APFloat::rmNearestTiesToEven,
|
||||
&Ignored);
|
||||
if (Ty->isHalfTy())
|
||||
ID.APFloatVal.convert(APFloat::IEEEhalf, APFloat::rmNearestTiesToEven,
|
||||
&Ignored);
|
||||
else if (Ty->isFloatTy())
|
||||
ID.APFloatVal.convert(APFloat::IEEEsingle, APFloat::rmNearestTiesToEven,
|
||||
&Ignored);
|
||||
}
|
||||
V = ConstantFP::get(Context, ID.APFloatVal);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user