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 / gpu / nvidia / om / codegen / regalloc_ir.om
| 1 | note SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception |
| 2 | note Pure scalar decisions shared by hosted and allocation-free IR shells. |
| 3 | fn ra_ir kind ulong a long b long to long |
| 4 | if eq kind 0 |
| 5 | if ge a b |
| 6 | ret -1 |
| 7 | end |
| 8 | ret a |
| 9 | end |
| 10 | if eq kind 1 |
| 11 | if lt a 0 |
| 12 | ret b |
| 13 | end |
| 14 | ret a |
| 15 | end |
| 16 | if eq kind 2 |
| 17 | if gt b a |
| 18 | ret b |
| 19 | end |
| 20 | ret a |
| 21 | end |
| 22 | if eq kind 3 |
| 23 | if and ge a 0 lt a b |
| 24 | ret 1 |
| 25 | end |
| 26 | ret 0 |
| 27 | end |
| 28 | if eq kind 4 |
| 29 | if or eq a 6 eq a 7 |
| 30 | ret 1 |
| 31 | end |
| 32 | ret 0 |
| 33 | end |
| 34 | if eq kind 5 |
| 35 | if lt a 1024 |
| 36 | ret 1 |
| 37 | end |
| 38 | ret 0 |
| 39 | end |
| 40 | if eq kind 6 |
| 41 | ret long mul div add uint a 9 8 8 |
| 42 | end |
| 43 | if eq kind 7 |
| 44 | if and eq rem uint a 8 0 ge uint a add uint b 2 |
| 45 | ret 1 |
| 46 | end |
| 47 | ret 0 |
| 48 | end |
| 49 | if eq kind 8 |
| 50 | if and gt a 128 le a 246 |
| 51 | ret 1 |
| 52 | end |
| 53 | ret 0 |
| 54 | end |
| 55 | ret -1 |
| 56 | end |