Skip to content

Commit 1a6850b

Browse files
committed
to do
1 parent 673106f commit 1a6850b

2 files changed

Lines changed: 457 additions & 0 deletions

File tree

TODO.mnemonics.md

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
# TO DO
2+
3+
Mnemonics to implement
4+
5+
## TODO ZASM mnemonics (missing today)
6+
7+
| TODO ZASM mnemonic | Operand shape (suggested) | WASM equivalent | What it does |
8+
|---|---|---|---|
9+
| **AND** | `AND r, x` | `i32.and` | Bitwise AND (i32). |
10+
| **OR** | `OR r, x` | `i32.or` | Bitwise OR (i32). |
11+
| **XOR** | `XOR r, x` | `i32.xor` | Bitwise XOR (i32). |
12+
| **SLA** | `SLA r, x` | `i32.shl` | Shift left (variable count). |
13+
| **SRA** | `SRA r, x` | `i32.shr_s` | Arithmetic right shift. |
14+
| **SRL** | `SRL r, x` | `i32.shr_u` | Logical right shift. |
15+
| **ROL** | `ROL r, x` | `i32.rotl` | Rotate left. |
16+
| **ROR** | `ROR r, x` | `i32.rotr` | Rotate right. |
17+
| **MUL** | `MUL r, x` | `i32.mul` | Multiply (i32). |
18+
| **DIVS** | `DIVS r, x` | `i32.div_s` | Signed division (trap on div0/overflow like WASM). |
19+
| **DIVU** | `DIVU r, x` | `i32.div_u` | Unsigned division. |
20+
| **REMS** | `REMS r, x` | `i32.rem_s` | Signed remainder. |
21+
| **REMU** | `REMU r, x` | `i32.rem_u` | Unsigned remainder. |
22+
| **EQ** | `EQ r, x` | `i32.eq` | Compare equals → i32(0/1). |
23+
| **NE** | `NE r, x` | `i32.ne` | Compare not-equals → i32(0/1). |
24+
| **LTS** | `LTS r, x` | `i32.lt_s` | Signed `<` → i32(0/1). |
25+
| **LTU** | `LTU r, x` | `i32.lt_u` | Unsigned `<` → i32(0/1). |
26+
| **LES** | `LES r, x` | `i32.le_s` | Signed `<=` → i32(0/1). |
27+
| **LEU** | `LEU r, x` | `i32.le_u` | Unsigned `<=` → i32(0/1). |
28+
| **GTS** | `GTS r, x` | `i32.gt_s` | Signed `>` → i32(0/1). |
29+
| **GTU** | `GTU r, x` | `i32.gt_u` | Unsigned `>` → i32(0/1). |
30+
| **GES** | `GES r, x` | `i32.ge_s` | Signed `>=` → i32(0/1). |
31+
| **GEU** | `GEU r, x` | `i32.ge_u` | Unsigned `>=` → i32(0/1). |
32+
| **CLZ** | `CLZ r` | `i32.clz` | Count leading zeros. |
33+
| **CTZ** | `CTZ r` | `i32.ctz` | Count trailing zeros. |
34+
| **POPC** | `POPC r` | `i32.popcnt` | Popcount. |
35+
| **LD8U** | `LD8U r, (addr)` | `i32.load8_u` | Load u8, zero-extend to i32. |
36+
| **LD8S** | `LD8S r, (addr)` | `i32.load8_s` | Load i8, sign-extend to i32. |
37+
| **LD16U** | `LD16U r, (addr)` | `i32.load16_u` | Load u16, zero-extend. |
38+
| **LD16S** | `LD16S r, (addr)` | `i32.load16_s` | Load i16, sign-extend. |
39+
| **LD32** | `LD32 r, (addr)` | `i32.load` | Load i32. |
40+
| **ST8** | `ST8 (addr), r` | `i32.store8` | Store low 8 bits. |
41+
| **ST16** | `ST16 (addr), r` | `i32.store16` | Store low 16 bits. |
42+
| **ST32** | `ST32 (addr), r` | `i32.store` | Store i32. |
43+
| **FILL** | `FILL` (uses regs) | `memory.fill` | Bulk fill (e.g. `HL=dst, A=byte, BC=len`). |
44+
| **LDIR** | `LDIR` (uses regs) | `memory.copy` | Bulk copy (e.g. `HL=src, DE=dst, BC=len`). |
45+
| **DROP** | `DROP r` *(optional)* | `drop` | Explicitly discard a value (useful in expr-lowering). |

0 commit comments

Comments
 (0)