-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcomiss.asm
57 lines (50 loc) · 941 Bytes
/
comiss.asm
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
global _start
section .data
align 16
controlword:
dw 0
dwordmxcsr:
dw 0
dword0:
dd 1000.0
dword1:
dd 5.0
dword2:
dd 3000.0
dwSNaN:
dd __SNaN__
dwQNaN:
dd __QNaN__
; Moves EFLAGS into specified register
%macro moveflags 1
pushf
and dword [esp], 0x45
pop eax
movd %1, eax
%endmacro
%include "header.inc"
movd xmm0, [dword0]
; Equal
comiss xmm0, [dword0]
moveflags mm0 ; [ZF] = 100000
; Less than
comiss xmm0, [dword1]
moveflags mm1 ; [CF] = 000001
; Greater than
comiss xmm0, [dword2]
moveflags mm2 ; [] = 000000
; Unordered: Quiet NaN
movd xmm1, [dwQNaN]
ucomiss xmm0, xmm1
moveflags mm3 ; [ZF][PF][CF] = 100101
; Check #I exception
stmxcsr [dwordmxcsr]
movd mm4, [dwordmxcsr]
; Unordered: Signaling NaN
movd xmm1,[dwSNaN]
ucomiss xmm0, xmm1
moveflags mm5 ; [ZF][PF][CF] = 100101
; Check #I exception
stmxcsr [dwordmxcsr]
movd mm6, [dwordmxcsr]
%include "footer.inc"