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