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 / equiv / wide.unit.om
| 1 | note irequiv fixture (issue 826): a 32-bit domain, beyond the exhaustive limit. |
| 2 | note pop32 and pop32s (SWAR) can only be compared by sampling, which is not a proof; |
| 3 | note pop32t is a mutant that drops the top bit. spin never returns within the |
| 4 | note interpreter's fuel (16777216 instructions), so its result is INCONCLUSIVE. |
| 5 | note spin runs 1000000 x 20 = 20000000 iterations as two loops: IR mode refuses a |
| 6 | note for count above 1000000 (error 8), the C oracle's range (#857). |
| 7 | fn pop32 x uint to uint |
| 8 | c = uint 0 |
| 9 | for i uint 32 |
| 10 | c = add c and x 1 |
| 11 | x = shr x 1 |
| 12 | end |
| 13 | ret c |
| 14 | end |
| 15 | fn pop32s x uint to uint |
| 16 | x = sub x and shr x 1 1431655765 |
| 17 | x = add and x 858993459 and shr x 2 858993459 |
| 18 | x = and add x shr x 4 252645135 |
| 19 | ret shr mul x 16843009 24 |
| 20 | end |
| 21 | fn pop32t x uint to uint |
| 22 | x = and x 2147483647 |
| 23 | x = sub x and shr x 1 1431655765 |
| 24 | x = add and x 858993459 and shr x 2 858993459 |
| 25 | x = and add x shr x 4 252645135 |
| 26 | ret shr mul x 16843009 24 |
| 27 | end |
| 28 | fn spin x uchar to uchar |
| 29 | y = x |
| 30 | for i uint 1000000 |
| 31 | for j uint 20 |
| 32 | y = add y 1 |
| 33 | end |
| 34 | end |
| 35 | ret y |
| 36 | end |