Skip to content

Commit

Permalink
Merge pull request #806 from bartsanchez/bart/move-eq16-to-a-class
Browse files Browse the repository at this point in the history
ref: move eq16 function into a class (Bits16)
  • Loading branch information
boriel authored Sep 1, 2024
2 parents ffbbfe8 + 0406770 commit 4a11a47
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 14 deletions.
22 changes: 11 additions & 11 deletions src/arch/z80/backend/_16bit.py
Original file line number Diff line number Diff line change
Expand Up @@ -596,19 +596,19 @@ def gei16(cls, ins: Quad) -> list[str]:
output.append("push af")
return output

@classmethod
def eq16(cls, ins: Quad) -> list[str]:
"""Compares & pops top 2 operands out of the stack, and checks
if the 1st operand == 2nd operand (top of the stack).
Pushes 0 if False, 1 if True.
def _eq16(ins: Quad) -> list[str]:
"""Compares & pops top 2 operands out of the stack, and checks
if the 1st operand == 2nd operand (top of the stack).
Pushes 0 if False, 1 if True.
16 bit un/signed version
"""
output = Bits16.get_oper(ins[2], ins[3])
output.append(runtime_call(RuntimeLabel.EQ16))
output.append("push af")
16 bit un/signed version
"""
output = Bits16.get_oper(ins[2], ins[3])
output.append(runtime_call(RuntimeLabel.EQ16))
output.append("push af")

return output
return output


def _ne16(ins: Quad) -> list[str]:
Expand Down
5 changes: 2 additions & 3 deletions src/arch/z80/backend/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@
_bnot16,
_bor16,
_bxor16,
_eq16,
_fparam16,
_jgezeroi16,
_jgezerou16,
Expand Down Expand Up @@ -265,8 +264,8 @@ def _set_quad_table(self):
ICInstruction.GESTR: ICInfo(3, String.gestr),
ICInstruction.EQU8: ICInfo(3, Bits8.eq8),
ICInstruction.EQI8: ICInfo(3, Bits8.eq8),
ICInstruction.EQU16: ICInfo(3, _eq16),
ICInstruction.EQI16: ICInfo(3, _eq16),
ICInstruction.EQU16: ICInfo(3, Bits16.eq16),
ICInstruction.EQI16: ICInfo(3, Bits16.eq16),
ICInstruction.EQU32: ICInfo(3, Bits32.eq32),
ICInstruction.EQI32: ICInfo(3, Bits32.eq32),
ICInstruction.EQF16: ICInfo(3, Fixed16.eqf16),
Expand Down

0 comments on commit 4a11a47

Please sign in to comment.