;; Z80N peepholes for add hl and an immediate push. The testsuite passes this file with -custom-copt-rules.

	ld	bc,%1	; Would be better if ZXN opcode affected carry
	add	hl,bc
=
	add	hl,+(%1)


	ld	hl,%1	;const
	push	hl
	ld	hl,%2
=
	push	%1	;const
	ld	hl,%2


	ld	hl,%1	;const
	ld	de,%2
	push	de
	push	hl
	ld	hl,%3
=
	push	%2
	push	%1
	ld	hl,%3

%check 0 <= %2 <= 65535
	ld	hl,_%1
	add	hl,%2
=
	ld	hl,_%1+%2
