# An example of using floating point numbers (传送浮点数)
#
# FLD 用于把浮点数传送和传出FPU寄存器。
#
# fld source
#
# source 是32、64、80bit 内存位置
#
.section .data
value1:
.float 12.34
value2:
.double 2353.631
.section .bss
.lcomm data, 8 # 指向内存中的空缓冲区,被用于传输双精度浮点值
.section .text
.globl main
main:
nop
flds value1 # 加载单精度
fldl value2 # 加载双精度
fstl data # 获取FPU寄存器堆栈中顶部的值,并且把这个值放到内存位置中。 (fsts[单]|fstl[双])
movl $1, %eax
movl $0, %ebx
int $0x80
# gcc -g -o 07-fld 07-fld.s -m32