mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-12-06 19:51:51 +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). llvm-svn: 146786
This commit is contained in:
1 parent
27886c6c1e
commit
518cda42b9
18 files changed
+123
-56
No files matched your search
@@ -565,6 +565,9 @@ bool BitcodeReader::ParseTypeTableBody() {
|
||||
case bitc::TYPE_CODE_VOID: // VOID
|
||||
ResultTy = Type::getVoidTy(Context);
|
||||
break;
|
||||
case bitc::TYPE_CODE_HALF: // HALF
|
||||
ResultTy = Type::getHalfTy(Context);
|
||||
break;
|
||||
case bitc::TYPE_CODE_FLOAT: // FLOAT
|
||||
ResultTy = Type::getFloatTy(Context);
|
||||
break;
|
||||
@@ -1032,7 +1035,9 @@ bool BitcodeReader::ParseConstants() {
|
||||
case bitc::CST_CODE_FLOAT: { // FLOAT: [fpval]
|
||||
if (Record.empty())
|
||||
return Error("Invalid FLOAT record");
|
||||
if (CurTy->isFloatTy())
|
||||
if (CurTy->isHalfTy())
|
||||
V = ConstantFP::get(Context, APFloat(APInt(16, (uint16_t)Record[0])));
|
||||
else if (CurTy->isFloatTy())
|
||||
V = ConstantFP::get(Context, APFloat(APInt(32, (uint32_t)Record[0])));
|
||||
else if (CurTy->isDoubleTy())
|
||||
V = ConstantFP::get(Context, APFloat(APInt(64, Record[0])));
|
||||
|
||||
Reference in new issue
Block a user