]> rethought.computer Git - sorel-lang.git/commitdiff
loop on the opposite condition keep/e15ab69e3cb393780ff5555dbd8a52aac493d1ec
authorBryan English <bryan@rethought.computer>
Sat, 31 Jan 2026 03:52:58 +0000 (22:52 -0500)
committerBryan English <bryan@rethought.computer>
Tue, 10 Feb 2026 04:08:54 +0000 (04:08 +0000)
rel-lang/relc/src/riscv_asm_codegen.rs

index 184a44af11de28a4a1435c80255ae31ff51d3a9f..69b39b4209307987c0c46d3d8a3950e6fb0a19ad 100644 (file)
@@ -306,10 +306,10 @@ impl<'a> CodeGen<'a> {
                     }
                     stack.pop();
                 },
-                IR::Loop => { // keep looping as long as top of stack is true/0
+                IR::Loop => { // keep looping until is true/0
                     self.label(format!("_loop_{}:", loop_count));
                     self.pop_to("t0");
-                    self.line(format!("bnez t0, _endloop_{}", loop_count));
+                    self.line(format!("beqz t0, _endloop_{}", loop_count));
                     loop_stack.push(loop_count);
                     loop_count += 1;
                 },