Interplane page as plain text, for reading tools and agents. English is the reference text: translate it with your own tool. Text in backticks and in ``` blocks (commands, fingerprints, file names) and link targets in <...> are exact: copy them, never translate them. Page: /drakestapleton/CUDApp/blob/main/om/standalone-oracles/oracles.om # CUDApp CUDA++: AIEN’s GPU machine-code toolchain, runtime and driver client for NVIDIA GPUs without the CUDA toolkit. Hardware coverage and driver replacement limits are explicit. Brought by drakestapleton Sign in to star 0 stars 0 watching About Files History Releases Proposed changes Issues For developers branch `main` Branches Tags History `CUDApp / om / standalone-oracles / oracles.om` 233 lines · 3360 bytes Raw Blame History 1 note SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 2 note Scalar contracts of standalone host instruments. C owns transport and libm effects. 3 note op numbers are private to oracle.h, not a runtime public API. 4 fn so_oracles op ulong a ulong b ulong c ulong d ulong to ulong 5 if eq op 0 6 ret ulong mul uint and a `4294967295` `2654435761` 7 end 8 if eq op 1 9 ret ulong sub uint `4294967295` mul uint and a `4294967295` 7 10 end 11 if eq op 2 12 ret ulong add uint and a `4294967295` uint and b `4294967295` 13 end 14 if eq op 3 15 if eq a b 16 ret 1 17 end 18 ret 0 19 end 20 if eq op 4 21 if and ne a 0 and ne b 0 ne c 0 22 ret 1 23 end 24 ret 0 25 end 26 if eq op 5 27 ret add a b 28 end 29 if eq op 6 30 ret mul add a c b 31 end 32 if eq op 7 33 ret div add a 255 256 34 end 35 if eq op 8 36 ret or a shl b 32 37 end 38 if eq op 9 39 ret mul sub b a 2 40 end 41 if eq op 10 42 if or eq a 1 and eq a 2 ge b 1024 43 ret 17 44 end 45 ret 0 46 end 47 if eq op 11 48 if eq a 0 49 ret 4 50 end 51 ret 8 52 end 53 if eq op 12 54 if gt a 1 55 ret sub a 1 56 end 57 ret 0 58 end 59 if eq op 13 60 if lt a 2 61 ret 1 62 end 63 ret 0 64 end 65 if eq op 14 66 if and eq a b eq c d 67 ret 1 68 end 69 ret 0 70 end 71 if eq op 15 72 if le a 64 73 ret 4 74 end 75 ret 8 76 end 77 if eq op 16 78 if le a 64 79 ret 0 80 end 81 ret 4 82 end 83 if eq op 17 84 ret `2147483648` 85 end 86 if eq op 18 87 x = mul f32 sub long rem a 7 3 0.25 88 ret ulong bitcast uint x 89 end 90 if eq op 19 91 x = mul f32 sub long rem a 5 2 0.5 92 ret ulong bitcast uint x 93 end 94 if eq op 20 95 x = sub f64 bitcast f32 uint and a `4294967295` f64 bitcast f32 uint and b `4294967295` 96 ret and bitcast ulong x `9223372036854775807` 97 end 98 if eq op 21 99 if gt bitcast f64 a 0.0001 100 ret 1 101 end 102 ret 0 103 end 104 if eq op 22 105 ret ulong add mul uint and a `4294967295` `1664525` `1013904223` 106 end 107 if eq op 23 108 x = sub div f32 shr uint and a `4294967295` 8 `8388608`.0 1.0 109 ret ulong bitcast uint x 110 end 111 if eq op 24 112 if lt and a `2147483647` `2139095040` 113 ret 1 114 end 115 ret 0 116 end 117 if eq op 25 118 x = bitcast f32 uint and a `4294967295` 119 y = bitcast f32 uint and b `2147483647` 120 if gt y x 121 ret ulong bitcast uint y 122 end 123 ret and a `4294967295` 124 end 125 if eq op 26 126 if eq b 0 127 ret ulong bitcast uint f32 sub long rem a 67 33 128 end 129 ret ulong bitcast uint f32 rem a 17 130 end 131 if eq op 27 132 if eq b 0 133 ret ulong bitcast uint f32 1.0 134 end 135 if eq b 1 136 if eq a 5119 137 ret ulong bitcast uint f32 1.0 138 end 139 ret 0 140 end 141 if eq rem a 2 1 142 ret ulong bitcast uint f32 1.0 143 end 144 ret ulong bitcast uint f32 -1.0 145 end 146 if eq op 28 147 if eq a 0 148 ret add b 1 149 end 150 ret b 151 end 152 if eq op 29 153 if ge bitcast f32 uint and a `4294967295` bitcast f32 uint and b `4294967295` 154 ret 1 155 end 156 ret 0 157 end 158 if eq op 30 159 if gt bitcast f32 uint and a `4294967295` bitcast f32 uint and b `4294967295` 160 ret a 161 end 162 ret b 163 end 164 if eq op 31 165 ret ulong bitcast uint f32 sub long rem a 173 90 166 end 167 if eq op 32 168 ret ulong bitcast uint f32 sub long rem a 143 80 169 end 170 if eq op 33 171 if gt a b 172 ret 1 173 end 174 ret 0 175 end 176 if eq op 34 177 if lt a b 178 ret 1 179 end 180 ret 0 181 end 182 if eq op 35 183 ret sub a b 184 end 185 if eq op 36 186 if eq eq a 0 eq b 0 187 ret 1 188 end 189 ret 0 190 end 191 if eq op 37 192 if gt bitcast f32 uint and a `4294967295` bitcast f32 uint and b `4294967295` 193 ret 1 194 end 195 ret 0 196 end 197 if eq op 38 198 if gt bitcast f64 a bitcast f64 b 199 ret a 200 end 201 ret b 202 end 203 if eq op 39 204 if eq rem a 2 1 205 ret xor b `2147483648` 206 end 207 ret b 208 end 209 if eq op 40 210 ret sub 0 rem a 64 211 end 212 if eq op 41 213 if eq a 0 214 ret b 215 end 216 ret c 217 end 218 if eq op 42 219 ret shr a 16 220 end 221 if eq op 43 222 x = mul bitcast f32 uint and shl b 16 `4294967295` bitcast f32 uint and shl c 16 `4294967295` 223 x = add bitcast f32 uint and a `4294967295` x 224 ret ulong bitcast uint x 225 end 226 if eq op 44 227 if or ne a 0 or ne b 0 ne c 0 228 ret 1 229 end 230 ret 0 231 end 232 ret `18446744073709551615` 233 end