-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathAVX.asm
More file actions
68 lines (51 loc) · 1.1 KB
/
AVX.asm
File metadata and controls
68 lines (51 loc) · 1.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
extern printf
extern scanf
section .data
v_peso dd 80.2, 50.5, 64.8, 40.0, 66.7, 45.3, 100.6, 30.2
v_altura dd 1.7 , 1.4 , 1.65, 0.7, 1.55 , 1.2 , 1.9 , 0.9
msg db '%lf', 0ah, 0
section .bss
v_result RESD 8
formated_result resq 1
teste resd 1
section .text
global main
main:
mov ebp, esp; for correct debugging
push v_peso
push v_altura
push v_result
call calculaIMCAVX
add esp, 12
mov eax, 0
mov ecx, 8
l1:
pushad
fld dword [v_result+4*eax] ;load float
fstp qword [formated_result] ;store double (8087 does the conversion internally)
push DWORD[formated_result+4]
push DWORD[formated_result]
push msg
call printf
add esp, 12
popad
inc eax
loop l1
fim:
xor eax, eax
ret
calculaIMCAVX:
push ebp
mov ebp,esp
mov edi,[ebp+16]
mov esi,[ebp+12]
mov edx,[ebp+8]
vmovups ymm1,[esi]
vmulps ymm1,ymm1
vmovups ymm2,[edi]
vdivps ymm3,ymm2,ymm1
vmovups [edx],ymm3
mov esp,ebp
pop ebp
ret
; Escreva aqui sua função