interplane.Get Omega
Read in your language

omega-mv

Omega: a language for verified programs, semantic identity and machine realization. Seed-born work and existing implementations have distinct provenance.

Brought by drakestapleton

branch main Branches Tags History

omega-mv / seed / ng / front / cases / fmm_mix.om

75 lines · 1852 bytes Raw Blame History
1note fmm_mix: fmin and fmax (IR min 24 and max 25; OMEGESE FMINNM/FMAXNM, IR.md s7.3) on f32 and f64:
2note ordered values, signed zeros in both orders, a quiet NaN with a number in both orders, a signaling NaN
3note with a number in both orders (the result is that NaN quieted), two quiet NaNs (the first). Each result's
4note bits are written little-endian (4 bytes per f32, 8 per f64), 168 bytes; expected in cases/groups6.expect.
5note NaN bits (decimal, Wolfram FromDigits): f32 quiet 0x7fc00000 2143289344, 0x7fc00001 2143289345,
6note signaling 0x7f800001 2139095041; f64 quiet 0x7ff8000000000000 9221120237041090560,
7note 0x7ff8000000000001 9221120237041090561, signaling 0x7ff0000000000001 9218868437227405313.
8global o uchar 256
9global n ulong 1
10fn pw v ulong k ulong to void
11p = get n 0
12for i ulong k
13put o add p i uchar and shr v mul i 8 255
14end
15put n 0 add p k
16end
17fn p32 x f32 to void
18pw ulong bitcast uint x 4
19end
20fn p64 x f64 to void
21pw bitcast ulong x 8
22end
23note main holds no float: each width's values live in its own function (16 registers per function)
24fn t32 to void
25a = 1.5f32
26b = 2.5f32
27z = 0.0f32
28nz = neg z
29q = bitcast f32 uint 2143289344
30q2 = bitcast f32 uint 2143289345
31s = bitcast f32 uint 2139095041
32p32 fmin a b
33p32 fmax a b
34p32 fmin nz z
35p32 fmin z nz
36p32 fmax nz z
37p32 fmax z nz
38p32 fmin q a
39p32 fmin a q
40p32 fmax q a
41p32 fmin s a
42p32 fmin a s
43p32 fmax s a
44p32 fmin q q2
45p32 fmax q2 q
46end
47fn t64 to void
48c = 1.5f64
49d = 2.5f64
50y = 0.0f64
51ny = neg y
52r = bitcast f64 ulong 9221120237041090560
53r2 = bitcast f64 ulong 9221120237041090561
54t = bitcast f64 ulong 9218868437227405313
55p64 fmin c d
56p64 fmax c d
57p64 fmin ny y
58p64 fmin y ny
59p64 fmax ny y
60p64 fmax y ny
61p64 fmin r c
62p64 fmin c r
63p64 fmax r c
64p64 fmin t c
65p64 fmin c t
66p64 fmax t c
67p64 fmin r r2
68p64 fmax r2 r
69end
70fn main to int
71t32
72t64
73k = write 1 o 0 get n 0
74ret 0
75end