And for allgned/unaligned memory, there is a big surprise, look that code:
vmovaps xmm6, xmm1 ;195.28
$LN1464:
vmovups XMMWORD PTR [1152+rsp], xmm7 ;195.28
it mean intel compiler transfer aligned memory to an register, but transfer unaligned memory to an variable memory.
In summary we can't do vmovaps XMMWORD PTR [1152+rsp], xmm7 :/
but i don't understand, aligned value in memory is for vector calculation yes ?
So why it's work when i do unaligned memory transfer and vector calculation on them:
;====================================================================================================
;FONCTIONS FONCTIONS FONCTIONS FONCTIONS FONCTIONS
;====================================================================================================
; make_rotations:
;=============
; yaw
;=============
Yaw: ; y
; On applique la rotation au point |[esi + 0] = x
; |[esi + 4] = y
; |[esi + 8] = z
; On calcule x = x.cos(phi.y) * cos(phi.z) - y.cos(phi.y) * sin(phi.z) - z.sin(phi.y)
;
; On calcule A = x.cos(phi.y), B = y.cos(phi.y) et C = z.sin(phi.y)
movups xmm0, [_xmm2 + 4]
movups xmm1, [coordonee]
mulps xmm0, xmm1
; On calcule D = A * cos(phi.z), E = B * sin(phi.z) et C = C * 1
movups xmm1, [_xmm1 + 8]
mulps xmm0, xmm1
; On calcule F = D - E, C = C - 0
hsubps xmm0, xmm0
; On calcule xmm0 = F - C
hsubps xmm0, xmm0
; On modifie x selon selon le rapport entre x et y pour que x soit proportionnelle à y
movd xmm1, [rapport]
divps xmm0, xmm1
; On save la new coordonée
movd [_x], xmm0
;=============
; / yaw
;=============
;=============
; pitch
;=============
Pitch: ; x
; On applique la rotation au point |[esi + 0] = x
; |[esi + 4] = y
; |[esi + 8] = z
; On calcule y = x.(cos(phi.x) * sin(phi.z) - sin(phi.x) * cos(phi.z) * sin(phi.y)) +
; y.(sin(phi.x) * sin(phi.z) * sin(phi.y) + cos(phi.x) * cos(phi.z)) -
; z.(sin(phi.x) * cos(phi.y))
;
; On calcule A = cos(phi.x) * sin(phi.z), B = sin(phi.x) * cos(phi.z), E = cos(phi.x) * cos(phi.z) et F = sin(phi.x) * sin(phi.z)
movddup xmm0, [_xmm0 + 8]
movups xmm1, [_xmm1]
mulps xmm0, xmm1
; on sauve xmm0 dans xmm7 pour le copier dans xmm0 de Roll car l'equation de y ressemblent a l'equation de z mis a part que la valeur sin(phi.y) est
; multiplié par d'autres equations
; On calcule C' = A' * sin(phi.y) et G' = E' * sin(phi.y)
movddup xmm7, [_xmm2 + 12]
mulps xmm7, xmm0
; On calcule C = B * sin(phi.y) et G = F * sin(phi.y)
movddup xmm2, [_xmm2 + 16]
mulps xmm0, xmm2
; Copie le contenu du haut (64..127) d'un paquet de valeurs réel de simple précision (4*32 bits) dans sa partie basse (0..31).
; En somme on separe les deux partie x et y: xmm0 = A) cos(phi.x) * sin(phi.z) xmm0 = cos(phi.x) * sin(phi.z)
; C) sin(phi.x) * cos(phi.z) * sin(phi.y) => sin(phi.x) * sin(phi.y) * cos(phi.z)
; E) cos(phi.x) * cos(phi.z) xmm1 = cos(phi.x) * cos(phi.z)
; G) sin(phi.x) * sin(phi.z) * sin(phi.y) sin(phi.x) * sin(phi.y) * sin(phi.z)
movhlps xmm1, xmm0
; On calcule D = A - C
hsubps xmm0, xmm0
; On calcule H = E + G
haddps xmm1, xmm1
; On calcule sin(phi.x) * cos(phi.y) et cos(phi.x) * cos(phi.y)
;
; On calcule I.roll = cos(phi.x) * cos(phi.y) et I.Pitch = sin(phi.x) * cos(phi.y)
movlps xmm3, [_xmm0 + 8]
movlps xmm2, [_xmm2 + 4]
mulps xmm2, xmm3
movshdup xmm3, xmm2
; On calcule x.D + y.H - z.I
;
; On calcule J = x.D, K = y.H et L = z.I
movups xmm5, [coordonee]
movsldup xmm4, xmm1 ; y.H
movss xmm4, xmm0 ; x.D
movlhps xmm4, xmm3 ; z.I.Pitch
mulps xmm4, xmm5
; On calcule M = J + K
haddps xmm4, xmm4
; On calcule N = M - L
hsubps xmm4, xmm4
; On save la new coordonée
movd [_y], xmm4
;=============
; / pitch
;=============
;=============
; roll
;=============
Roll: ; z
; On applique la rotation au point |[esi + 0] = x
; |[esi + 4] = y
; |[esi + 8] = z
; On calcule z' = x.(cos(phi.x) * cos(phi.z) * sin(phi.y) + sin(phi.x) * sin(phi.z)) +
; y.(sin(phi.x) * cos(phi.z) - cos(phi.x) * sin(phi.z) * sin(phi.y)) +
; z.(cos(phi.x) * cos(phi.y))
;
; Copie le contenu du haut (64..127) d'un paquet de valeurs réel de simple précision (4*32 bits) dans sa partie basse (0..31).
; En somme on separe les deux partie x et y: xmm7 = C') cos(phi.x) * sin(phi.z) * sin(phi.y) xmm7 = C') cos(phi.x) * sin(phi.z) * sin(phi.y))
; B') sin(phi.x) * cos(phi.z) => B') sin(phi.x) * cos(phi.z)
; G') cos(phi.x) * cos(phi.z) * sin(phi.y) xmm1 = G') cos(phi.x) * cos(phi.z) * sin(phi.y)
; F') sin(phi.x) * sin(phi.z) F') sin(phi.x) * sin(phi.z
movhlps xmm1, xmm7
; On calcule D' = -B' + C'
movd xmm6, [conv_signe]
orps xmm7, xmm6
haddps xmm7, xmm7
; On calcule H' = G' + F'
haddps xmm1, xmm1
; On calcule x.D' + y.H' + z.I'
;
; On calcule J = x.D', K = y.H' et L = z.I'
movups xmm3, [coordonee]
movsldup xmm4, xmm7 ; y.D'
movss xmm4, xmm1 ; x.H'
movlhps xmm4, xmm2 ; z.I'
mulps xmm4, xmm3
; On calcule M' = J' + K'
haddps xmm4, xmm4
; On calcule N' = M' + L'
haddps xmm4, xmm4
;=============
; / roll
;=============
; ret
;====================================================================================================
;END_FONCTIONS END_FONCTIONS END_FONCTIONS END_FONCTIONS END_FONCTIONS
;====================================================================================================