指令 | 描述 |
FADD | 浮点加法 |
FDIV | 浮点除法 |
FDIVR | 反向浮点除法 |
FMUL | 浮点乘法 |
FSUB | 反向减法 |
FSUBR | 反向浮点减法 |
.section .data
value1:
.float 43.65
value2:
.int 22
value3:
.float 76.34
value4:
.float 3.1
value5:
.float 12.43
value6:
.int 6
value7:
.float 140.2
value8:
.float 94.21
output:
.asciz "The result is %f\n"
.section .text
.global _start
_start:
nop
finit
flds value1
fidiv value2
flds value3
flds value4
fmul %st(1), %st(0)
fadd %st(2), %st(0)
flds value5
fimul value6
flds value7
flds value8
fdivrp
fsubr %st(1), %st(0)
fdivr %st(2), %st(0)
subl $8, %esp
fstpl (%esp)
pushl $output
call printf
add $12, %esp
pushl $0
call exit
$ as -gstabs -o fpmath.o fpmath.s
$ ld -dynamic-linker /lib/ld-linux.so.2 -lc -o fpmath fpmath.o
$ ./fpmath
The result is 73.091837
欢迎光临 曲径通幽论坛 (http://www.groad.net/bbs/) | Powered by Discuz! X3.2 |