Hi.
There is a bug in AS, where AS translates fdivp and fsubp incorrectly, by
translating fdivp (DE F9) to fdivrp (DE F1), and fsubp (DE E9) to fsubrp
(DE E1).
Correct translation is found at
http://download.intel.com/design/processor/manuals/253666.pdf
Pages:
fdivp: 3-373
fdivrp: 3-377
fsubp: 3-455
fsubrp: 3-459
System and AS-information:
$ uname -a
Linux Onyx 2.6.32-22-generic #36-Ubuntu SMP Thu Jun 3 22:02:19 UTC 2010
i686 GNU/Linux
$ as -v
GNU assembler version 2.20.1 (i486-linux-gnu) using BFD version (GNU
Binutils for Ubuntu) 2.20.1-system.20100303
An assembly program that demonstrates the bug is the following:
.globl fdiv
fdiv:
flds 4(%esp)
flds 8(%esp)
fdivp
ret
.globl fsub
fsub:
flds 4(%esp)
flds 8(%esp)
fsubp
ret
The generated code is:
$ as -a --32 prog.s
GAS LISTING prog.s page 1
1 .globl fdiv
2 fdiv:
3 0000 D9442404 flds 4(%esp)
4 0004 D9442408 flds 8(%esp)
5 0008 DEF1 fdivp
6 000a C3 ret
7
8 .globl fsub
9 fsub:
10 000b D9442404 flds 4(%esp)
11 000f D9442408 flds 8(%esp)
12 0013 DEE1 fsubp
13 0015 C3 ret
14
15
GAS LISTING prog.s page 2
DEFINED SYMBOLS
prog.s:2 .text:0000000000000000 fdiv
prog.s:9 .text:000000000000000b fsub
NO UNDEFINED SYMBOLS
Cheers,
Marius Tennøe
|