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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
|
# tests that NaN is handled properly by
# floating point comparisons
export function w $lt(d %x, d %y) {
@start
%r =w cltd %x, %y
ret %r
}
export function w $le(d %x, d %y) {
@start
%r =w cled %x, %y
ret %r
}
export function w $gt(d %x, d %y) {
@start
%r =w cgtd %x, %y
ret %r
}
export function w $ge(d %x, d %y) {
@start
%r =w cged %x, %y
ret %r
}
export function w $eq1(d %x, d %y) {
@start
%r =w ceqd %x, %y
ret %r
}
export function w $eq2(d %x, d %y) {
@start
%r =w ceqd %x, %y
jnz %r, @true, @false
@true
ret 1
@false
ret 0
}
export function w $eq3(d %x, d %y) {
@start
%r =w ceqd %x, %y
jnz %r, @true, @false
@true
ret %r
@false
ret 0
}
export function w $ne1(d %x, d %y) {
@start
%r =w cned %x, %y
ret %r
}
export function w $ne2(d %x, d %y) {
@start
%r =w cned %x, %y
jnz %r, @true, @false
@true
ret 1
@false
ret 0
}
export function w $ne3(d %x, d %y) {
@start
%r =w cned %x, %y
jnz %r, @true, @false
@true
ret %r
@false
ret 0
}
export function w $o(d %x, d %y) {
@start
%r =w cod %x, %y
ret %r
}
export function w $uo(d %x, d %y) {
@start
%r =w cuod %x, %y
ret %r
}
# >>> driver
# #include <math.h>
# extern int lt(double, double);
# extern int le(double, double);
# extern int gt(double, double);
# extern int ge(double, double);
# extern int eq1(double, double);
# extern int eq2(double, double);
# extern int eq3(double, double);
# extern int ne1(double, double);
# extern int ne2(double, double);
# extern int ne3(double, double);
# extern int o(double, double);
# extern int uo(double, double);
# int main(void) {
# /* LessThan Equal GreaterThan Unordered */
# return !lt(0, 1) + lt(0, 0) + lt(1, 0) + lt(NAN, NAN)
# + !le(0, 1) + !le(0, 0) + le(1, 0) + le(NAN, NAN)
# + gt(0, 1) + gt(0, 0) + !gt(1, 0) + gt(NAN, NAN)
# + ge(0, 1) + !ge(0, 0) + !ge(1, 0) + ge(NAN, NAN)
# + eq1(0, 1) + !eq1(0, 0) + eq1(1, 0) + eq1(NAN, NAN)
# + eq2(0, 1) + !eq2(0, 0) + eq2(1, 0) + eq2(NAN, NAN)
# + eq3(0, 1) + !eq3(0, 0) + eq3(1, 0) + eq3(NAN, NAN)
# + !ne1(0, 1) + ne1(0, 0) + !ne1(1, 0) + !ne1(NAN, NAN)
# + !ne2(0, 1) + ne2(0, 0) + !ne2(1, 0) + !ne2(NAN, NAN)
# + !ne3(0, 1) + ne3(0, 0) + !ne3(1, 0) + !ne3(NAN, NAN)
# + !o(0, 1) + !o(0, 0) + !o(1, 0) + o(NAN, NAN)
# + uo(0, 1) + uo(0, 0) + uo(1, 0) + !uo(NAN, NAN)
# ;
# }
# <<<
|