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 / standalone-oracles / oracles.om

233 lines · 3360 bytes Raw Blame History
1note SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
2note Scalar contracts of standalone host instruments. C owns transport and libm effects.
3note op numbers are private to oracle.h, not a runtime public API.
4fn so_oracles op ulong a ulong b ulong c ulong d ulong to ulong
5if eq op 0
6ret ulong mul uint and a 4294967295 2654435761
7end
8if eq op 1
9ret ulong sub uint 4294967295 mul uint and a 4294967295 7
10end
11if eq op 2
12ret ulong add uint and a 4294967295 uint and b 4294967295
13end
14if eq op 3
15if eq a b
16ret 1
17end
18ret 0
19end
20if eq op 4
21if and ne a 0 and ne b 0 ne c 0
22ret 1
23end
24ret 0
25end
26if eq op 5
27ret add a b
28end
29if eq op 6
30ret mul add a c b
31end
32if eq op 7
33ret div add a 255 256
34end
35if eq op 8
36ret or a shl b 32
37end
38if eq op 9
39ret mul sub b a 2
40end
41if eq op 10
42if or eq a 1 and eq a 2 ge b 1024
43ret 17
44end
45ret 0
46end
47if eq op 11
48if eq a 0
49ret 4
50end
51ret 8
52end
53if eq op 12
54if gt a 1
55ret sub a 1
56end
57ret 0
58end
59if eq op 13
60if lt a 2
61ret 1
62end
63ret 0
64end
65if eq op 14
66if and eq a b eq c d
67ret 1
68end
69ret 0
70end
71if eq op 15
72if le a 64
73ret 4
74end
75ret 8
76end
77if eq op 16
78if le a 64
79ret 0
80end
81ret 4
82end
83if eq op 17
84ret 2147483648
85end
86if eq op 18
87x = mul f32 sub long rem a 7 3 0.25
88ret ulong bitcast uint x
89end
90if eq op 19
91x = mul f32 sub long rem a 5 2 0.5
92ret ulong bitcast uint x
93end
94if eq op 20
95x = sub f64 bitcast f32 uint and a 4294967295 f64 bitcast f32 uint and b 4294967295
96ret and bitcast ulong x 9223372036854775807
97end
98if eq op 21
99if gt bitcast f64 a 0.0001
100ret 1
101end
102ret 0
103end
104if eq op 22
105ret ulong add mul uint and a 4294967295 1664525 1013904223
106end
107if eq op 23
108x = sub div f32 shr uint and a 4294967295 8 8388608.0 1.0
109ret ulong bitcast uint x
110end
111if eq op 24
112if lt and a 2147483647 2139095040
113ret 1
114end
115ret 0
116end
117if eq op 25
118x = bitcast f32 uint and a 4294967295
119y = bitcast f32 uint and b 2147483647
120if gt y x
121ret ulong bitcast uint y
122end
123ret and a 4294967295
124end
125if eq op 26
126if eq b 0
127ret ulong bitcast uint f32 sub long rem a 67 33
128end
129ret ulong bitcast uint f32 rem a 17
130end
131if eq op 27
132if eq b 0
133ret ulong bitcast uint f32 1.0
134end
135if eq b 1
136if eq a 5119
137ret ulong bitcast uint f32 1.0
138end
139ret 0
140end
141if eq rem a 2 1
142ret ulong bitcast uint f32 1.0
143end
144ret ulong bitcast uint f32 -1.0
145end
146if eq op 28
147if eq a 0
148ret add b 1
149end
150ret b
151end
152if eq op 29
153if ge bitcast f32 uint and a 4294967295 bitcast f32 uint and b 4294967295
154ret 1
155end
156ret 0
157end
158if eq op 30
159if gt bitcast f32 uint and a 4294967295 bitcast f32 uint and b 4294967295
160ret a
161end
162ret b
163end
164if eq op 31
165ret ulong bitcast uint f32 sub long rem a 173 90
166end
167if eq op 32
168ret ulong bitcast uint f32 sub long rem a 143 80
169end
170if eq op 33
171if gt a b
172ret 1
173end
174ret 0
175end
176if eq op 34
177if lt a b
178ret 1
179end
180ret 0
181end
182if eq op 35
183ret sub a b
184end
185if eq op 36
186if eq eq a 0 eq b 0
187ret 1
188end
189ret 0
190end
191if eq op 37
192if gt bitcast f32 uint and a 4294967295 bitcast f32 uint and b 4294967295
193ret 1
194end
195ret 0
196end
197if eq op 38
198if gt bitcast f64 a bitcast f64 b
199ret a
200end
201ret b
202end
203if eq op 39
204if eq rem a 2 1
205ret xor b 2147483648
206end
207ret b
208end
209if eq op 40
210ret sub 0 rem a 64
211end
212if eq op 41
213if eq a 0
214ret b
215end
216ret c
217end
218if eq op 42
219ret shr a 16
220end
221if eq op 43
222x = mul bitcast f32 uint and shl b 16 4294967295 bitcast f32 uint and shl c 16 4294967295
223x = add bitcast f32 uint and a 4294967295 x
224ret ulong bitcast uint x
225end
226if eq op 44
227if or ne a 0 or ne b 0 ne c 0
228ret 1
229end
230ret 0
231end
232ret 18446744073709551615
233end