From 2aba46d78163d420fec87a1bd0971fb165af9e02 Mon Sep 17 00:00:00 2001 From: Kartik Agaram Date: Thu, 27 Feb 2020 17:03:08 -0800 Subject: 6060 --- mu_instructions | 22 +++++++++++----------- 1 file 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) -- cgit 1.4.1-2-gfad0