The MASM Forum

General => The Campus => Topic started by: dusty on February 10, 2013, 12:06:13 PM

Title: float compare xmm
Post by: dusty on February 10, 2013, 12:06:13 PM
How can I compare two floats, xmm0 and xmm1 without using fpu and return answer i rax
int compf( double x, double y) "c++ calling function.  x64
x < y,  x > y ??
Title: Re: float compare xmm
Post by: qWord on February 10, 2013, 12:11:13 PM
use COMISS for REAL4 (=float) or COMISD for REAL8 (=double). These instruction sets the eFlags:
xor eax,eax ; clear rax
movss xmm0,value1
movss xmm1,value2
comiss xmm0,xmm1
ja @foo  ; jump if value1 > value2
jb @foo  ; jump if value1 < value2
je ...
jae ...

seta al ; set AL if value1 > value2
...
Title: Re: float compare xmm
Post by: dusty on February 10, 2013, 12:40:53 PM
qword;
thanks that did the trick
your'e to goodest  :dazzled: