diff --git a/ISA.md b/ISA.md index eab87de..a4e9da5 100644 --- a/ISA.md +++ b/ISA.md @@ -245,6 +245,14 @@ Opcode Table +-----------+----------+---------------------------------------------------------------------------+ | Xor64 | 01111011 | Xor64 dst, src performs logical xor dst with src | +-----------+----------+---------------------------------------------------------------------------+ +| Cmp64 | 01111101 | See Cmp section | ++-----------+----------+---------------------------------------------------------------------------+ +| Cmp32 | 01111100 | See Cmp Section | ++-----------+----------+---------------------------------------------------------------------------+ +| ICmp64 | 01111111 | See Cmp section | ++-----------+----------+---------------------------------------------------------------------------+ +| ICmp32 | 01111110 | See Cmp Section | ++-----------+----------+---------------------------------------------------------------------------+ | FAdd | 10000000 | FAdd dst, src adds src to dst as 32 bit float | +-----------+----------+---------------------------------------------------------------------------+ | FSub | 10000001 | FSub dst, src subtracts src from dst as 32 bit float | @@ -330,6 +338,17 @@ Opcode Table | Ret | 00000010 | Returns from current function to parent function | +-----------+----------+---------------------------------------------------------------------------+ +Comparisons: +Cmp32, Cmp64, ICmp32 & ICmp64 directly set flags based on a pair of values A and B +Based on the result of A-B assuming a sign extension (no dealing with wrapping) +And therefore should be used for i.e r8 > r9 as in: +ICmp64 r8, r9 +JmpIP greater +less_or_eq: + ; ... +greater: + ; ... + Calling algorithm: This is some horrific mix of c and asm but yk void call(uint64_t addr) {