[llvm-commits] [llvm] r113996 - in /llvm/trunk: include/llvm/MC/MCInst.h lib/Target/ARM/ARMMCInstLower.cpp lib/Target/ARM/AsmPrinter/ARMInstPrinter.cpp

Stephen Canon scanon at apple.com
Wed Sep 15 13:52:13 PDT 2010


On Sep 15, 2010, at 1:05 PM, Dale Johannesen wrote:

> On Sep 15, 2010, at 11:47 AMPDT, Jim Grosbach wrote:
> 
>> Author: grosbach
>> Date: Wed Sep 15 13:47:08 2010
>> New Revision: 113996
>> 
>> URL: http://llvm.org/viewvc/llvm-project?rev=113996&view=rev
>> Log:
>> Add support for floating point immediates to MC instruction printing. ARM
>> VFP instructions use it for loading some constants, so implement that
>> handling.
>> 
>> Not thrilled with adding a member to MCOperand, but not sure there's much of
>> a better option that's not pretty fragile (like putting a double in the
>> union instead and just assuming that's good enough). Suggestions welcome...
> 
> This doesn't seem to handle NaNs and infinities.  Also, I wonder whether you're guaranteed to get enough precision to represent the value accurately with << (printf does not guarantee this).  Will the assembler take a hex format?  That would be better.

My reading of the C++ standard is that << does not guarantee that the value will be printed exactly.  You need 7 digits after the decimal point in order to print all expressible immediates exactly, but you only get 6 digits.  A test on the immediate value 0x1.1p-3 seems to confirm this.

- Steve



More information about the llvm-commits mailing list