Skip to content

Commit d58b771

Browse files
committed
feat: update NE operator to be bool normalized
1 parent 7bef7fa commit d58b771

8 files changed

Lines changed: 20 additions & 4 deletions

File tree

src/arch/z80/peephole/opts/020_o1_bool_norm_empty.opt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,5 +25,6 @@ IF {{
2525
$1 IN ("xor a", "ld a, 0",
2626
"call .core.__GEF", "call .core.__LEI16", "call .core.__LEI8", "call .core.__LTI8",
2727
"call .core.__ANDF", "call .core.__EQF", "call .core.__GTF", "call .core.__LTI16",
28-
"call .core.__LEF", "call .core.__LEI32", "call .core.__LTF", "call .core.__LTI32")
28+
"call .core.__LEF", "call .core.__LEI32", "call .core.__LTF", "call .core.__LTI32",
29+
"call .core.__NEF")
2930
}}

tests/functional/arch/zx48k/nef16.asm

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ _t:
3131
call .core.__EQ32
3232
sub 1
3333
sbc a, a
34+
neg
3435
ld (0), a
3536
ld hl, 0
3637
ld b, h
@@ -72,5 +73,5 @@ __EQ32: ; Test if 32bit value HLDE equals top of the stack
7273
xor a
7374
ret
7475
pop namespace
75-
#line 27 "arch/zx48k/nef16.bas"
76+
#line 28 "arch/zx48k/nef16.bas"
7677
END

tests/functional/arch/zx48k/nei16.asm

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,9 @@ _t:
2828
sbc hl, de
2929
ld a, h
3030
or l
31+
sub 1
32+
sbc a, a
33+
inc a
3134
ld (0), a
3235
ld hl, 0
3336
ld b, h

tests/functional/arch/zx48k/nei32.asm

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ _t:
3131
call .core.__EQ32
3232
sub 1
3333
sbc a, a
34+
neg
3435
ld (0), a
3536
ld hl, 0
3637
ld b, h
@@ -72,5 +73,5 @@ __EQ32: ; Test if 32bit value HLDE equals top of the stack
7273
xor a
7374
ret
7475
pop namespace
75-
#line 27 "arch/zx48k/nei32.bas"
76+
#line 28 "arch/zx48k/nei32.bas"
7677
END

tests/functional/arch/zx48k/nei8.asm

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,9 @@ _t:
2323
.core.ZXBASIC_USER_DATA_END:
2424
.core.__MAIN_PROGRAM__:
2525
ld a, (_t)
26+
sub 1
27+
sbc a, a
28+
inc a
2629
ld (0), a
2730
ld hl, 0
2831
ld b, h

tests/functional/arch/zx48k/neu16.asm

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,9 @@ _t:
2828
sbc hl, de
2929
ld a, h
3030
or l
31+
sub 1
32+
sbc a, a
33+
inc a
3134
ld (0), a
3235
ld hl, 0
3336
ld b, h

tests/functional/arch/zx48k/neu32.asm

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ _t:
3131
call .core.__EQ32
3232
sub 1
3333
sbc a, a
34+
neg
3435
ld (0), a
3536
ld hl, 0
3637
ld b, h
@@ -72,5 +73,5 @@ __EQ32: ; Test if 32bit value HLDE equals top of the stack
7273
xor a
7374
ret
7475
pop namespace
75-
#line 27 "arch/zx48k/neu32.bas"
76+
#line 28 "arch/zx48k/neu32.bas"
7677
END

tests/functional/arch/zx48k/neu8.asm

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,9 @@ _t:
2323
.core.ZXBASIC_USER_DATA_END:
2424
.core.__MAIN_PROGRAM__:
2525
ld a, (_t)
26+
sub 1
27+
sbc a, a
28+
inc a
2629
ld (0), a
2730
ld hl, 0
2831
ld b, h

0 commit comments

Comments
 (0)