Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/api/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ def to_signed(cls, type_: "TYPE") -> "TYPE":
"""Return signed type or equivalent"""
if type_ in cls.unsigned:
return {
TYPE.boolean: TYPE.boolean,
TYPE.boolean: TYPE.byte,
TYPE.ubyte: TYPE.byte,
TYPE.uinteger: TYPE.integer,
TYPE.ulong: TYPE.long,
Expand Down
16 changes: 16 additions & 0 deletions src/arch/z80/peephole/opts/013_o1_neg_neg.opt
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
;; Replaces sequence:
;; neg
;; neg
;; with
;; ; nop ;; double neg can be removed

OLEVEL: 1
OFLAG: 13

REPLACE {{
neg
neg
}}

WITH {{
}}
46 changes: 46 additions & 0 deletions tests/functional/arch/zx48k/let_uminus_bool.asm
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
org 32768
.core.__START_PROGRAM:
di
push ix
push iy
exx
push hl
exx
ld hl, 0
add hl, sp
ld (.core.__CALL_BACK__), hl
ei
jp .core.__MAIN_PROGRAM__
.core.__CALL_BACK__:
DEFW 0
.core.ZXBASIC_USER_DATA:
; Defines USER DATA Length in bytes
.core.ZXBASIC_USER_DATA_LEN EQU .core.ZXBASIC_USER_DATA_END - .core.ZXBASIC_USER_DATA
.core.__LABEL__.ZXBASIC_USER_DATA_LEN EQU .core.ZXBASIC_USER_DATA_LEN
.core.__LABEL__.ZXBASIC_USER_DATA EQU .core.ZXBASIC_USER_DATA
_a:
DEFB 00
.core.ZXBASIC_USER_DATA_END:
.core.__MAIN_PROGRAM__:
ld hl, (_a - 1)
ld a, (_a)
sub h
sub 1
sbc a, a
ld (_a), a
ld hl, 0
ld b, h
ld c, l
.core.__END_PROGRAM:
di
ld hl, (.core.__CALL_BACK__)
ld sp, hl
exx
pop hl
exx
pop iy
pop ix
ei
ret
;; --- end of user code ---
END
4 changes: 4 additions & 0 deletions tests/functional/arch/zx48k/let_uminus_bool.bas
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
DIM a As Ubyte

LET a = -(a = a)

Loading