llvm / llvm-project

The LLVM Project is a collection of modular and reusable compiler and toolchain technologies.
http://llvm.org
Other
29.41k stars 12.15k forks source link

[MC assembler] .float not supported #9106

Open DimitryAndric opened 14 years ago

DimitryAndric commented 14 years ago
Bugzilla Link 8734
Version trunk
OS FreeBSD
CC @pwo,@yuanfang-chen

Extended Description

It looks like integrated-as supports the .single directive, but not the synonym .float. This should be easy to implement. :)

http://sourceware.org/binutils/docs/as/Float.html says:

7.53 .float flonums

This directive assembles zero or more flonums, separated by commas. It has the same effect as .single. The exact kind of floating point numbers emitted depends on how as is configured. See [Machine Dependencies].

DimitryAndric commented 13 years ago

Actually, this an other obscure (?) feature of GNU as, to represent floating point constants, called "flonums". See:

http://sourceware.org/binutils/docs/as/Flonums.html

As far as I can see, this is a rather convoluted way of notation, the simplest way to parse them may just be to chop off any leading '0' char, followed by a more-or-less random letter; the GAS manual does not explicitly specify which characters are allowed for the arches that clang/llvm supports.

The rest is just a reasonably normal form of floating point constant.

pwo commented 13 years ago

This still has issues with .float as used in Mesa.

clang -c -I../../include -I../../src/mesa -I../../src/mesa/main -I/usr/local/include -O2 -pipe -fno-strict-aliasing -Wall -Wmissing-prototypes -std=c99 -ffast-math -fno-strict-aliasing -fPIC -DUSE_X86_64_ASM -DHAVE_POSIX_MEMALIGN -DUSE_XCB -DPTHREADS -DUSE_EXTERNAL_DXTN_LIB=1 -DIN_DRI_DRIVER -DHAVE_ALIAS -DGLX_INDIRECT_RENDERING -DGLX_DIRECT_RENDERING x86-64/xform4.S -o x86-64/xform4.o /tmp/cc-qEQXDZ.s:99:9: error: unexpected token in directive .float 0f+1.0 ^

llvmbot commented 13 years ago

fixed in 124485.

llvmbot commented 13 years ago

With a test :-)

llvmbot commented 13 years ago

Index: lib/MC/MCParser/AsmParser.cpp

--- lib/MC/MCParser/AsmParser.cpp (revision 124428) +++ lib/MC/MCParser/AsmParser.cpp (working copy) @@ -983,7 +984,7 @@ return ParseDirectiveValue(8); if (IDVal == ".8byte") return ParseDirectiveValue(8);

ok to commit this?