I have a problem with this code below. It is GAS asm syntax on IA-32 architecture. It generates arithmetic exception, after fsqrt
instruction. SetDouble
is int
type of value 0x0200
and input
is a float number. I'm compiling this with -m32
flag using gcc. Can someone point where I made mistake.
pushl %ebp
movl %esp,%ebp
finit
fldcw SetDouble
fld input
fld input
fmulp
fld1
faddp
fsqrt
fld1
fxch
fsubp
fstp output
mov %ebp,%esp
pop %ebp