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 / cg_reconv.om
| 1 | note SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception |
| 2 | note Source-derived ordered steps from omega_bw_reconv.h. C owns structs and dereferences. |
| 3 | note Failed joins retain the already-decremented depth and any already-patched immediate. |
| 4 | fn rc_g w view ulong 8 i ulong to long |
| 5 | u = get w i |
| 6 | v = long u |
| 7 | if ge u 2147483648 |
| 8 | v = sub v 4294967296 |
| 9 | end |
| 10 | ret v |
| 11 | end |
| 12 | fn rc_u v long to ulong |
| 13 | if lt v 0 |
| 14 | ret ulong add v 4294967296 |
| 15 | end |
| 16 | ret ulong v |
| 17 | end |
| 18 | fn cg_reconv act ulong w edit ulong 8 to long |
| 19 | if eq act 0 |
| 20 | if lt rc_g w 0 16 |
| 21 | ret rc_g w 0 |
| 22 | end |
| 23 | ret -1 |
| 24 | end |
| 25 | if eq act 1 |
| 26 | if or ge rc_g w 0 16 lt rc_g w 3 0 |
| 27 | ret -1 |
| 28 | end |
| 29 | d = rc_g w 0 |
| 30 | put w 0 rc_u add d 1 |
| 31 | put w 2 rc_u add rc_g w 2 1 |
| 32 | if gt rc_g w 0 rc_g w 1 |
| 33 | put w 1 get w 0 |
| 34 | end |
| 35 | ret d |
| 36 | end |
| 37 | if eq act 2 |
| 38 | if or le rc_g w 0 0 lt rc_g w 1 0 |
| 39 | ret -1 |
| 40 | end |
| 41 | ret sub rc_g w 0 1 |
| 42 | end |
| 43 | if eq act 3 |
| 44 | if ge rc_g w 0 8 |
| 45 | ret -1 |
| 46 | end |
| 47 | n = rc_g w 0 |
| 48 | put w 0 rc_u add n 1 |
| 49 | ret n |
| 50 | end |
| 51 | if eq act 4 |
| 52 | if or le rc_g w 0 0 eq rc_g w 3 0 |
| 53 | ret -1 |
| 54 | end |
| 55 | if lt rc_g w 1 0 |
| 56 | ret -1 |
| 57 | end |
| 58 | if ge ulong rc_g w 1 get w 2 |
| 59 | ret -1 |
| 60 | end |
| 61 | put w 0 rc_u sub rc_g w 0 1 |
| 62 | ret rc_g w 0 |
| 63 | end |
| 64 | if eq act 5 |
| 65 | if or lt rc_g w 0 0 ge rc_g w 0 rc_g w 1 |
| 66 | ret -1 |
| 67 | end |
| 68 | if or ne rc_g w 2 54 ne rc_g w 3 55 |
| 69 | ret -1 |
| 70 | end |
| 71 | if or ne rc_g w 4 rc_g w 6 ne rc_g w 5 rc_g w 6 |
| 72 | ret -1 |
| 73 | end |
| 74 | ret sub add rc_g w 1 1 rc_g w 0 |
| 75 | end |
| 76 | if eq act 6 |
| 77 | if or le rc_g w 0 rc_g w 1 ge rc_g w 0 rc_g w 2 |
| 78 | ret -1 |
| 79 | end |
| 80 | if ne rc_g w 3 46 |
| 81 | ret -1 |
| 82 | end |
| 83 | ret sub rc_g w 2 rc_g w 0 |
| 84 | end |
| 85 | ret -1 |
| 86 | end |