diff options
author | Kartik Agaram <vc@akkartik.com> | 2020-02-27 17:03:08 -0800 |
---|---|---|
committer | Kartik Agaram <vc@akkartik.com> | 2020-02-27 17:03:08 -0800 |
commit | 2aba46d78163d420fec87a1bd0971fb165af9e02 (patch) | |
tree | 26c8459f1bfa50066dab823de2325fafb0c1555f /mu_instructions | |
parent | 8b85a07f977f374d8d76831c1cb9c93796772094 (diff) | |
download | mu-2aba46d78163d420fec87a1bd0971fb165af9e02.tar.gz |
6060
Diffstat (limited to 'mu_instructions')
-rw-r--r-- | mu_instructions | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/mu_instructions b/mu_instructions index 941401dc..0b6da8b0 100644 --- a/mu_instructions +++ b/mu_instructions @@ -146,7 +146,11 @@ var/reg <- multiply *var2/reg2 { .name="multiply", .inouts=[reg2], .outputs=[ Jumps have a slightly simpler format. Most of the time they take no inouts or outputs. Occasionally you give them a label for a containing block to jump to -the start or end of. +the start or end of. (Conditional branches read different combinations of CPU +flags.) + +break {.name="break", .subx-name="e9/jump break/disp32"} +break label {.name="break", .inouts=[label], .subx-name="e9/jump", .disp32=inouts[0] ":break"} break-if-= {.name="break-if-=", .subx-name="0f 84/jump-if-= break/disp32"} break-if-= label {.name="break-if-=", .inouts=[label], .subx-name="0f 84/jump-if-=", .disp32=inouts[0] ":break"} @@ -171,9 +175,12 @@ break-if-addr<= label {.name="break-if-addr<=", .inouts=[label], break-if-addr>= {.name="break-if-addr>=", .subx-name="0f 83/jump-if-addr>= break/disp32"} break-if-addr>= label {.name="break-if-addr>=", .inouts=[label], .subx-name="0f 83/jump-if-addr>=", .disp32=inouts[0] ":break"} -Finally, we repeat all the 'break' variants almost identically for 'loop' -instructions. This works because the compiler inserts ':loop' labels at the -start of such named blocks, and ':break' labels at the end. +We repeat all the 'break' variants almost identically for 'loop' instructions. +This works because the compiler inserts ':loop' labels at the start of such +named blocks, and ':break' labels at the end. + +loop {.name="loop", .subx-name="e9/jump loop/disp32"} +loop label {.name="loop", .inouts=[label], .subx-name="e9/jump", .disp32=inouts[0] ":loop"} loop-if-= {.name="loop-if-=", .subx-name="0f 84/jump-if-= loop/disp32"} loop-if-= label {.name="loop-if-=", .inouts=[label], .subx-name="0f 84/jump-if-=", .disp32=inouts[0] ":loop"} @@ -198,13 +205,6 @@ loop-if-addr<= label {.name="loop-if-addr<=", .inouts=[label], loop-if-addr>= {.name="loop-if-addr>=", .subx-name="0f 83/jump-if-addr>= loop/disp32"} loop-if-addr>= label {.name="loop-if-addr>=", .inouts=[label], .subx-name="0f 83/jump-if-addr>=", .disp32=inouts[0] ":loop"} -Finally, unconditional jumps: - -loop {.name="loop", .subx-name="e9/jump loop/disp32"} -loop label {.name="loop", .inouts=[label], .subx-name="e9/jump", .disp32=inouts[0] ":loop"} -break {.name="break", .subx-name="e9/jump break/disp32"} -break label {.name="break", .inouts=[label], .subx-name="e9/jump", .disp32=inouts[0] ":break"} - Array operations var/reg <- length var2/reg2: (addr array T) |