This commit is contained in:
Paul Mathieu 2021-02-22 20:33:58 -08:00
parent f3928f52a4
commit abfd8d3647

View File

@ -339,14 +339,12 @@ orOp = make_cpu_bin_op('or')
XorOp = make_cpu_bin_op('xor') XorOp = make_cpu_bin_op('xor')
class ShlOp(BinOp): class ShlOp(BinOp):
scratch_need = 3 scratch_need = 2
def synth(self, scratches): def synth(self, scratches):
sc0, sc1, sc2 = scratches sc0, sc1 = scratches
return [f'or {sc0}, {self.right}, {self.right}', return [f'set {sc1}, 1',
f'or {self.dest}, {self.left}, {self.left}', f'or {self.dest}, {self.left}, {self.left}',
f'set {sc1}, 1', f'sub {sc0}, {self.right}, {sc1}',
f'set {sc2}, 0',
f'cmp {sc0}, {sc2}',
f'beq [pc, 6]', f'beq [pc, 6]',
f'add {self.dest}, {self.dest}, {self.dest}', f'add {self.dest}, {self.dest}, {self.dest}',
f'sub {sc0}, {sc0}, {sc1}', f'sub {sc0}, {sc0}, {sc1}',