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/core/eval.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 / core / eval.om` 103 lines · 1348 bytes Raw Blame History 1 note SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 2 note Copyright 2026 Drake Stapleton 3 note WolframLanguageEvaluator: FullSimplify[a 2^i == Mod[a 2^i,2^64]+2^64 Quotient[a 2^i,2^64], integer bounds] -> True. 4 fn emulhi a ulong b ulong to ulong 5 lo = ulong 0 6 hi = ulong 0 7 for i ulong 64 8 if ne and shr b i 1 0 9 x = shl a i 10 y = ulong 0 11 if ne i 0 12 y = shr a sub 64 i 13 end 14 t = add lo x 15 hi = add hi y 16 if lt t lo 17 hi = add hi 1 18 end 19 lo = t 20 end 21 end 22 ret hi 23 end 24 fn omeval v view ulong 6 o edit ulong 1 to long 25 op = get v 0 26 ov = get v 1 27 width = get v 2 28 mask = ulong `18446744073709551615` 29 if lt width 64 30 mask = sub shl ulong 1 width 1 31 end 32 a = and get v 3 mask 33 b = and get v 4 mask 34 res = ulong 0 35 over = false 36 if eq op 3 37 res = add a b 38 over = or lt res a ne and res xor mask `18446744073709551615` 0 39 else 40 if eq op 4 41 res = sub a b 42 over = lt a b 43 else 44 if eq op 5 45 res = mul a b 46 if lt width 64 47 if ne a 0 48 over = gt b div mask a 49 end 50 else 51 if lt width 128 52 over = ne shr emulhi a b sub width 64 0 53 end 54 end 55 else 56 if eq op 6 57 if eq b 0 58 ret -1 59 end 60 res = div a b 61 else 62 if eq op 7 63 if eq a b 64 put o 0 1 65 else 66 put o 0 0 67 end 68 ret 0 69 else 70 if eq op 8 71 if lt a b 72 put o 0 1 73 else 74 put o 0 0 75 end 76 ret 0 77 else 78 if eq op 9 79 res = and a b 80 else 81 if eq op 10 82 res = or a b 83 else 84 ret -1 85 end 86 end 87 end 88 end 89 end 90 end 91 end 92 end 93 if over 94 if eq ov 3 95 ret -2 96 end 97 if eq ov 2 98 res = mask 99 end 100 end 101 put o 0 and res mask 102 ret 0 103 end