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
CUDApp / tests / amd-exec / trans-probe.om
| 1 | note SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception |
| 2 | note Test-only 8-byte (opcode, input bits) to 4-byte result; short record exits 74. |
| 3 | global tb uchar 8 |
| 4 | fn tbword p ulong to ulong |
| 5 | v = ulong 0 |
| 6 | for i ulong 4 |
| 7 | v = or v shl ulong get tb add p i mul i 8 |
| 8 | end |
| 9 | ret v |
| 10 | end |
| 11 | fn main to int |
| 12 | while true bound 999999 |
| 13 | n = ulong 0 |
| 14 | while lt n 8 bound 999999 |
| 15 | r = read 0 tb n sub 8 n |
| 16 | if lt r 0 |
| 17 | ret 74 |
| 18 | end |
| 19 | if eq r 0 |
| 20 | if eq n 0 |
| 21 | ret 0 |
| 22 | end |
| 23 | ret 74 |
| 24 | end |
| 25 | n = add n ulong r |
| 26 | end |
| 27 | op = tbword 0 |
| 28 | v = tbword 4 |
| 29 | if eq op 32 |
| 30 | v = fpexp v |
| 31 | else |
| 32 | if eq op 33 |
| 33 | v = fplog v |
| 34 | else |
| 35 | if eq op 34 |
| 36 | v = fprcp v |
| 37 | else |
| 38 | if ne op 36 |
| 39 | ret 66 |
| 40 | end |
| 41 | v = fprsq v |
| 42 | end |
| 43 | end |
| 44 | end |
| 45 | for i ulong 4 |
| 46 | put tb i uchar and shr v mul i 8 255 |
| 47 | end |
| 48 | n = 0 |
| 49 | while lt n 4 bound 999999 |
| 50 | r = write 1 tb n sub 4 n |
| 51 | if le r 0 |
| 52 | ret 74 |
| 53 | end |
| 54 | n = add n ulong r |
| 55 | end |
| 56 | end |
| 57 | ret 0 |
| 58 | end |