interplane.Get Omega
Read in your language

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

branch main Branches Tags History

omega-mv / gpu / nvidia / om / numeric / patch.om

190 lines · 3265 bytes Raw Blame History
1note SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
2note Literal encodings copied from the frozen numeric patch table; decimal
3note values evaluated from its hex words by WolframLanguageEvaluator.
4fn word4 k ulong a ulong b ulong c ulong d ulong to ulong
5if eq k 0
6ret a
7end
8if eq k 1
9ret b
10end
11if eq k 2
12ret c
13end
14ret d
15end
16fn patchct op ulong to ulong
17if ge op 42
18ret 4294967295
19end
20if and ge op 14 le op 17
21ret 4294967294
22end
23if or or le op 3 eq op 6 or eq op 7 eq op 8
24ret 1
25end
26if or or eq op 36 eq op 39 eq op 40
27ret 1
28end
29if or eq op 4 eq op 5
30ret 4
31end
32if and ge op 19 le op 31
33ret 4
34end
35if eq op 12
36ret 7
37end
38if eq op 18
39ret 12
40end
41if eq op 41
42ret 6
43end
44ret 3
45end
46fn patchw op ulong i ulong k ulong to ulong
47n = patchct op
48if and gt n 1 lt n 16
49if eq i sub n 1
50ret word4 k 31053 0 58720256 1042944
51end
52if eq i sub n 2
53ctl = ulong 1040896
54if eq n 3
55ctl = ulong 2089472
56end
57if eq op 12
58ctl = ulong 2089472
59end
60ret word4 k 100694406 9 202381572 ctl
61end
62end
63if or eq op 4 eq op 5
64if eq i 0
65src = ulong 5
66if eq op 5
67src = ulong 255
68end
69ret word4 k 33583627 src 66084864 17811968
70end
71if eq op 5
72ret word4 k 84505096 2 0 1034752
73end
74ret word4 k 34173448 5 0 1034752
75end
76if and ge op 19 le op 31
77if eq i 0
78ret word4 k 33583627 5 or 66060288 shl nrmask op 12 17811968
79end
80ret word4 k 34173448 5 0 1034752
81end
82if eq op 0
83ret word4 k 34173473 5 0 17811968
84end
85if eq op 1
86ret word4 k 34173473 2147483653 0 17811968
87end
88if eq op 2
89ret word4 k 34173472 5 4194304 17811968
90end
91if eq op 3
92ret word4 k 34173475 5 1 17811968
93end
94if eq op 6
95ret word4 k 34173449 5 58720256 17811968
96end
97if eq op 7
98ret word4 k 34173449 5 125829120 17811968
99end
100if eq op 8
101ret word4 k 619077 2 2102272 17811968
102end
103if eq op 9
104ret word4 k 619269 2 2158848 17704960
105end
106if eq op 10
107ret word4 k 619272 2 4096 17704960
108end
109if eq op 11
110ret word4 k 619272 2 5120 17704960
111end
112if eq op 13
113ret word4 k 34176905 136322816 917504 17704960
114end
115if eq op 12
116if eq i 0
117ret word4 k 555033 2 1791 17811968
118end
119if eq i 1
120ret word4 k 134903826 252 126762239 1034752
121end
122if eq i 2
123ret word4 k 134248840 2 134220031 17818112
124end
125if eq i 3
126ret word4 k 31517 0 65536 1043456
127end
128ret word4 k 168393092 255 134219776 927744
129end
130if eq op 18
131if eq rem i 2 0
132ctl = ulong 926720
133if eq i 0
134ctl = ulong 17704960
135end
136ret word4 k 34176905 or 134225664 shl shr 16 div i 2 21 917504 ctl
137end
138dst = ulong 33714721
139if eq i 9
140dst = ulong 34173473
141end
142ret word4 k dst 9 0 2083328
143end
144if eq op 32
145ret word4 k 619269 2 2126080 17704960
146end
147if eq op 33
148ret word4 k 619269 2 2142464 17704960
149end
150if eq op 34
151ret word4 k 619269 2 2109696 17704960
152end
153if eq op 35
154ret word4 k 619269 2 2158592 17704960
155end
156if eq op 36
157ret word4 k 619077 2 2101248 17811968
158end
159if eq op 37
160ret word4 k 619268 2 2099200 17704960
161end
162if eq op 38
163ret word4 k 619268 2 2105344 17704960
164end
165if eq op 39
166ret word4 k 4278809136 536870914 16640 17811968
167end
168if eq op 40
169ret word4 k 34175001 16 1791 17811968
170end
171if eq op 41
172if eq i 0
173ret word4 k 4278877058 59392 2560 17704960
174end
175if eq i 1
176ret word4 k 151681061 4 126746634 2083840
177end
178if eq i 2
179ret word4 k 168524161 4 203299072 927744
180end
181ret word4 k 34173475 5 11 2083328
182end
183ret 0
184end
185fn numeric_patch mode ulong op ulong i ulong k ulong to ulong
186if eq mode 0
187ret patchct op
188end
189ret patchw op i k
190end