Intel ARCHITECTURE IA-32 Reference Manual page 139

Architecture optimization
Table of Contents

Advertisement

Example 2-23 Algorithm to Avoid Changing the Rounding Mode (continued)
positive:
fstp
dword ptr[ecx] ; 17-18 result of subtraction
mov
ecx,[ecx]
add
esp,16
add
ecx,7fffffffh
sbb
eax,0
ret
integer_QnaN_or_zero:
test
edx,7fffffffh
jnz
arg_is_not_integer_QnaN
add esp,16
ret
Assembly/Compiler Coding Rule 32. (H impact, L generality) Minimize the
number of changes to the rounding mode. Do not use changes in the rounding
mode to implement the floor and ceiling functions if this involves a total of
more than two values of the set of rounding, precision and infinity bits.
Precision
If single precision is adequate, use it instead of double precision. This is
true because:
Single precision operations allow the use of longer SIMD vectors,
since more single precision data elements can fit in a register.
If the precision control (PC) field in the x87 FPU control word is set
to "Single Precision," the floating-point divider can complete a
single-precision computation much faster than either a
double-precision computation or an extended double-precision
computation. If the PC field is set to "Double Precision," this will
enable those x87 FPU operations on double-precision data to
complete faster than extended double-precision computation. These
characteristics affect computations including floating-point divide
and square root.
; dword of diff(single precision)
; if diff<0 then decrement integer
; dec eax (subtract CARRY flag)
General Optimization Guidelines
2
2-67

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the ARCHITECTURE IA-32 and is the answer not in the manual?

Table of Contents

Save PDF