;; Removes useless LD's
;; Tries to guess the value of the 1st and 2nd operands.
;; If they're the same, this LD is useless

OLEVEL: 4
OFLAG: 109

REPLACE {{
  $1 $2, $3
}}

IF {{
($2 <> sp) && ($2 <> ix) && !IS_REQUIRED($2) &&
 ($1 == ld || (!IS_REQUIRED(f) && ($1 == add || $1 == adc || $1 == sbc)))
}}

WITH {{
}}
