diff options
author | Bill Wendling <isanbard@gmail.com> | 2011-01-26 20:57:43 +0000 |
---|---|---|
committer | Bill Wendling <isanbard@gmail.com> | 2011-01-26 20:57:43 +0000 |
commit | 8cb415e4c0032300a1b728c942f8b31acec0a9f5 (patch) | |
tree | 9d92c1edc129e255097cbf7678c1cd02dd1b8045 /lib/Target/ARM | |
parent | a49c7dfb360154070c08b8eb94ad31711d1babae (diff) | |
download | external_llvm-8cb415e4c0032300a1b728c942f8b31acec0a9f5.zip external_llvm-8cb415e4c0032300a1b728c942f8b31acec0a9f5.tar.gz external_llvm-8cb415e4c0032300a1b728c942f8b31acec0a9f5.tar.bz2 |
Add support for printing out floating point values from the ARM assembly
parser. The parser will always give us a binary representation of the floating
point number.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@124318 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Target/ARM')
-rw-r--r-- | lib/Target/ARM/InstPrinter/ARMInstPrinter.cpp | 29 |
1 files changed, 27 insertions, 2 deletions
diff --git a/lib/Target/ARM/InstPrinter/ARMInstPrinter.cpp b/lib/Target/ARM/InstPrinter/ARMInstPrinter.cpp index 820c2e6..941c69d 100644 --- a/lib/Target/ARM/InstPrinter/ARMInstPrinter.cpp +++ b/lib/Target/ARM/InstPrinter/ARMInstPrinter.cpp @@ -673,12 +673,37 @@ void ARMInstPrinter::printT2AddrModeSoRegOperand(const MCInst *MI, void ARMInstPrinter::printVFPf32ImmOperand(const MCInst *MI, unsigned OpNum, raw_ostream &O) { - O << '#' << (float)MI->getOperand(OpNum).getFPImm(); + const MCOperand &MO = MI->getOperand(OpNum); + O << '#'; + if (MO.isFPImm()) { + O << (float)MO.getFPImm(); + } else { + union { + uint32_t I; + float F; + } FPUnion; + + FPUnion.I = MO.getImm(); + O << FPUnion.F; + } } void ARMInstPrinter::printVFPf64ImmOperand(const MCInst *MI, unsigned OpNum, raw_ostream &O) { - O << '#' << MI->getOperand(OpNum).getFPImm(); + const MCOperand &MO = MI->getOperand(OpNum); + O << '#'; + if (MO.isFPImm()) { + O << MO.getFPImm(); + } else { + // We expect the binary encoding of a floating point number here. + union { + uint64_t I; + double D; + } FPUnion; + + FPUnion.I = MO.getImm(); + O << FPUnion.D; + } } void ARMInstPrinter::printNEONModImmOperand(const MCInst *MI, unsigned OpNum, |