Skip to content

Make the compiler aware that add\sub\and\or\xor etc can be used on memory operands #46

@ZERICO2005

Description

@ZERICO2005
; current
	ld	iy, (ix - 6)
	ld	a, (iy)
	ld	l, (ix - 12)
	and	a, l
;	ld	l, a ; L is unused
	ld	c, (ix - 20)
;	ld	a, l ; redundant
	or	a, c
	ld	l, a
	ld	(iy), l
	lea	hl, iy + 0
	ld	bc, (ix - 15)
	add	hl, bc
	ld	a, (hl)
	push	de
	pop	bc

; optimal
	ld	iy, (ix - 6)
	ld	a, (iy)
	and	a, (ix - 12)
	or	a, (ix - 20)
	ld	(iy), a
	lea	hl, iy + 0
	ld	bc, (ix - 15)
	add	hl, bc
	ld	a, (hl)
	push	de
	pop	bc

Metadata

Metadata

Assignees

No one assigned

    Labels

    missed optimizationMissed optimizations generate correct (no bugs) but not optimal code

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions