Appendix E SSE and SSE2 Optimizations 365
Software Optimization Guide for AMD64 Processors
25112 Rev. 3.06 September 2005
INT GPR FPS xorps xmm1, xmm1
cvtsi2ss xmm1, reg32/64
XORPS is used to ensure that the
high half of XMM1 is in FPS
format. This is also better in case a
MOVAPS instruction is used later.
INT GPR FPD cvtsi2sd xmm1, reg32/64
Table 23. Converting Vector Values
Source
format
Destination format Preferred instructions Notes
FPS INT XMM cvtps2dq xmm1, xmm2
FPS FPD cvtps2pd xmm1, xmm2
FPD INT XMM cvtpd2dq xmm1, xmm2
FPD FPS cvtpd2ps xmm1, xmm2
INT XMM FPS cvtdq2ps xmm1, xmm2
INT XMM FPD cvtdq2pd xmm1, xmm2
Table 24. Converting Directly from Memory
Source
format
Destination format Preferred instructions Notes
FPD FPS xorps xmm1, xmm1
cvtsd2ss xmm1, mem64
XORPS ensures that the high half
of XMM1 is in FPS format in case
a MOVAPS instruction is used
later.
INT GPR FPS xorps xmm1, xmm1
cvtsi2ss xmm1, mem32/64
XORPS is used to ensure that the
high half of XMM1 is in FPS
format. This is also better in case a
MOVAPS instruction is used later.
Table 22. Converting Scalar Values (Continued)
Source
format
Destination format Preferred instructions Notes