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_pfhost_mc.om
| 1 | note SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception |
| 2 | note Combine config cf[0..7]: h,top-k,unused,mutant,nquads,used. |
| 3 | fn ph_mc_meta cf view ulong 64 meta edit ulong 512 to void |
| 4 | nv = add add 9 mul 2 get cf 4 mul 2 get cf 1 |
| 5 | put meta 1 nv |
| 6 | put meta 2 1 |
| 7 | put meta 320 2 |
| 8 | for v ulong nv |
| 9 | sz = ulong 1 |
| 10 | if lt v 4 |
| 11 | sz = ulong 2 |
| 12 | end |
| 13 | if ge v 8 |
| 14 | sz = ulong 4 |
| 15 | if ge v add 9 mul 2 get cf 4 |
| 16 | if eq rem sub v add 9 mul 2 get cf 4 2 1 |
| 17 | sz = ulong 2 |
| 18 | end |
| 19 | end |
| 20 | end |
| 21 | put meta add 64 v sz |
| 22 | end |
| 23 | end |
| 24 | fn ph_mc_head ins edit ulong 8192 st edit ulong 16 cf view ulong 64 to void |
| 25 | ph_imm ins st 7 0 856 4 |
| 26 | ph_imm ins st 5 0 896 2 |
| 27 | ph_imm ins st 5 1 904 2 |
| 28 | ph_imm ins st 5 2 912 2 |
| 29 | ph_imm ins st 5 3 920 2 |
| 30 | ph_imm ins st 3 4 33 2 |
| 31 | ph_imm ins st 3 5 37 2 |
| 32 | ph_wide ins st 1 5 mul get cf 1 4 1 |
| 33 | ph_wide ins st 2 5 mul get cf 1 4 2 |
| 34 | for q ulong get cf 4 |
| 35 | kind = ulong 3 |
| 36 | if eq q 0 |
| 37 | kind = ulong 2 |
| 38 | end |
| 39 | ph_load ins st add 9 mul 2 q 1 mul 16 q kind |
| 40 | end |
| 41 | for q ulong get cf 4 |
| 42 | ph_load ins st add 10 mul 2 q 2 mul 16 q 3 |
| 43 | end |
| 44 | end |
| 45 | fn ph_mc_loads ins edit ulong 8192 st edit ulong 16 cf view ulong 64 to void |
| 46 | for s ulong get cf 1 |
| 47 | ph_base st 8 6 add 9 mul 2 div s 4 PHNONE |
| 48 | put st 12 4 |
| 49 | put st 14 div get cf 0 4 |
| 50 | put st 15 shl rem s 4 24 |
| 51 | ph_emit ins st 0 |
| 52 | pa = add add 10 mul 2 get cf 4 mul 2 s |
| 53 | ph_wide ins st pa 6 16 0 |
| 54 | end |
| 55 | for s ulong get cf 1 |
| 56 | v = add add 9 mul 2 get cf 4 mul 2 s |
| 57 | kind = ulong 3 |
| 58 | if eq s 0 |
| 59 | kind = ulong 2 |
| 60 | end |
| 61 | ph_load ins st v add v 1 0 kind |
| 62 | end |
| 63 | for q ulong 4 |
| 64 | ph_base st 1 8 PHNONE PHNONE |
| 65 | put st 15 shl q 16 |
| 66 | ph_emit ins st 0 |
| 67 | end |
| 68 | end |
| 69 | fn ph_mc_math ins edit ulong 8192 st edit ulong 16 cf edit ulong 64 to void |
| 70 | for s ulong get cf 5 |
| 71 | v = add 9 mul 2 get cf 4 |
| 72 | v = add v mul 2 s |
| 73 | for q ulong 4 |
| 74 | put cf 8 8 |
| 75 | put cf 9 q |
| 76 | put cf 10 7 |
| 77 | put cf 11 add 10 mul 2 div s 4 |
| 78 | put cf 12 v |
| 79 | put cf 13 rem s 4 |
| 80 | put cf 14 q |
| 81 | ph_muladd ins st cf |
| 82 | end |
| 83 | end |
| 84 | end |
| 85 | fn ph_mc_body ins edit ulong 8192 st edit ulong 16 cf edit ulong 64 meta edit ulong 512 to void |
| 86 | ph_mc_head ins st cf |
| 87 | ph_mc_loads ins st cf |
| 88 | ph_mc_math ins st cf |
| 89 | ph_imad ins st 6 5 div get cf 0 4 4 |
| 90 | ph_wide ins st 3 6 16 3 |
| 91 | for q ulong 4 |
| 92 | ph_base st 12 PHNONE 3 8 |
| 93 | put st 15 shl q 32 |
| 94 | put st 14 mul 4 q |
| 95 | put st 13 0 |
| 96 | ph_emit ins st 5 |
| 97 | end |
| 98 | ph_tail ins st |
| 99 | put meta 0 get st 0 |
| 100 | end |