diff options
author | Dan Gohman <gohman@apple.com> | 2011-12-17 00:04:22 +0000 |
---|---|---|
committer | Dan Gohman <gohman@apple.com> | 2011-12-17 00:04:22 +0000 |
commit | 518cda42b9dc8b8acb382ae3f49141985f706459 (patch) | |
tree | 58a5083e95eafbb678def679f707ecf7d4415ccf /llvm/lib/Bitcode/Writer/BitcodeWriter.cpp | |
parent | 27886c6c1efd95ddda693f2f77a301956505b11d (diff) | |
download | bcm5719-llvm-518cda42b9dc8b8acb382ae3f49141985f706459.tar.gz bcm5719-llvm-518cda42b9dc8b8acb382ae3f49141985f706459.zip |
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
Diffstat (limited to 'llvm/lib/Bitcode/Writer/BitcodeWriter.cpp')
-rw-r--r-- | llvm/lib/Bitcode/Writer/BitcodeWriter.cpp | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/llvm/lib/Bitcode/Writer/BitcodeWriter.cpp b/llvm/lib/Bitcode/Writer/BitcodeWriter.cpp index d98016367d8..f8907862598 100644 --- a/llvm/lib/Bitcode/Writer/BitcodeWriter.cpp +++ b/llvm/lib/Bitcode/Writer/BitcodeWriter.cpp @@ -266,6 +266,7 @@ static void WriteTypeTable(const ValueEnumerator &VE, BitstreamWriter &Stream) { switch (T->getTypeID()) { default: llvm_unreachable("Unknown type!"); case Type::VoidTyID: Code = bitc::TYPE_CODE_VOID; break; + case Type::HalfTyID: Code = bitc::TYPE_CODE_HALF; break; case Type::FloatTyID: Code = bitc::TYPE_CODE_FLOAT; break; case Type::DoubleTyID: Code = bitc::TYPE_CODE_DOUBLE; break; case Type::X86_FP80TyID: Code = bitc::TYPE_CODE_X86_FP80; break; @@ -826,7 +827,7 @@ static void WriteConstants(unsigned FirstVal, unsigned LastVal, } else if (const ConstantFP *CFP = dyn_cast<ConstantFP>(C)) { Code = bitc::CST_CODE_FLOAT; Type *Ty = CFP->getType(); - if (Ty->isFloatTy() || Ty->isDoubleTy()) { + if (Ty->isHalfTy() || Ty->isFloatTy() || Ty->isDoubleTy()) { Record.push_back(CFP->getValueAPF().bitcastToAPInt().getZExtValue()); } else if (Ty->isX86_FP80Ty()) { // api needed to prevent premature destruction |