CHAPTER 27. WORKING WITH FLOATING POINT NUMBERS USING SIMD CHAPTER 27. WORKING WITH FLOATING POINT NUMBERS USING SIMD
27.3.2 x86
Let’s compile this example in MSVC 2012 with optimization turned on:
Listing 27.10: Optimizing MSVC 2012 x86
_a$ = 8 ; size = 8
_b$ = 16 ; size = 8
_d_max PROC
movsd xmm0, QWORD PTR _a$[esp-4]
comisd xmm0, QWORD PTR _b$[esp-4]
jbe SHORT $LN1@d_max
fld QWORD PTR _a$[esp-4]
ret 0
$LN1@d_max:
fld QWORD PTR _b$[esp-4]
ret 0
_d_max ENDP
Almost the same, but the values ofaandbare taken from the stack and the function result is left inST(0).
If we load this example in OllyDbg, we can see how theCOMISDinstruction compares values and sets/clears theCFandPF
flags:
Figure 27.6:OllyDbg:COMISDchangedCFandPFflags
27.4 Calculating machine epsilon: x64 and SIMD
Let’s revisit the “calculating machine epsilon” example fordoublelisting.22.2.2.
Now we compile it for x64:
Listing 27.11: Optimizing MSVC 2012 x64