[LLVMdev] Floating point number format in .ll files changed?

Jan Rehders cmdkeen at gmx.de
Tue Oct 2 08:15:12 PDT 2007


Hi,

after upgrading to 2.1 I noticed that the format for floating point  
numbers in .ll files apparently changed. I now get errors like

"llvm-as: var.ll:48,0: Floating point constant invalid for type"

for such code:

"@gmFloat = constant float 0.3".

I checked with llvm-gcc and it now generates code for the hexadecimal  
floating point representation. The documentation at http://llvm.org/ 
docs/LangRef.html#simpleconstants still says

"Floating point constants use standard decimal notation (e.g.  
123.421), exponential notation (e.g. 1.23421e+2), or a more precise  
hexadecimal notation (see below)".

I tried some numbers and llvm-as accepted "1.000000e+00", "1.0", "1."  
while it rejected "0.3", ".3", "0.1", "0.300000e+00" and "0.3000000e 
+00". It accepts more numbers for variables of type double (like  
0.1). I think the pattern I can spot is to use hexadecimal notation  
if the decimal number cannot be represented as a float. Does LLVM  
provide any help converting floats to hexadecimal representation?

Which formats are accepted for floating point numbers in 2.1?

greetings,
Jan




More information about the llvm-dev mailing list