diff options
author | Matt Arsenault <Matthew.Arsenault@amd.com> | 2016-02-05 00:50:18 +0000 |
---|---|---|
committer | Matt Arsenault <Matthew.Arsenault@amd.com> | 2016-02-05 00:50:18 +0000 |
commit | 5923973fe2c2c80cd11e67b34ba1fae03f87a9b0 (patch) | |
tree | 6e25aa796b0c2d64261be83c1872bf19de3d3a42 /llvm/lib/CodeGen/MachineInstr.cpp | |
parent | 312b34fc3015b812017220d51a2013ce6044807c (diff) | |
download | bcm5719-llvm-5923973fe2c2c80cd11e67b34ba1fae03f87a9b0.tar.gz bcm5719-llvm-5923973fe2c2c80cd11e67b34ba1fae03f87a9b0.zip |
Fix printing of f16 machine operands
Only single and double FP immediates are correctly printed by
MachineInstr::print() during debug output. Half float type goes to
APFloat::convertToDouble() and hits assertion it is not a double
semantics. This diff prints half machine operands correctly.
This cannot currently be hit by any in-tree target.
Patch by Stanislav Mekhanoshin
llvm-svn: 259857
Diffstat (limited to 'llvm/lib/CodeGen/MachineInstr.cpp')
-rw-r--r-- | llvm/lib/CodeGen/MachineInstr.cpp | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/llvm/lib/CodeGen/MachineInstr.cpp b/llvm/lib/CodeGen/MachineInstr.cpp index e46a699e95b..1fee7989575 100644 --- a/llvm/lib/CodeGen/MachineInstr.cpp +++ b/llvm/lib/CodeGen/MachineInstr.cpp @@ -372,10 +372,16 @@ void MachineOperand::print(raw_ostream &OS, ModuleSlotTracker &MST, getCImm()->getValue().print(OS, false); break; case MachineOperand::MO_FPImmediate: - if (getFPImm()->getType()->isFloatTy()) + if (getFPImm()->getType()->isFloatTy()) { OS << getFPImm()->getValueAPF().convertToFloat(); - else + } else if (getFPImm()->getType()->isHalfTy()) { + APFloat APF = getFPImm()->getValueAPF(); + bool Unused; + APF.convert(APFloat::IEEEsingle, APFloat::rmNearestTiesToEven, &Unused); + OS << "half " << APF.convertToFloat(); + } else { OS << getFPImm()->getValueAPF().convertToDouble(); + } break; case MachineOperand::MO_MachineBasicBlock: OS << "<BB#" << getMBB()->getNumber() << ">"; |