diff --git a/tools/cc.py b/tools/cc.py index 7879679..42c784d 100644 --- a/tools/cc.py +++ b/tools/cc.py @@ -339,14 +339,12 @@ orOp = make_cpu_bin_op('or') XorOp = make_cpu_bin_op('xor') class ShlOp(BinOp): - scratch_need = 3 + scratch_need = 2 def synth(self, scratches): - sc0, sc1, sc2 = scratches - return [f'or {sc0}, {self.right}, {self.right}', + sc0, sc1 = scratches + return [f'set {sc1}, 1', f'or {self.dest}, {self.left}, {self.left}', - f'set {sc1}, 1', - f'set {sc2}, 0', - f'cmp {sc0}, {sc2}', + f'sub {sc0}, {self.right}, {sc1}', f'beq [pc, 6]', f'add {self.dest}, {self.dest}, {self.dest}', f'sub {sc0}, {sc0}, {sc1}',