Files
toaster/fw/stm8s/common/extra.def
Mike Trudeau 5b106896a1 migrate
2026-02-13 20:30:52 +00:00

216 lines
3.7 KiB
Modula-2

// Extra rules generated by rules_gen.py
// REG ^= (1 << 0)
replace restart {
ld a, %1
xor a, #0x01
ld %1, a
} by {
bcpl %1, #0 ; peephole replaced xor by bcpl.
} if notUsed('a')
// REG |= (1 << 0)
replace restart {
ld a, %1
or a, #0x01
ld %1, a
} by {
bset %1, #0 ; peephole replaced or by bset.
} if notUsed('a')
// REG &= ~(1 << 0)
replace restart {
ld a, %1
and a, #0xfe
ld %1, a
} by {
bres %1, #0 ; peephole replaced and by bres.
} if notUsed('a')
// REG ^= (1 << 1)
replace restart {
ld a, %1
xor a, #0x02
ld %1, a
} by {
bcpl %1, #1 ; peephole replaced xor by bcpl.
} if notUsed('a')
// REG |= (1 << 1)
replace restart {
ld a, %1
or a, #0x02
ld %1, a
} by {
bset %1, #1 ; peephole replaced or by bset.
} if notUsed('a')
// REG &= ~(1 << 1)
replace restart {
ld a, %1
and a, #0xfd
ld %1, a
} by {
bres %1, #1 ; peephole replaced and by bres.
} if notUsed('a')
// REG ^= (1 << 2)
replace restart {
ld a, %1
xor a, #0x04
ld %1, a
} by {
bcpl %1, #2 ; peephole replaced xor by bcpl.
} if notUsed('a')
// REG |= (1 << 2)
replace restart {
ld a, %1
or a, #0x04
ld %1, a
} by {
bset %1, #2 ; peephole replaced or by bset.
} if notUsed('a')
// REG &= ~(1 << 2)
replace restart {
ld a, %1
and a, #0xfb
ld %1, a
} by {
bres %1, #2 ; peephole replaced and by bres.
} if notUsed('a')
// REG ^= (1 << 3)
replace restart {
ld a, %1
xor a, #0x08
ld %1, a
} by {
bcpl %1, #3 ; peephole replaced xor by bcpl.
} if notUsed('a')
// REG |= (1 << 3)
replace restart {
ld a, %1
or a, #0x08
ld %1, a
} by {
bset %1, #3 ; peephole replaced or by bset.
} if notUsed('a')
// REG &= ~(1 << 3)
replace restart {
ld a, %1
and a, #0xf7
ld %1, a
} by {
bres %1, #3 ; peephole replaced and by bres.
} if notUsed('a')
// REG ^= (1 << 4)
replace restart {
ld a, %1
xor a, #0x10
ld %1, a
} by {
bcpl %1, #4 ; peephole replaced xor by bcpl.
} if notUsed('a')
// REG |= (1 << 4)
replace restart {
ld a, %1
or a, #0x10
ld %1, a
} by {
bset %1, #4 ; peephole replaced or by bset.
} if notUsed('a')
// REG &= ~(1 << 4)
replace restart {
ld a, %1
and a, #0xef
ld %1, a
} by {
bres %1, #4 ; peephole replaced and by bres.
} if notUsed('a')
// REG ^= (1 << 5)
replace restart {
ld a, %1
xor a, #0x20
ld %1, a
} by {
bcpl %1, #5 ; peephole replaced xor by bcpl.
} if notUsed('a')
// REG |= (1 << 5)
replace restart {
ld a, %1
or a, #0x20
ld %1, a
} by {
bset %1, #5 ; peephole replaced or by bset.
} if notUsed('a')
// REG &= ~(1 << 5)
replace restart {
ld a, %1
and a, #0xdf
ld %1, a
} by {
bres %1, #5 ; peephole replaced and by bres.
} if notUsed('a')
// REG ^= (1 << 6)
replace restart {
ld a, %1
xor a, #0x40
ld %1, a
} by {
bcpl %1, #6 ; peephole replaced xor by bcpl.
} if notUsed('a')
// REG |= (1 << 6)
replace restart {
ld a, %1
or a, #0x40
ld %1, a
} by {
bset %1, #6 ; peephole replaced or by bset.
} if notUsed('a')
// REG &= ~(1 << 6)
replace restart {
ld a, %1
and a, #0xbf
ld %1, a
} by {
bres %1, #6 ; peephole replaced and by bres.
} if notUsed('a')
// REG ^= (1 << 7)
replace restart {
ld a, %1
xor a, #0x80
ld %1, a
} by {
bcpl %1, #7 ; peephole replaced xor by bcpl.
} if notUsed('a')
// REG |= (1 << 7)
replace restart {
ld a, %1
or a, #0x80
ld %1, a
} by {
bset %1, #7 ; peephole replaced or by bset.
} if notUsed('a')
// REG &= ~(1 << 7)
replace restart {
ld a, %1
and a, #0x7f
ld %1, a
} by {
bres %1, #7 ; peephole replaced and by bres.
} if notUsed('a')