mirror of
https://github.com/irmen/prog8.git
synced 2025-02-23 22:29:04 +00:00
new if tests
This commit is contained in:
parent
cc57477b99
commit
fe9a9fc5cb
@ -17,6 +17,9 @@ internal class IfElseAsmGen(private val program: PtProgram,
|
||||
if(stmt.condition is PtIdentifier ||
|
||||
stmt.condition is PtFunctionCall ||
|
||||
stmt.condition is PtBuiltinFunctionCall ||
|
||||
stmt.condition is PtArrayIndexer ||
|
||||
stmt.condition is PtTypeCast ||
|
||||
stmt.condition is PtMemoryByte ||
|
||||
stmt.condition is PtContainmentCheck)
|
||||
return fallbackTranslate(stmt, false) // the fallback code for these is optimal, so no warning.
|
||||
|
||||
@ -39,9 +42,7 @@ internal class IfElseAsmGen(private val program: PtProgram,
|
||||
translateIfElseBodies("bne", stmt)
|
||||
}
|
||||
|
||||
// TODO more optimized ifs
|
||||
println("(if with special condition... ${stmt.condition})")
|
||||
fallbackTranslate(stmt)
|
||||
fallbackTranslate(stmt, true)
|
||||
}
|
||||
|
||||
private fun assignConditionValueToRegisterAndTest(condition: PtExpression) {
|
||||
@ -54,12 +55,16 @@ internal class IfElseAsmGen(private val program: PtProgram,
|
||||
is PtArrayIndexer,
|
||||
is PtPrefix,
|
||||
is PtBinaryExpression -> { /* no cmp necessary the lda has been done just prior */ }
|
||||
is PtTypeCast -> {
|
||||
if(condition.value.type !in ByteDatatypes)
|
||||
asmgen.out(" cmp #0")
|
||||
}
|
||||
else -> asmgen.out(" cmp #0")
|
||||
}
|
||||
}
|
||||
|
||||
private fun fallbackTranslate(stmt: PtIfElse, warning: Boolean=true) {
|
||||
if(warning) println("WARN: FALLBACK IF: ${stmt.position}") // TODO no more of these
|
||||
private fun fallbackTranslate(stmt: PtIfElse, warning: Boolean) {
|
||||
if(warning) println("WARN: FALLBACK IF: ${stmt.position}") // TODO should have no more of these
|
||||
val jumpAfterIf = stmt.ifScope.children.singleOrNull() as? PtJump
|
||||
assignConditionValueToRegisterAndTest(stmt.condition)
|
||||
if(jumpAfterIf!=null)
|
||||
@ -390,6 +395,7 @@ internal class IfElseAsmGen(private val program: PtProgram,
|
||||
}
|
||||
|
||||
private fun wordLessZero(value: PtExpression, signed: Boolean, jump: PtJump?, stmt: PtIfElse) {
|
||||
// special case for word<0
|
||||
if(signed) {
|
||||
loadAndCmp0MSB(value)
|
||||
if (jump != null)
|
||||
@ -404,6 +410,7 @@ internal class IfElseAsmGen(private val program: PtProgram,
|
||||
private fun wordLessValue(left: PtExpression, right: PtExpression, signed: Boolean, jump: PtJump?, stmt: PtIfElse) {
|
||||
fun code(valueLsb: String, valueMsb: String) {
|
||||
if(signed) {
|
||||
// word < X
|
||||
if(jump!=null) {
|
||||
val (asmLabel, indirect) = asmgen.getJumpTarget(jump)
|
||||
if(indirect) {
|
||||
@ -411,7 +418,7 @@ internal class IfElseAsmGen(private val program: PtProgram,
|
||||
cmp $valueLsb
|
||||
tya
|
||||
sbc $valueMsb
|
||||
bvs +
|
||||
bvc +
|
||||
eor #128
|
||||
+ bpl +
|
||||
jmp ($asmLabel)
|
||||
@ -455,22 +462,26 @@ internal class IfElseAsmGen(private val program: PtProgram,
|
||||
asmgen.out(afterIfLabel)
|
||||
}
|
||||
} else {
|
||||
// uword < X
|
||||
if(jump!=null) {
|
||||
val (asmLabel, indirect) = asmgen.getJumpTarget(jump)
|
||||
if(indirect) {
|
||||
asmgen.out("""
|
||||
cpy $valueMsb
|
||||
bcc _jump
|
||||
+ bne +
|
||||
cmp $valueLsb
|
||||
tya
|
||||
sbc $valueMsb
|
||||
bcc +
|
||||
jmp ($asmLabel)
|
||||
bcs +
|
||||
_jump jmp ($asmLabel)
|
||||
+""")
|
||||
} else {
|
||||
asmgen.out("""
|
||||
cpy $valueMsb
|
||||
bcc $asmLabel
|
||||
bne +
|
||||
cmp $valueLsb
|
||||
tya
|
||||
sbc $valueMsb
|
||||
bcc $asmLabel""")
|
||||
bcc $asmLabel
|
||||
+""")
|
||||
}
|
||||
} else {
|
||||
val afterIfLabel = asmgen.makeLabel("afterif")
|
||||
@ -522,6 +533,7 @@ internal class IfElseAsmGen(private val program: PtProgram,
|
||||
private fun wordGreaterValue(left: PtExpression, right: PtExpression, signed: Boolean, jump: PtJump?, stmt: PtIfElse) {
|
||||
fun code(valueLsb: String, valueMsb: String) {
|
||||
if(signed) {
|
||||
// word > X
|
||||
if(jump!=null) {
|
||||
val (asmLabel, indirect) = asmgen.getJumpTarget(jump)
|
||||
if(indirect) {
|
||||
@ -534,7 +546,7 @@ internal class IfElseAsmGen(private val program: PtProgram,
|
||||
sbc P8ZP_SCRATCH_W1+1
|
||||
bvc +
|
||||
eor #128
|
||||
+ bmi +
|
||||
+ bpl +
|
||||
jmp ($asmLabel)
|
||||
+""")
|
||||
} else {
|
||||
@ -547,7 +559,7 @@ internal class IfElseAsmGen(private val program: PtProgram,
|
||||
sbc P8ZP_SCRATCH_W1+1
|
||||
bvc +
|
||||
eor #128
|
||||
+ bpl $asmLabel""")
|
||||
+ bmi $asmLabel""")
|
||||
}
|
||||
} else {
|
||||
val afterIfLabel = asmgen.makeLabel("afterif")
|
||||
@ -563,7 +575,7 @@ internal class IfElseAsmGen(private val program: PtProgram,
|
||||
sbc P8ZP_SCRATCH_W1+1
|
||||
bvc +
|
||||
eor #128
|
||||
+ bmi $elseLabel""")
|
||||
+ bpl $elseLabel""")
|
||||
asmgen.translate(stmt.ifScope)
|
||||
asmgen.jmp(afterIfLabel, false)
|
||||
asmgen.out(elseLabel)
|
||||
@ -579,51 +591,50 @@ internal class IfElseAsmGen(private val program: PtProgram,
|
||||
sbc P8ZP_SCRATCH_W1+1
|
||||
bvc +
|
||||
eor #128
|
||||
+ bmi $afterIfLabel""")
|
||||
+ bpl $afterIfLabel""")
|
||||
asmgen.translate(stmt.ifScope)
|
||||
}
|
||||
asmgen.out(afterIfLabel)
|
||||
}
|
||||
} else {
|
||||
// uword > X
|
||||
if(jump!=null) {
|
||||
val (asmLabel, indirect) = asmgen.getJumpTarget(jump)
|
||||
if(indirect) {
|
||||
asmgen.out("""
|
||||
cpy $valueMsb
|
||||
beq +
|
||||
bcc _gt
|
||||
bcs _not
|
||||
+ cmp $valueLsb
|
||||
bcc _gt
|
||||
bne _not
|
||||
_gt jmp ($asmLabel)
|
||||
_not""")
|
||||
bcc ++
|
||||
jmp ($asmLabel)
|
||||
+ cmp $valueLsb
|
||||
bcc +
|
||||
beq +
|
||||
jmp ($asmLabel)
|
||||
+""")
|
||||
} else {
|
||||
asmgen.out("""
|
||||
sec
|
||||
sbc $valueLsb
|
||||
sta P8ZP_SCRATCH_REG
|
||||
tya
|
||||
sbc $valueMsb
|
||||
ora P8ZP_SCRATCH_REG
|
||||
cpy $valueMsb
|
||||
beq +
|
||||
bcc ++
|
||||
bcs $asmLabel
|
||||
+ cmp $valueLsb
|
||||
bcc +
|
||||
beq +
|
||||
bne $asmLabel
|
||||
+""")
|
||||
}
|
||||
} else {
|
||||
val afterIfLabel = asmgen.makeLabel("afterif")
|
||||
if(stmt.hasElse()) {
|
||||
// if and else blocks
|
||||
val elseLabel = asmgen.makeLabel("else")
|
||||
asmgen.out("""
|
||||
cpy $valueMsb
|
||||
beq +
|
||||
bcc _gt
|
||||
bcs $elseLabel
|
||||
+ cmp $valueLsb
|
||||
bcc _gt
|
||||
bne $elseLabel
|
||||
_gt""")
|
||||
bcc $elseLabel
|
||||
bne +
|
||||
cmp $valueLsb
|
||||
bcc $elseLabel
|
||||
beq $elseLabel
|
||||
+""")
|
||||
asmgen.translate(stmt.ifScope)
|
||||
asmgen.jmp(afterIfLabel, false)
|
||||
asmgen.out(elseLabel)
|
||||
@ -632,13 +643,12 @@ _gt""")
|
||||
// no else block
|
||||
asmgen.out("""
|
||||
cpy $valueMsb
|
||||
beq +
|
||||
bcc _gt
|
||||
bcs $afterIfLabel
|
||||
+ cmp $valueLsb
|
||||
bcc _gt
|
||||
bne $afterIfLabel
|
||||
_gt""")
|
||||
bcc $afterIfLabel
|
||||
bne +
|
||||
cmp $valueLsb
|
||||
bcc $afterIfLabel
|
||||
beq $afterIfLabel
|
||||
+""")
|
||||
asmgen.translate(stmt.ifScope)
|
||||
}
|
||||
asmgen.out(afterIfLabel)
|
||||
@ -668,6 +678,7 @@ _gt""")
|
||||
private fun wordLessEqualsValue(left: PtExpression, right: PtExpression, signed: Boolean, jump: PtJump?, stmt: PtIfElse) {
|
||||
fun code(valueLsb: String, valueMsb: String) {
|
||||
if(signed) {
|
||||
// word <= X
|
||||
if(jump!=null) {
|
||||
val (asmLabel, indirect) = asmgen.getJumpTarget(jump)
|
||||
if(indirect) {
|
||||
@ -731,6 +742,7 @@ _gt""")
|
||||
asmgen.out(afterIfLabel)
|
||||
}
|
||||
} else {
|
||||
// uword <= X
|
||||
if(jump!=null) {
|
||||
val (asmLabel, indirect) = asmgen.getJumpTarget(jump)
|
||||
if(indirect) {
|
||||
@ -818,6 +830,7 @@ _gt""")
|
||||
|
||||
fun code(valueLsb: String, valueMsb: String) {
|
||||
if(signed) {
|
||||
// word >= X
|
||||
if(jump!=null) {
|
||||
val (asmLabel, indirect) = asmgen.getJumpTarget(jump)
|
||||
if(indirect) {
|
||||
@ -869,6 +882,7 @@ _gt""")
|
||||
asmgen.out(afterIfLabel)
|
||||
}
|
||||
} else {
|
||||
// uword >= X
|
||||
if(jump!=null) {
|
||||
val (asmLabel, indirect) = asmgen.getJumpTarget(jump)
|
||||
if(indirect) {
|
||||
@ -947,13 +961,14 @@ _gt""")
|
||||
}
|
||||
else -> {
|
||||
asmgen.assignExpressionToRegister(value, RegisterOrPair.AY, true)
|
||||
asmgen.out(" cmp #0")
|
||||
asmgen.out(" cpy #0")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun wordLessEqualsZero(value: PtExpression, signed: Boolean, jump: PtJump?, stmt: PtIfElse) {
|
||||
return if(signed) {
|
||||
// word <= 0
|
||||
asmgen.assignExpressionToRegister(value, RegisterOrPair.AY, true) // TODO optimize this even further by doing MSB/LSB separately
|
||||
if(jump!=null) {
|
||||
val (asmLabel, indirect) = asmgen.getJumpTarget(jump)
|
||||
@ -1006,12 +1021,14 @@ _gt""")
|
||||
asmgen.out(afterIfLabel)
|
||||
}
|
||||
} else {
|
||||
// uword <= 0 --> uword == 0
|
||||
wordEqualsZero(value, true, false, jump, stmt)
|
||||
}
|
||||
}
|
||||
|
||||
private fun wordGreaterZero(value: PtExpression, signed: Boolean, jump: PtJump?, stmt: PtIfElse) {
|
||||
if(signed) {
|
||||
// word > 0
|
||||
asmgen.assignExpressionToRegister(value, RegisterOrPair.AY, true) // TODO optimize this even further by doing MSB/LSB separately
|
||||
if(jump!=null) {
|
||||
val (asmLabel, indirect) = asmgen.getJumpTarget(jump)
|
||||
@ -1064,12 +1081,15 @@ _gt""")
|
||||
asmgen.out(afterIfLabel)
|
||||
}
|
||||
} else {
|
||||
// uword > 0 --> uword != 0
|
||||
wordEqualsZero(value, true, false, jump, stmt)
|
||||
}
|
||||
}
|
||||
|
||||
private fun wordEqualsZero(value: PtExpression, notEquals: Boolean, signed: Boolean, jump: PtJump?, stmt: PtIfElse) {
|
||||
|
||||
// special case for (u)word == 0
|
||||
|
||||
fun viaScratchReg(branchInstr: String, falseBranch: String) {
|
||||
asmgen.assignExpressionToRegister(value, RegisterOrPair.AY, signed)
|
||||
asmgen.out(" sty P8ZP_SCRATCH_REG | ora P8ZP_SCRATCH_REG")
|
||||
@ -1135,6 +1155,8 @@ _gt""")
|
||||
stmt: PtIfElse
|
||||
) {
|
||||
|
||||
// special case for (u)word == X and (u)word != X
|
||||
|
||||
fun translateLoadFromVarNotEquals(varname: String) {
|
||||
if(jump!=null) {
|
||||
val (asmLabel, indirect) = asmgen.getJumpTarget(jump)
|
||||
|
10
compiler/res/prog8lib/virtual/test_stack.p8
Normal file
10
compiler/res/prog8lib/virtual/test_stack.p8
Normal file
@ -0,0 +1,10 @@
|
||||
; dummy function on the VM
|
||||
|
||||
%import textio
|
||||
|
||||
test_stack {
|
||||
%option no_symbol_prefixing, ignore_unused
|
||||
|
||||
sub test() {
|
||||
}
|
||||
}
|
@ -3,18 +3,19 @@
|
||||
all: test
|
||||
|
||||
clean:
|
||||
rm -f *.prg *.asm *.vice-* test_*.p8
|
||||
rm -f *.prg *.p8ir *.asm *.vice-* test_*.p8
|
||||
|
||||
test: clean generate test_prgs
|
||||
|
||||
generate:
|
||||
python make_tests.py
|
||||
p8compile -target cx16 *.p8 >/dev/null
|
||||
python make_eq_tests.py
|
||||
p8compile -target cx16 -sourcelines *.p8 >/dev/null
|
||||
|
||||
test_prgs:
|
||||
x16emu -run -prg ifelse.prg
|
||||
x16emu -run -prg optimized_compares.prg
|
||||
x16emu -run -prg more_compares.prg
|
||||
for program in *.prg; do \
|
||||
for program in test*.prg; do \
|
||||
echo "RUNNING:" $$program ; \
|
||||
x16emu -run -prg $$program >/dev/null ; \
|
||||
done
|
||||
|
1645
compiler/test/comparisons/ifelse.p8
Normal file
1645
compiler/test/comparisons/ifelse.p8
Normal file
File diff suppressed because it is too large
Load Diff
527
compiler/test/comparisons/make_eq_tests.py
Normal file
527
compiler/test/comparisons/make_eq_tests.py
Normal file
@ -0,0 +1,527 @@
|
||||
# generates various Prog8 files with a huge amount of number equality tests.
|
||||
|
||||
import sys
|
||||
|
||||
fail_index = 0
|
||||
|
||||
|
||||
def header(dt):
|
||||
print(f"""
|
||||
%import textio
|
||||
%import floats
|
||||
%import test_stack
|
||||
%zeropage dontuse
|
||||
%option no_sysinit
|
||||
|
||||
main {{
|
||||
ubyte success = 0
|
||||
str datatype = "{dt}"
|
||||
uword @shared comparison
|
||||
|
||||
sub start() {{
|
||||
txt.print("\\n(in)equality tests for datatype: ")
|
||||
txt.print(datatype)
|
||||
txt.nl()
|
||||
test_stack.test()
|
||||
txt.print("==0: ")
|
||||
test_is_zero()
|
||||
txt.print("\\n!=0: ")
|
||||
test_not_zero()
|
||||
txt.print("\\n==number: ")
|
||||
test_is_number()
|
||||
txt.print("\\n!=number: ")
|
||||
test_not_number()
|
||||
txt.print("\\n==var: ")
|
||||
test_is_var()
|
||||
txt.print("\\n!=var: ")
|
||||
test_not_var()
|
||||
txt.print("\\n==array[]: ")
|
||||
test_is_array()
|
||||
txt.print("\\n!=array[]: ")
|
||||
test_not_array()
|
||||
txt.print("\\n==expr: ")
|
||||
test_is_expr()
|
||||
txt.print("\\n!=expr: ")
|
||||
test_not_expr()
|
||||
test_stack.test()
|
||||
}}
|
||||
|
||||
sub verify_success(ubyte expected) {{
|
||||
if success==expected {{
|
||||
txt.print("ok")
|
||||
}} else {{
|
||||
txt.print(" **failed** ")
|
||||
txt.print_ub(success)
|
||||
txt.print(" success, expected ")
|
||||
txt.print_ub(expected)
|
||||
}}
|
||||
}}
|
||||
|
||||
sub fail_byte(uword idx, byte v1, byte v2) {{
|
||||
txt.print(" **fail#")
|
||||
txt.print_uw(idx)
|
||||
txt.chrout(':')
|
||||
txt.print_b(v1)
|
||||
txt.chrout(',')
|
||||
txt.print_b(v2)
|
||||
txt.print(" **")
|
||||
}}
|
||||
|
||||
sub fail_ubyte(uword idx, ubyte v1, ubyte v2) {{
|
||||
txt.print(" **fail#")
|
||||
txt.print_uw(idx)
|
||||
txt.chrout(':')
|
||||
txt.print_ub(v1)
|
||||
txt.chrout(',')
|
||||
txt.print_ub(v2)
|
||||
txt.print(" **")
|
||||
}}
|
||||
|
||||
sub fail_word(uword idx, word v1, word v2) {{
|
||||
txt.print(" **fail#")
|
||||
txt.print_uw(idx)
|
||||
txt.chrout(':')
|
||||
txt.print_w(v1)
|
||||
txt.chrout(',')
|
||||
txt.print_w(v2)
|
||||
txt.print(" **")
|
||||
}}
|
||||
|
||||
sub fail_uword(uword idx, uword v1, uword v2) {{
|
||||
txt.print(" **fail#")
|
||||
txt.print_uw(idx)
|
||||
txt.chrout(':')
|
||||
txt.print_uw(v1)
|
||||
txt.chrout(',')
|
||||
txt.print_uw(v2)
|
||||
txt.print(" **")
|
||||
}}
|
||||
|
||||
sub fail_float(uword idx, float v1, float v2) {{
|
||||
txt.print(" **fail#")
|
||||
txt.print_uw(idx)
|
||||
txt.chrout(':')
|
||||
floats.print(v1)
|
||||
txt.chrout(',')
|
||||
floats.print(v2)
|
||||
txt.print(" **")
|
||||
}}
|
||||
|
||||
""")
|
||||
|
||||
|
||||
zero_values = {
|
||||
"byte": 0,
|
||||
"ubyte": 0,
|
||||
"word": 0,
|
||||
"uword": 0,
|
||||
"float": 0.0
|
||||
}
|
||||
|
||||
nonzero_values = {
|
||||
"byte": -100,
|
||||
"ubyte": 100,
|
||||
"word": -9999,
|
||||
"uword": 9999,
|
||||
"float": 1234.56
|
||||
}
|
||||
|
||||
|
||||
def make_test_is_zero(datatype):
|
||||
print(f"""
|
||||
sub test_is_zero() {{
|
||||
{datatype} @shared x
|
||||
success = 0
|
||||
|
||||
x={zero_values[datatype]}
|
||||
; direct jump
|
||||
if x==0
|
||||
goto lbl1
|
||||
goto skip1
|
||||
lbl1: success++
|
||||
skip1:
|
||||
; indirect jump
|
||||
cx16.r3 = &lbl2
|
||||
if x==0
|
||||
goto cx16.r3
|
||||
goto skip2
|
||||
lbl2: success++
|
||||
skip2:
|
||||
; no else
|
||||
if x==0
|
||||
success++
|
||||
|
||||
; with else
|
||||
if x==0
|
||||
success++
|
||||
else
|
||||
cx16.r0L++
|
||||
|
||||
x = {nonzero_values[datatype]}
|
||||
; direct jump
|
||||
if x==0
|
||||
goto skip3
|
||||
success++
|
||||
skip3:
|
||||
; indirect jump
|
||||
cx16.r3 = &skip4
|
||||
if x==0
|
||||
goto cx16.r3
|
||||
success++
|
||||
skip4:
|
||||
; no else
|
||||
success++
|
||||
if x==0
|
||||
success--
|
||||
|
||||
; with else
|
||||
if x==0
|
||||
cx16.r0L++
|
||||
else
|
||||
success++
|
||||
|
||||
verify_success(8)
|
||||
}}
|
||||
""")
|
||||
|
||||
|
||||
def make_test_not_zero(datatype):
|
||||
print(f"""
|
||||
sub test_not_zero() {{
|
||||
{datatype} @shared x
|
||||
success = 0
|
||||
|
||||
x={nonzero_values[datatype]}
|
||||
; direct jump
|
||||
if x!=0
|
||||
goto lbl1
|
||||
goto skip1
|
||||
lbl1: success++
|
||||
skip1:
|
||||
; indirect jump
|
||||
cx16.r3 = &lbl2
|
||||
if x!=0
|
||||
goto cx16.r3
|
||||
goto skip2
|
||||
lbl2: success++
|
||||
skip2:
|
||||
; no else
|
||||
if x!=0
|
||||
success++
|
||||
|
||||
; with else
|
||||
if x!=0
|
||||
success++
|
||||
else
|
||||
cx16.r0L++
|
||||
|
||||
x = {zero_values[datatype]}
|
||||
; direct jump
|
||||
if x!=0
|
||||
goto skip3
|
||||
success++
|
||||
skip3:
|
||||
; indirect jump
|
||||
cx16.r3 = &skip4
|
||||
if x!=0
|
||||
goto cx16.r3
|
||||
success++
|
||||
skip4:
|
||||
; no else
|
||||
success++
|
||||
if x!=0
|
||||
success--
|
||||
|
||||
; with else
|
||||
if x!=0
|
||||
cx16.r0L++
|
||||
else
|
||||
success++
|
||||
|
||||
verify_success(8)
|
||||
}}
|
||||
""")
|
||||
|
||||
|
||||
def tc(value):
|
||||
if value < 0x8000:
|
||||
return value
|
||||
else:
|
||||
return -(65536 - value)
|
||||
|
||||
|
||||
testnumbers = {
|
||||
"byte": [-100, 0, 100],
|
||||
"ubyte": [0, 1, 255],
|
||||
"word": [tc(0xaabb), 0, 0x00aa, 0x7700, 0x7fff],
|
||||
"uword": [0, 1, 0x7700, 0xffff],
|
||||
"float": [0.0, 1234.56]
|
||||
}
|
||||
|
||||
|
||||
def make_test_is_number(datatype, equals):
|
||||
numbers = testnumbers[datatype]
|
||||
print(" sub test_is_number() {" if equals else " sub test_not_number() {")
|
||||
print(f""" {datatype} @shared x
|
||||
success = 0""")
|
||||
expected = 0
|
||||
test_index = 0
|
||||
global fail_index
|
||||
for x in numbers:
|
||||
print(f" x={x}")
|
||||
for value in numbers:
|
||||
if value == 0:
|
||||
continue # 0 already tested separately
|
||||
result = (x == value) if equals else (x != value)
|
||||
comp = "==" if equals else "!="
|
||||
test_index += 1
|
||||
if result:
|
||||
expected += 4 # there are 4 test types for every successful combo
|
||||
true_action1 = "success++"
|
||||
true_action2 = "success++"
|
||||
true_action3 = "success++"
|
||||
true_action4 = "success++"
|
||||
else:
|
||||
fail_index += 1
|
||||
true_action1 = f"fail_{datatype}({fail_index},x,{value})"
|
||||
fail_index += 1
|
||||
true_action2 = f"fail_{datatype}({fail_index},x,{value})"
|
||||
fail_index += 1
|
||||
true_action3 = f"fail_{datatype}({fail_index},x,{value})"
|
||||
fail_index += 1
|
||||
true_action4 = f"fail_{datatype}({fail_index},x,{value})"
|
||||
print(f""" ; direct jump
|
||||
if x{comp}{value}
|
||||
goto lbl{test_index}a
|
||||
goto skip{test_index}a
|
||||
lbl{test_index}a: {true_action1}
|
||||
skip{test_index}a:
|
||||
; indirect jump
|
||||
cx16.r3 = &lbl{test_index}b
|
||||
if x{comp}{value}
|
||||
goto cx16.r3
|
||||
goto skip{test_index}b
|
||||
lbl{test_index}b: {true_action2}
|
||||
skip{test_index}b:
|
||||
; no else
|
||||
if x{comp}{value}
|
||||
{true_action3}
|
||||
|
||||
; with else
|
||||
if x{comp}{value}
|
||||
{true_action4}
|
||||
else
|
||||
cx16.r0L++
|
||||
""")
|
||||
print(f" verify_success({expected})\n}}")
|
||||
|
||||
|
||||
def make_test_is_var(datatype, equals):
|
||||
numbers = testnumbers[datatype]
|
||||
print(" sub test_is_var() {" if equals else " sub test_not_var() {")
|
||||
print(f""" {datatype} @shared x, value
|
||||
success = 0""")
|
||||
expected = 0
|
||||
test_index = 0
|
||||
global fail_index
|
||||
for x in numbers:
|
||||
print(f" x={x}")
|
||||
for value in numbers:
|
||||
if value == 0:
|
||||
continue # 0 already tested separately
|
||||
print(f" value={value}")
|
||||
result = (x == value) if equals else (x != value)
|
||||
comp = "==" if equals else "!="
|
||||
test_index += 1
|
||||
if result:
|
||||
expected += 4 # there are 4 test types for every successful combo
|
||||
true_action1 = "success++"
|
||||
true_action2 = "success++"
|
||||
true_action3 = "success++"
|
||||
true_action4 = "success++"
|
||||
else:
|
||||
fail_index += 1
|
||||
true_action1 = f"fail_{datatype}({fail_index},x,value)"
|
||||
fail_index += 1
|
||||
true_action2 = f"fail_{datatype}({fail_index},x,value)"
|
||||
fail_index += 1
|
||||
true_action3 = f"fail_{datatype}({fail_index},x,value)"
|
||||
fail_index += 1
|
||||
true_action4 = f"fail_{datatype}({fail_index},x,value)"
|
||||
print(f""" ; direct jump
|
||||
if x{comp}value
|
||||
goto lbl{test_index}a
|
||||
goto skip{test_index}a
|
||||
lbl{test_index}a: {true_action1}
|
||||
skip{test_index}a:
|
||||
; indirect jump
|
||||
cx16.r3 = &lbl{test_index}b
|
||||
if x{comp}value
|
||||
goto cx16.r3
|
||||
goto skip{test_index}b
|
||||
lbl{test_index}b: {true_action2}
|
||||
skip{test_index}b:
|
||||
; no else
|
||||
if x{comp}value
|
||||
{true_action3}
|
||||
|
||||
; with else
|
||||
if x{comp}value
|
||||
{true_action4}
|
||||
else
|
||||
cx16.r0L++
|
||||
""")
|
||||
print(f" verify_success({expected})\n}}")
|
||||
|
||||
|
||||
def make_test_is_array(datatype, equals):
|
||||
numbers = testnumbers[datatype]
|
||||
print(" sub test_is_array() {" if equals else " sub test_not_array() {")
|
||||
print(f""" {datatype} @shared x
|
||||
{datatype}[] values = [0, 0]
|
||||
success = 0""")
|
||||
expected = 0
|
||||
test_index = 0
|
||||
global fail_index
|
||||
for x in numbers:
|
||||
print(f" x={x}")
|
||||
for value in numbers:
|
||||
if value == 0:
|
||||
continue # 0 already tested separately
|
||||
print(f" values[1]={value}")
|
||||
result = (x == value) if equals else (x != value)
|
||||
comp = "==" if equals else "!="
|
||||
test_index += 1
|
||||
if result:
|
||||
expected += 4 # there are 4 test types for every successful combo
|
||||
true_action1 = "success++"
|
||||
true_action2 = "success++"
|
||||
true_action3 = "success++"
|
||||
true_action4 = "success++"
|
||||
else:
|
||||
fail_index += 1
|
||||
true_action1 = f"fail_{datatype}({fail_index},x,{value})"
|
||||
fail_index += 1
|
||||
true_action2 = f"fail_{datatype}({fail_index},x,{value})"
|
||||
fail_index += 1
|
||||
true_action3 = f"fail_{datatype}({fail_index},x,{value})"
|
||||
fail_index += 1
|
||||
true_action4 = f"fail_{datatype}({fail_index},x,{value})"
|
||||
print(f""" ; direct jump
|
||||
if x{comp}values[1]
|
||||
goto lbl{test_index}a
|
||||
goto skip{test_index}a
|
||||
lbl{test_index}a: {true_action1}
|
||||
skip{test_index}a:
|
||||
; indirect jump
|
||||
cx16.r3 = &lbl{test_index}b
|
||||
if x{comp}values[1]
|
||||
goto cx16.r3
|
||||
goto skip{test_index}b
|
||||
lbl{test_index}b: {true_action2}
|
||||
skip{test_index}b:
|
||||
; no else
|
||||
if x{comp}values[1]
|
||||
{true_action3}
|
||||
|
||||
; with else
|
||||
if x{comp}values[1]
|
||||
{true_action4}
|
||||
else
|
||||
cx16.r0L++
|
||||
""")
|
||||
print(f" verify_success({expected})\n}}")
|
||||
|
||||
|
||||
def make_test_is_expr(datatype, equals):
|
||||
numbers = testnumbers[datatype]
|
||||
print(" sub test_is_expr() {" if equals else " sub test_not_expr() {")
|
||||
print(f""" {datatype} @shared x
|
||||
cx16.r4 = 1
|
||||
cx16.r5 = 1
|
||||
float @shared f4 = 1.0
|
||||
float @shared f5 = 1.0
|
||||
success = 0""")
|
||||
expected = 0
|
||||
test_index = 0
|
||||
global fail_index
|
||||
for x in numbers:
|
||||
print(f" x={x}")
|
||||
for value in numbers:
|
||||
if value == 0:
|
||||
continue # 0 already tested separately
|
||||
if datatype=="byte":
|
||||
expr = f"cx16.r4sL+{value}-cx16.r5sL"
|
||||
elif datatype=="ubyte":
|
||||
expr = f"cx16.r4L+{value}-cx16.r5L"
|
||||
elif datatype=="word":
|
||||
expr = f"cx16.r4s+{value}-cx16.r5s"
|
||||
elif datatype=="uword":
|
||||
expr = f"cx16.r4+{value}-cx16.r5"
|
||||
elif datatype=="float":
|
||||
expr = f"f4+{value}-f5"
|
||||
result = (x == value) if equals else (x != value)
|
||||
comp = "==" if equals else "!="
|
||||
test_index += 1
|
||||
if result:
|
||||
expected += 4 # there are 4 test types for every successful combo
|
||||
true_action1 = "success++"
|
||||
true_action2 = "success++"
|
||||
true_action3 = "success++"
|
||||
true_action4 = "success++"
|
||||
else:
|
||||
fail_index += 1
|
||||
true_action1 = f"fail_{datatype}({fail_index},x,{value})"
|
||||
fail_index += 1
|
||||
true_action2 = f"fail_{datatype}({fail_index},x,{value})"
|
||||
fail_index += 1
|
||||
true_action3 = f"fail_{datatype}({fail_index},x,{value})"
|
||||
fail_index += 1
|
||||
true_action4 = f"fail_{datatype}({fail_index},x,{value})"
|
||||
print(f""" ; direct jump
|
||||
if x{comp}{expr}
|
||||
goto lbl{test_index}a
|
||||
goto skip{test_index}a
|
||||
lbl{test_index}a: {true_action1}
|
||||
skip{test_index}a:
|
||||
; indirect jump
|
||||
cx16.r3 = &lbl{test_index}b
|
||||
if x{comp}{expr}
|
||||
goto cx16.r3
|
||||
goto skip{test_index}b
|
||||
lbl{test_index}b: {true_action2}
|
||||
skip{test_index}b:
|
||||
; no else
|
||||
if x{comp}{expr}
|
||||
{true_action3}
|
||||
|
||||
; with else
|
||||
if x{comp}{expr}
|
||||
{true_action4}
|
||||
else
|
||||
cx16.r0L++
|
||||
""")
|
||||
print(f" verify_success({expected})\n}}")
|
||||
|
||||
|
||||
def generate(datatype):
|
||||
global fail_index
|
||||
fail_index = 0
|
||||
header(datatype)
|
||||
make_test_is_zero(datatype)
|
||||
make_test_not_zero(datatype)
|
||||
make_test_is_number(datatype, True)
|
||||
make_test_is_number(datatype, False)
|
||||
make_test_is_var(datatype, True)
|
||||
make_test_is_var(datatype, False)
|
||||
make_test_is_array(datatype, True)
|
||||
make_test_is_array(datatype, False)
|
||||
make_test_is_expr(datatype, True)
|
||||
make_test_is_expr(datatype, False)
|
||||
print("\n}\n")
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
for dt in ["ubyte", "uword", "byte", "word", "float"]:
|
||||
sys.stdout = open(f"test_{dt}_equalities.p8", "wt")
|
||||
generate(dt)
|
@ -1,508 +0,0 @@
|
||||
# generates various Prog8 files with a huge amount of number comparion tests,
|
||||
# for all supported datatypes and all comparison operators.
|
||||
|
||||
import sys
|
||||
|
||||
index = 0
|
||||
|
||||
|
||||
def minmaxvalues(dt):
|
||||
if dt == "ubyte":
|
||||
return 0, 255
|
||||
elif dt == "uword":
|
||||
return 0, 65535
|
||||
elif dt == "byte":
|
||||
return -128, 127
|
||||
elif dt == "word":
|
||||
return -32768, 32767
|
||||
elif dt == "float":
|
||||
return -99999999, 99999999
|
||||
else:
|
||||
raise ValueError(dt)
|
||||
|
||||
|
||||
def gen_test(dt, comparison, left, right, expected):
|
||||
global index
|
||||
etxt = f"{left} {comparison} {right}"
|
||||
if eval(etxt) != expected:
|
||||
raise ValueError("invalid comparison: "+etxt+" for "+dt)
|
||||
if expected:
|
||||
stmt_ok = lambda ix: "num_successes++"
|
||||
stmt_else = lambda ix: f"error({ix})"
|
||||
else:
|
||||
stmt_ok = lambda ix: f"error({ix})"
|
||||
stmt_else = lambda ix: "num_successes++"
|
||||
|
||||
def c(number):
|
||||
if dt not in ("byte", "ubyte"):
|
||||
return f"({number} as {dt})"
|
||||
return str(number)
|
||||
|
||||
print(
|
||||
f""" left = {c(left)}
|
||||
right = {c(right)}
|
||||
"""
|
||||
)
|
||||
|
||||
# const <op> const
|
||||
index += 1
|
||||
print(
|
||||
f""" ; test #{index}
|
||||
if {c(left)} {comparison} {c(right)} {{
|
||||
{stmt_ok(index)}
|
||||
}} else {{
|
||||
{stmt_else(index)}
|
||||
}}
|
||||
""")
|
||||
# const <op> var
|
||||
index += 1
|
||||
print(
|
||||
f""" ; test #{index}
|
||||
if {c(left)} {comparison} right {{
|
||||
{stmt_ok(index)}
|
||||
}} else {{
|
||||
{stmt_else(index)}
|
||||
}}
|
||||
""")
|
||||
# const <op> expr
|
||||
index += 1
|
||||
print(
|
||||
f""" ; test #{index}
|
||||
if {c(left)} {comparison} right+zero {{
|
||||
{stmt_ok(index)}
|
||||
}} else {{
|
||||
{stmt_else(index)}
|
||||
}}
|
||||
""")
|
||||
# var <op> const
|
||||
index += 1
|
||||
print(
|
||||
f""" ; test #{index}
|
||||
if left {comparison} {c(right)} {{
|
||||
{stmt_ok(index)}
|
||||
}} else {{
|
||||
{stmt_else(index)}
|
||||
}}
|
||||
""")
|
||||
# var <op> var
|
||||
index += 1
|
||||
print(
|
||||
f""" ; test #{index}
|
||||
if left {comparison} right {{
|
||||
{stmt_ok(index)}
|
||||
}} else {{
|
||||
{stmt_else(index)}
|
||||
}}
|
||||
""")
|
||||
# var <op> expr
|
||||
index += 1
|
||||
print(
|
||||
f""" ; test #{index}
|
||||
if left {comparison} right+zero {{
|
||||
{stmt_ok(index)}
|
||||
}} else {{
|
||||
{stmt_else(index)}
|
||||
}}
|
||||
""")
|
||||
# expr <op> const
|
||||
index += 1
|
||||
print(
|
||||
f""" ; test #{index}
|
||||
if left+zero {comparison} {c(right)} {{
|
||||
{stmt_ok(index)}
|
||||
}} else {{
|
||||
{stmt_else(index)}
|
||||
}}
|
||||
""")
|
||||
# expr <op> var
|
||||
index += 1
|
||||
print(
|
||||
f""" ; test #{index}
|
||||
if left+zero {comparison} right {{
|
||||
{stmt_ok(index)}
|
||||
}} else {{
|
||||
{stmt_else(index)}
|
||||
}}
|
||||
""")
|
||||
# expr <op> expr
|
||||
index += 1
|
||||
print(
|
||||
f""" ; test #{index}
|
||||
if left+zero {comparison} right+zero {{
|
||||
{stmt_ok(index)}
|
||||
}} else {{
|
||||
{stmt_else(index)}
|
||||
}}
|
||||
""")
|
||||
|
||||
|
||||
def gen_comp_header(dt, operator):
|
||||
print(" ; tests: ", dt, operator)
|
||||
print(" comparison = \""+operator+"\"")
|
||||
print(" txt.print(datatype)")
|
||||
print(" txt.spc()")
|
||||
print(" txt.print(comparison)")
|
||||
print(" txt.nl()")
|
||||
|
||||
|
||||
def gen_comp_equal(dt):
|
||||
minval, maxval = minmaxvalues(dt)
|
||||
gen_comp_header(dt, "==")
|
||||
gen_test(dt, "==", 0, 0, True)
|
||||
gen_test(dt, "==", 0, 1, False)
|
||||
gen_test(dt, "==", 100, 100, True)
|
||||
gen_test(dt, "==", 100, 101, False)
|
||||
if maxval >= 200:
|
||||
gen_test(dt, "==", 200, 200, True)
|
||||
gen_test(dt, "==", 200, 201, False)
|
||||
if maxval >= 9999:
|
||||
gen_test(dt, "==", 9999, 9999, True)
|
||||
gen_test(dt, "==", 9999, 10000, False)
|
||||
gen_test(dt, "==", 0x5000, 0x5000, True)
|
||||
gen_test(dt, "==", 0x5000, 0x5001, False)
|
||||
gen_test(dt, "==", 0x5000, 0x4fff, False)
|
||||
if maxval >= 30000:
|
||||
gen_test(dt, "==", 30000, 30000, True)
|
||||
gen_test(dt, "==", 30000, 30001, False)
|
||||
if maxval >= 40000:
|
||||
gen_test(dt, "==", 0xf000, 0xf000, True)
|
||||
gen_test(dt, "==", 0xf000, 0xf001, False)
|
||||
gen_test(dt, "==", 0xf000, 0xffff, False)
|
||||
if minval < 0:
|
||||
gen_test(dt, "==", 0, -1, False)
|
||||
gen_test(dt, "==", -100, -100, True)
|
||||
if minval < -200:
|
||||
gen_test(dt, "==", -200, -200, True)
|
||||
gen_test(dt, "==", -200, -201, False)
|
||||
if minval < -9999:
|
||||
gen_test(dt, "==", -0x5000, -0x5000, True)
|
||||
gen_test(dt, "==", -0x5000, -0x5001, False)
|
||||
gen_test(dt, "==", -0x5000, -0x4fff, False)
|
||||
gen_test(dt, "==", -9999, -9999, True)
|
||||
gen_test(dt, "==", -9999, -10000, False)
|
||||
gen_test(dt, "==", minval, minval, True)
|
||||
gen_test(dt, "==", minval, minval+1, False)
|
||||
gen_test(dt, "==", maxval, maxval, True)
|
||||
gen_test(dt, "==", maxval, maxval-1, False)
|
||||
|
||||
|
||||
def gen_comp_notequal(dt):
|
||||
minval, maxval = minmaxvalues(dt)
|
||||
gen_comp_header(dt, "!=")
|
||||
gen_test(dt, "!=", 0, 0, False)
|
||||
gen_test(dt, "!=", 0, 1, True)
|
||||
gen_test(dt, "!=", 100, 100, False)
|
||||
gen_test(dt, "!=", 100, 101, True)
|
||||
if maxval >= 200:
|
||||
gen_test(dt, "!=", 200, 200, False)
|
||||
gen_test(dt, "!=", 200, 201, True)
|
||||
if maxval >= 9999:
|
||||
gen_test(dt, "!=", 9999, 9999, False)
|
||||
gen_test(dt, "!=", 9999, 10000, True)
|
||||
gen_test(dt, "!=", 0x5000, 0x5000, False)
|
||||
gen_test(dt, "!=", 0x5000, 0x5001, True)
|
||||
gen_test(dt, "!=", 0x5000, 0x4fff, True)
|
||||
if maxval >= 30000:
|
||||
gen_test(dt, "!=", 30000, 30000, False)
|
||||
gen_test(dt, "!=", 30000, 30001, True)
|
||||
if maxval >= 40000:
|
||||
gen_test(dt, "!=", 0xf000, 0xf000, False)
|
||||
gen_test(dt, "!=", 0xf000, 0xf001, True)
|
||||
gen_test(dt, "!=", 0xf000, 0xffff, True)
|
||||
if minval < 0:
|
||||
gen_test(dt, "!=", 0, -1, True)
|
||||
gen_test(dt, "!=", -100, -100, False)
|
||||
if minval < -200:
|
||||
gen_test(dt, "!=", -200, -200, False)
|
||||
gen_test(dt, "!=", -200, -201, True)
|
||||
if minval < -9999:
|
||||
gen_test(dt, "!=", -0x5000, -0x5000, False)
|
||||
gen_test(dt, "!=", -0x5000, -0x5001, True)
|
||||
gen_test(dt, "!=", -0x5000, -0x4fff, True)
|
||||
gen_test(dt, "!=", -9999, -9999, False)
|
||||
gen_test(dt, "!=", -9999, -10000, True)
|
||||
gen_test(dt, "!=", minval, minval, False)
|
||||
gen_test(dt, "!=", minval, minval+1, True)
|
||||
gen_test(dt, "!=", maxval, maxval, False)
|
||||
gen_test(dt, "!=", maxval, maxval-1, True)
|
||||
|
||||
|
||||
def gen_comp_less(dt):
|
||||
minval, maxval = minmaxvalues(dt)
|
||||
gen_comp_header(dt, "<")
|
||||
gen_test(dt, "<", 0, 0, False)
|
||||
gen_test(dt, "<", 0, 1, True)
|
||||
gen_test(dt, "<", 100, 100, False)
|
||||
gen_test(dt, "<", 100, 101, True)
|
||||
gen_test(dt, "<", 100, 99, False)
|
||||
if maxval >= 200:
|
||||
gen_test(dt, "<", 200, 200, False)
|
||||
gen_test(dt, "<", 200, 201, True)
|
||||
gen_test(dt, "<", 200, 199, False)
|
||||
if maxval >= 9999:
|
||||
gen_test(dt, "<", 9999, 9999, False)
|
||||
gen_test(dt, "<", 9999, 10000, True)
|
||||
gen_test(dt, "<", 9999, 9998, False)
|
||||
gen_test(dt, "<", 0x5000, 0x5000, False)
|
||||
gen_test(dt, "<", 0x5000, 0x5001, True)
|
||||
gen_test(dt, "<", 0x5000, 0x4fff, False)
|
||||
if maxval >= 30000:
|
||||
gen_test(dt, "<", 30000, 30000, False)
|
||||
gen_test(dt, "<", 30000, 30001, True)
|
||||
gen_test(dt, "<", 30000, 29999, False)
|
||||
if maxval >= 40000:
|
||||
gen_test(dt, "<", 0xf000, 0xf000, False)
|
||||
gen_test(dt, "<", 0xf000, 0xf001, True)
|
||||
gen_test(dt, "<", 0xf000, 0xefff, False)
|
||||
if minval < 0:
|
||||
gen_test(dt, "<", 0, -1, False)
|
||||
gen_test(dt, "<", -100, -100, False)
|
||||
gen_test(dt, "<", -100, -101, False)
|
||||
gen_test(dt, "<", -100, -99, True)
|
||||
if minval < -200:
|
||||
gen_test(dt, "<", -200, -200, False)
|
||||
gen_test(dt, "<", -200, -201, False)
|
||||
gen_test(dt, "<", -200, -199, True)
|
||||
if minval < -9999:
|
||||
gen_test(dt, "<", -0x5000, -0x5000, False)
|
||||
gen_test(dt, "<", -0x5000, -0x5001, False)
|
||||
gen_test(dt, "<", -0x5000, -0x4fff, True)
|
||||
gen_test(dt, "<", -9999, -9999, False)
|
||||
gen_test(dt, "<", -9999, -10000, False)
|
||||
gen_test(dt, "<", -9999, -9998, True)
|
||||
|
||||
|
||||
def gen_comp_greater(dt):
|
||||
minval, maxval = minmaxvalues(dt)
|
||||
gen_comp_header(dt, ">")
|
||||
gen_test(dt, ">", 0, 0, False)
|
||||
gen_test(dt, ">", 0, 1, False)
|
||||
gen_test(dt, ">", 100, 100, False)
|
||||
gen_test(dt, ">", 100, 101, False)
|
||||
gen_test(dt, ">", 100, 99, True)
|
||||
if maxval >= 200:
|
||||
gen_test(dt, ">", 200, 200, False)
|
||||
gen_test(dt, ">", 200, 201, False)
|
||||
gen_test(dt, ">", 200, 199, True)
|
||||
if maxval >= 9999:
|
||||
gen_test(dt, ">", 9999, 9999, False)
|
||||
gen_test(dt, ">", 9999, 10000, False)
|
||||
gen_test(dt, ">", 9999, 9998, True)
|
||||
gen_test(dt, ">", 0x5000, 0x5000, False)
|
||||
gen_test(dt, ">", 0x5000, 0x5001, False)
|
||||
gen_test(dt, ">", 0x5000, 0x4fff, True)
|
||||
if maxval >= 30000:
|
||||
gen_test(dt, ">", 30000, 30000, False)
|
||||
gen_test(dt, ">", 30000, 30001, False)
|
||||
gen_test(dt, ">", 30000, 29999, True)
|
||||
if maxval >= 40000:
|
||||
gen_test(dt, ">", 0xf000, 0xf000, False)
|
||||
gen_test(dt, ">", 0xf000, 0xf001, False)
|
||||
gen_test(dt, ">", 0xf000, 0xefff, True)
|
||||
if minval < 0:
|
||||
gen_test(dt, ">", 0, -1, True)
|
||||
gen_test(dt, ">", -100, -100, False)
|
||||
gen_test(dt, ">", -100, -101, True)
|
||||
gen_test(dt, ">", -100, -99, False)
|
||||
if minval < -200:
|
||||
gen_test(dt, ">", -200, -200, False)
|
||||
gen_test(dt, ">", -200, -201, True)
|
||||
gen_test(dt, ">", -200, -199, False)
|
||||
if minval < -9999:
|
||||
gen_test(dt, ">", -0x5000, -0x5000, False)
|
||||
gen_test(dt, ">", -0x5000, -0x5001, True)
|
||||
gen_test(dt, ">", -0x5000, -0x4fff, False)
|
||||
gen_test(dt, ">", -9999, -9999, False)
|
||||
gen_test(dt, ">", -9999, -10000, True)
|
||||
gen_test(dt, ">", -9999, -9998, False)
|
||||
|
||||
|
||||
def gen_comp_lessequal(dt):
|
||||
minval, maxval = minmaxvalues(dt)
|
||||
gen_comp_header(dt, "<=")
|
||||
gen_test(dt, "<=", 0, 0, True)
|
||||
gen_test(dt, "<=", 0, 1, True)
|
||||
gen_test(dt, "<=", 100, 100, True)
|
||||
gen_test(dt, "<=", 100, 101, True)
|
||||
gen_test(dt, "<=", 100, 99, False)
|
||||
if maxval >= 200:
|
||||
gen_test(dt, "<=", 200, 200, True)
|
||||
gen_test(dt, "<=", 200, 201, True)
|
||||
gen_test(dt, "<=", 200, 199, False)
|
||||
if maxval >= 9999:
|
||||
gen_test(dt, "<=", 9999, 9999, True)
|
||||
gen_test(dt, "<=", 9999, 10000, True)
|
||||
gen_test(dt, "<=", 9999, 9998, False)
|
||||
gen_test(dt, "<=", 0x5000, 0x5000, True)
|
||||
gen_test(dt, "<=", 0x5000, 0x5001, True)
|
||||
gen_test(dt, "<=", 0x5000, 0x4fff, False)
|
||||
if maxval >= 30000:
|
||||
gen_test(dt, "<=", 30000, 30000, True)
|
||||
gen_test(dt, "<=", 30000, 30001, True)
|
||||
gen_test(dt, "<=", 30000, 29999, False)
|
||||
if maxval >= 40000:
|
||||
gen_test(dt, "<=", 0xf000, 0xf000, True)
|
||||
gen_test(dt, "<=", 0xf000, 0xf001, True)
|
||||
gen_test(dt, "<=", 0xf000, 0xefff, False)
|
||||
if minval < 0:
|
||||
gen_test(dt, "<=", 0, -1, False)
|
||||
gen_test(dt, "<=", -100, -100, True)
|
||||
gen_test(dt, "<=", -100, -101, False)
|
||||
gen_test(dt, "<=", -100, -99, True)
|
||||
if minval < -200:
|
||||
gen_test(dt, "<=", -200, -200, True)
|
||||
gen_test(dt, "<=", -200, -201, False)
|
||||
gen_test(dt, "<=", -200, -199, True)
|
||||
if minval < -9999:
|
||||
gen_test(dt, "<=", -0x5000, -0x5000, True)
|
||||
gen_test(dt, "<=", -0x5000, -0x5001, False)
|
||||
gen_test(dt, "<=", -0x5000, -0x4fff, True)
|
||||
gen_test(dt, "<=", -9999, -9999, True)
|
||||
gen_test(dt, "<=", -9999, -10000, False)
|
||||
gen_test(dt, "<=", -9999, -9998, True)
|
||||
|
||||
|
||||
def gen_comp_greaterequal(dt):
|
||||
minval, maxval = minmaxvalues(dt)
|
||||
gen_comp_header(dt, ">=")
|
||||
gen_test(dt, ">=", 0, 0, True)
|
||||
gen_test(dt, ">=", 0, 1, False)
|
||||
gen_test(dt, ">=", 100, 100, True)
|
||||
gen_test(dt, ">=", 100, 101, False)
|
||||
gen_test(dt, ">=", 100, 99, True)
|
||||
if maxval >= 200:
|
||||
gen_test(dt, ">=", 200, 200, True)
|
||||
gen_test(dt, ">=", 200, 201, False)
|
||||
gen_test(dt, ">=", 200, 199, True)
|
||||
if maxval >= 9999:
|
||||
gen_test(dt, ">=", 9999, 9999, True)
|
||||
gen_test(dt, ">=", 9999, 10000, False)
|
||||
gen_test(dt, ">=", 9999, 9998, True)
|
||||
gen_test(dt, ">=", 0x5000, 0x5000, True)
|
||||
gen_test(dt, ">=", 0x5000, 0x5001, False)
|
||||
gen_test(dt, ">=", 0x5000, 0x4fff, True)
|
||||
if maxval >= 30000:
|
||||
gen_test(dt, ">=", 30000, 30000, True)
|
||||
gen_test(dt, ">=", 30000, 30001, False)
|
||||
gen_test(dt, ">=", 30000, 29999, True)
|
||||
if maxval >= 40000:
|
||||
gen_test(dt, ">=", 0xf000, 0xf000, True)
|
||||
gen_test(dt, ">=", 0xf000, 0xf001, False)
|
||||
gen_test(dt, ">=", 0xf000, 0xefff, True)
|
||||
if minval < 0:
|
||||
gen_test(dt, ">=", 0, -1, True)
|
||||
gen_test(dt, ">=", -100, -100, True)
|
||||
gen_test(dt, ">=", -100, -101, True)
|
||||
gen_test(dt, ">=", -100, -99, False)
|
||||
if minval < -200:
|
||||
gen_test(dt, ">=", -200, -200, True)
|
||||
gen_test(dt, ">=", -200, -201, True)
|
||||
gen_test(dt, ">=", -200, -199, False)
|
||||
if minval < -9999:
|
||||
gen_test(dt, ">=", -0x5000, -0x5000, True)
|
||||
gen_test(dt, ">=", -0x5000, -0x5001, True)
|
||||
gen_test(dt, ">=", -0x5000, -0x4fff, False)
|
||||
gen_test(dt, ">=", -9999, -9999, True)
|
||||
gen_test(dt, ">=", -9999, -10000, True)
|
||||
gen_test(dt, ">=", -9999, -9998, False)
|
||||
|
||||
|
||||
def generate_test_routine_equalsnotequals(dt):
|
||||
print(f"""
|
||||
sub test_comparisons() {{
|
||||
{dt} @shared left
|
||||
{dt} @shared right
|
||||
{dt} @shared zero = 0
|
||||
""")
|
||||
gen_comp_equal(dt)
|
||||
gen_comp_notequal(dt)
|
||||
print(" }")
|
||||
|
||||
|
||||
def generate_test_routine_lessgreater(dt):
|
||||
print(f"""
|
||||
sub test_comparisons() {{
|
||||
{dt} @shared left
|
||||
{dt} @shared right
|
||||
{dt} @shared zero = 0
|
||||
""")
|
||||
gen_comp_less(dt)
|
||||
gen_comp_greater(dt)
|
||||
print(" }")
|
||||
|
||||
|
||||
def generate_test_routine_lessequalsgreaterequals(dt):
|
||||
print(f"""
|
||||
sub test_comparisons() {{
|
||||
{dt} @shared left
|
||||
{dt} @shared right
|
||||
{dt} @shared zero = 0
|
||||
""")
|
||||
gen_comp_lessequal(dt)
|
||||
gen_comp_greaterequal(dt)
|
||||
print(" }")
|
||||
|
||||
|
||||
def generate(dt, operators):
|
||||
global index
|
||||
index = 0
|
||||
print(f"""
|
||||
%import textio
|
||||
%import floats
|
||||
%import test_stack
|
||||
%zeropage basicsafe
|
||||
|
||||
main {{
|
||||
uword num_errors = 0
|
||||
uword num_successes = 0
|
||||
str datatype = "{dt}"
|
||||
uword @shared comparison
|
||||
|
||||
sub start() {{
|
||||
test_comparisons()
|
||||
print_results()
|
||||
test_stack.test()
|
||||
}}
|
||||
|
||||
sub error(uword index) {{
|
||||
txt.print(" ! error in test ")
|
||||
txt.print_uw(index)
|
||||
txt.chrout(' ')
|
||||
txt.print(datatype)
|
||||
txt.chrout(' ')
|
||||
txt.print(comparison)
|
||||
txt.nl()
|
||||
num_errors++
|
||||
}}
|
||||
""")
|
||||
|
||||
if operators=="eq":
|
||||
generate_test_routine_equalsnotequals(dt)
|
||||
elif operators=="lt":
|
||||
generate_test_routine_lessgreater(dt)
|
||||
elif operators=="lteq":
|
||||
generate_test_routine_lessequalsgreaterequals(dt)
|
||||
else:
|
||||
raise ValueError(operators)
|
||||
|
||||
print(f"""
|
||||
sub print_results() {{
|
||||
txt.nl()
|
||||
txt.print("total {index}: ")
|
||||
txt.print_uw(num_successes)
|
||||
txt.print(" good, ")
|
||||
txt.print_uw(num_errors)
|
||||
txt.print(" errors!\\n")
|
||||
}}
|
||||
}}
|
||||
""")
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
for dt in ["ubyte", "uword", "byte", "word", "float"]:
|
||||
sys.stdout = open(f"test_{dt}_eq.p8", "wt")
|
||||
generate(dt, "eq")
|
||||
sys.stdout = open(f"test_{dt}_lt.p8", "wt")
|
||||
generate(dt, "lt")
|
||||
sys.stdout = open(f"test_{dt}_lteq.p8", "wt")
|
||||
generate(dt, "lteq")
|
@ -37,73 +37,73 @@ main {
|
||||
float @shared f = -100
|
||||
|
||||
txt.print("all 1: ")
|
||||
txt.print_bool(b == -100)
|
||||
txt.print_bool(b != -99)
|
||||
txt.print_bool(b < -99)
|
||||
txt.print_bool(b <= -100)
|
||||
txt.print_bool(b > -101)
|
||||
txt.print_bool(b >= -100)
|
||||
txt.print_bool(ub ==20)
|
||||
txt.print_bool(ub !=19)
|
||||
txt.print_bool(ub <21)
|
||||
txt.print_bool(ub <=20)
|
||||
txt.print_bool(ub>19)
|
||||
txt.print_bool(ub>=20)
|
||||
txt.print_ub(b == -100 as ubyte)
|
||||
txt.print_ub(b != -99 as ubyte)
|
||||
txt.print_ub(b < -99 as ubyte)
|
||||
txt.print_ub(b <= -100 as ubyte)
|
||||
txt.print_ub(b > -101 as ubyte)
|
||||
txt.print_ub(b >= -100 as ubyte)
|
||||
txt.print_ub(ub ==20 as ubyte)
|
||||
txt.print_ub(ub !=19 as ubyte)
|
||||
txt.print_ub(ub <21 as ubyte)
|
||||
txt.print_ub(ub <=20 as ubyte)
|
||||
txt.print_ub(ub>19 as ubyte)
|
||||
txt.print_ub(ub>=20 as ubyte)
|
||||
txt.spc()
|
||||
txt.print_bool(w == -20000)
|
||||
txt.print_bool(w != -19999)
|
||||
txt.print_bool(w < -19999)
|
||||
txt.print_bool(w <= -20000)
|
||||
txt.print_bool(w > -20001)
|
||||
txt.print_bool(w >= -20000)
|
||||
txt.print_bool(uw == 2000)
|
||||
txt.print_bool(uw != 2001)
|
||||
txt.print_bool(uw < 2001)
|
||||
txt.print_bool(uw <= 2000)
|
||||
txt.print_bool(uw > 1999)
|
||||
txt.print_bool(uw >= 2000)
|
||||
txt.print_ub(w == -20000 as ubyte)
|
||||
txt.print_ub(w != -19999 as ubyte)
|
||||
txt.print_ub(w < -19999 as ubyte)
|
||||
txt.print_ub(w <= -20000 as ubyte)
|
||||
txt.print_ub(w > -20001 as ubyte)
|
||||
txt.print_ub(w >= -20000 as ubyte)
|
||||
txt.print_ub(uw == 2000 as ubyte)
|
||||
txt.print_ub(uw != 2001 as ubyte)
|
||||
txt.print_ub(uw < 2001 as ubyte)
|
||||
txt.print_ub(uw <= 2000 as ubyte)
|
||||
txt.print_ub(uw > 1999 as ubyte)
|
||||
txt.print_ub(uw >= 2000 as ubyte)
|
||||
txt.spc()
|
||||
txt.print_bool(f == -100.0)
|
||||
txt.print_bool(f != -99.0)
|
||||
txt.print_bool(f < -99.0)
|
||||
txt.print_bool(f <= -100.0)
|
||||
txt.print_bool(f > -101.0)
|
||||
txt.print_bool(f >= -100.0)
|
||||
txt.print_ub(f == -100.0 as ubyte)
|
||||
txt.print_ub(f != -99.0 as ubyte)
|
||||
txt.print_ub(f < -99.0 as ubyte)
|
||||
txt.print_ub(f <= -100.0 as ubyte)
|
||||
txt.print_ub(f > -101.0 as ubyte)
|
||||
txt.print_ub(f >= -100.0 as ubyte)
|
||||
txt.nl()
|
||||
|
||||
txt.print("all 0: ")
|
||||
txt.print_bool(b == -99)
|
||||
txt.print_bool(b != -100)
|
||||
txt.print_bool(b < -100)
|
||||
txt.print_bool(b <= -101)
|
||||
txt.print_bool(b > -100)
|
||||
txt.print_bool(b >= -99)
|
||||
txt.print_bool(ub ==21)
|
||||
txt.print_bool(ub !=20)
|
||||
txt.print_bool(ub <20)
|
||||
txt.print_bool(ub <=19)
|
||||
txt.print_bool(ub>20)
|
||||
txt.print_bool(ub>=21)
|
||||
txt.print_ub(b == -99 as ubyte)
|
||||
txt.print_ub(b != -100 as ubyte)
|
||||
txt.print_ub(b < -100 as ubyte)
|
||||
txt.print_ub(b <= -101 as ubyte)
|
||||
txt.print_ub(b > -100 as ubyte)
|
||||
txt.print_ub(b >= -99 as ubyte)
|
||||
txt.print_ub(ub ==21 as ubyte)
|
||||
txt.print_ub(ub !=20 as ubyte)
|
||||
txt.print_ub(ub <20 as ubyte)
|
||||
txt.print_ub(ub <=19 as ubyte)
|
||||
txt.print_ub(ub>20 as ubyte)
|
||||
txt.print_ub(ub>=21 as ubyte)
|
||||
txt.spc()
|
||||
txt.print_bool(w == -20001)
|
||||
txt.print_bool(w != -20000)
|
||||
txt.print_bool(w < -20000)
|
||||
txt.print_bool(w <= -20001)
|
||||
txt.print_bool(w > -20000)
|
||||
txt.print_bool(w >= -19999)
|
||||
txt.print_bool(uw == 1999)
|
||||
txt.print_bool(uw != 2000)
|
||||
txt.print_bool(uw < 2000)
|
||||
txt.print_bool(uw <= 1999)
|
||||
txt.print_bool(uw > 2000)
|
||||
txt.print_bool(uw >= 2001)
|
||||
txt.print_ub(w == -20001 as ubyte)
|
||||
txt.print_ub(w != -20000 as ubyte)
|
||||
txt.print_ub(w < -20000 as ubyte)
|
||||
txt.print_ub(w <= -20001 as ubyte)
|
||||
txt.print_ub(w > -20000 as ubyte)
|
||||
txt.print_ub(w >= -19999 as ubyte)
|
||||
txt.print_ub(uw == 1999 as ubyte)
|
||||
txt.print_ub(uw != 2000 as ubyte)
|
||||
txt.print_ub(uw < 2000 as ubyte)
|
||||
txt.print_ub(uw <= 1999 as ubyte)
|
||||
txt.print_ub(uw > 2000 as ubyte)
|
||||
txt.print_ub(uw >= 2001 as ubyte)
|
||||
txt.spc()
|
||||
txt.print_bool(f == -99.0)
|
||||
txt.print_bool(f != -100.0)
|
||||
txt.print_bool(f < -100.0)
|
||||
txt.print_bool(f <= -101.0)
|
||||
txt.print_bool(f > -100.0)
|
||||
txt.print_bool(f >= -99.0)
|
||||
txt.print_ub(f == -99.0 as ubyte)
|
||||
txt.print_ub(f != -100.0 as ubyte)
|
||||
txt.print_ub(f < -100.0 as ubyte)
|
||||
txt.print_ub(f <= -101.0 as ubyte)
|
||||
txt.print_ub(f > -100.0 as ubyte)
|
||||
txt.print_ub(f >= -99.0 as ubyte)
|
||||
txt.nl()
|
||||
|
||||
txt.print("all .: ")
|
||||
@ -335,73 +335,73 @@ main {
|
||||
|
||||
|
||||
txt.print("all 1: ")
|
||||
txt.print_bool(b == minus_100)
|
||||
txt.print_bool(b != minus_99)
|
||||
txt.print_bool(b < minus_99)
|
||||
txt.print_bool(b <= minus_100)
|
||||
txt.print_bool(b > minus_101)
|
||||
txt.print_bool(b >= minus_100)
|
||||
txt.print_bool(ub ==twenty)
|
||||
txt.print_bool(ub !=nineteen)
|
||||
txt.print_bool(ub <twenty1)
|
||||
txt.print_bool(ub <=twenty)
|
||||
txt.print_bool(ub>nineteen)
|
||||
txt.print_bool(ub>=twenty)
|
||||
txt.print_ub(b == minus_100 as ubyte)
|
||||
txt.print_ub(b != minus_99 as ubyte)
|
||||
txt.print_ub(b < minus_99 as ubyte)
|
||||
txt.print_ub(b <= minus_100 as ubyte)
|
||||
txt.print_ub(b > minus_101 as ubyte)
|
||||
txt.print_ub(b >= minus_100 as ubyte)
|
||||
txt.print_ub(ub ==twenty as ubyte)
|
||||
txt.print_ub(ub !=nineteen as ubyte)
|
||||
txt.print_ub(ub <twenty1 as ubyte)
|
||||
txt.print_ub(ub <=twenty as ubyte)
|
||||
txt.print_ub(ub>nineteen as ubyte)
|
||||
txt.print_ub(ub>=twenty as ubyte)
|
||||
txt.spc()
|
||||
txt.print_bool(w == w_min_20000)
|
||||
txt.print_bool(w != w_min_19999)
|
||||
txt.print_bool(w < w_min_19999)
|
||||
txt.print_bool(w <= w_min_20000)
|
||||
txt.print_bool(w > w_min_20001)
|
||||
txt.print_bool(w >= w_min_20000)
|
||||
txt.print_bool(uw == twothousand)
|
||||
txt.print_bool(uw != twothousand1)
|
||||
txt.print_bool(uw < twothousand1)
|
||||
txt.print_bool(uw <= twothousand)
|
||||
txt.print_bool(uw > nineteen99)
|
||||
txt.print_bool(uw >= twothousand)
|
||||
txt.print_ub(w == w_min_20000 as ubyte)
|
||||
txt.print_ub(w != w_min_19999 as ubyte)
|
||||
txt.print_ub(w < w_min_19999 as ubyte)
|
||||
txt.print_ub(w <= w_min_20000 as ubyte)
|
||||
txt.print_ub(w > w_min_20001 as ubyte)
|
||||
txt.print_ub(w >= w_min_20000 as ubyte)
|
||||
txt.print_ub(uw == twothousand as ubyte)
|
||||
txt.print_ub(uw != twothousand1 as ubyte)
|
||||
txt.print_ub(uw < twothousand1 as ubyte)
|
||||
txt.print_ub(uw <= twothousand as ubyte)
|
||||
txt.print_ub(uw > nineteen99 as ubyte)
|
||||
txt.print_ub(uw >= twothousand as ubyte)
|
||||
txt.spc()
|
||||
txt.print_bool(f == f_minus_100)
|
||||
txt.print_bool(f != f_minus_99)
|
||||
txt.print_bool(f < f_minus_99)
|
||||
txt.print_bool(f <= f_minus_100)
|
||||
txt.print_bool(f > f_minus_101)
|
||||
txt.print_bool(f >= f_minus_100)
|
||||
txt.print_ub(f == f_minus_100 as ubyte)
|
||||
txt.print_ub(f != f_minus_99 as ubyte)
|
||||
txt.print_ub(f < f_minus_99 as ubyte)
|
||||
txt.print_ub(f <= f_minus_100 as ubyte)
|
||||
txt.print_ub(f > f_minus_101 as ubyte)
|
||||
txt.print_ub(f >= f_minus_100 as ubyte)
|
||||
txt.nl()
|
||||
|
||||
txt.print("all 0: ")
|
||||
txt.print_bool(b == minus_99)
|
||||
txt.print_bool(b != minus_100)
|
||||
txt.print_bool(b < minus_100)
|
||||
txt.print_bool(b <= minus_101)
|
||||
txt.print_bool(b > minus_100)
|
||||
txt.print_bool(b >= minus_99)
|
||||
txt.print_bool(ub ==twenty1)
|
||||
txt.print_bool(ub !=twenty)
|
||||
txt.print_bool(ub <twenty)
|
||||
txt.print_bool(ub <=nineteen)
|
||||
txt.print_bool(ub>twenty)
|
||||
txt.print_bool(ub>=twenty1)
|
||||
txt.print_ub(b == minus_99 as ubyte)
|
||||
txt.print_ub(b != minus_100 as ubyte)
|
||||
txt.print_ub(b < minus_100 as ubyte)
|
||||
txt.print_ub(b <= minus_101 as ubyte)
|
||||
txt.print_ub(b > minus_100 as ubyte)
|
||||
txt.print_ub(b >= minus_99 as ubyte)
|
||||
txt.print_ub(ub ==twenty1 as ubyte)
|
||||
txt.print_ub(ub !=twenty as ubyte)
|
||||
txt.print_ub(ub <twenty as ubyte)
|
||||
txt.print_ub(ub <=nineteen as ubyte)
|
||||
txt.print_ub(ub>twenty as ubyte)
|
||||
txt.print_ub(ub>=twenty1 as ubyte)
|
||||
txt.spc()
|
||||
txt.print_bool(w == w_min_20001)
|
||||
txt.print_bool(w != w_min_20000)
|
||||
txt.print_bool(w < w_min_20000)
|
||||
txt.print_bool(w <= w_min_20001)
|
||||
txt.print_bool(w > w_min_20000)
|
||||
txt.print_bool(w >= w_min_19999)
|
||||
txt.print_bool(uw == nineteen99)
|
||||
txt.print_bool(uw != twothousand)
|
||||
txt.print_bool(uw < twothousand)
|
||||
txt.print_bool(uw <= nineteen99)
|
||||
txt.print_bool(uw > twothousand)
|
||||
txt.print_bool(uw >= twothousand1)
|
||||
txt.print_ub(w == w_min_20001 as ubyte)
|
||||
txt.print_ub(w != w_min_20000 as ubyte)
|
||||
txt.print_ub(w < w_min_20000 as ubyte)
|
||||
txt.print_ub(w <= w_min_20001 as ubyte)
|
||||
txt.print_ub(w > w_min_20000 as ubyte)
|
||||
txt.print_ub(w >= w_min_19999 as ubyte)
|
||||
txt.print_ub(uw == nineteen99 as ubyte)
|
||||
txt.print_ub(uw != twothousand as ubyte)
|
||||
txt.print_ub(uw < twothousand as ubyte)
|
||||
txt.print_ub(uw <= nineteen99 as ubyte)
|
||||
txt.print_ub(uw > twothousand as ubyte)
|
||||
txt.print_ub(uw >= twothousand1 as ubyte)
|
||||
txt.spc()
|
||||
txt.print_bool(f == f_minus_99)
|
||||
txt.print_bool(f != f_minus_100)
|
||||
txt.print_bool(f < f_minus_100)
|
||||
txt.print_bool(f <= f_minus_101)
|
||||
txt.print_bool(f > f_minus_100)
|
||||
txt.print_bool(f >= f_minus_99)
|
||||
txt.print_ub(f == f_minus_99 as ubyte)
|
||||
txt.print_ub(f != f_minus_100 as ubyte)
|
||||
txt.print_ub(f < f_minus_100 as ubyte)
|
||||
txt.print_ub(f <= f_minus_101 as ubyte)
|
||||
txt.print_ub(f > f_minus_100 as ubyte)
|
||||
txt.print_ub(f >= f_minus_99 as ubyte)
|
||||
txt.nl()
|
||||
|
||||
txt.print("all .: ")
|
||||
|
@ -1,10 +1,20 @@
|
||||
TODO
|
||||
====
|
||||
|
||||
fix casting uword to bool (don't take only the lsb!)
|
||||
fix IR adding snz in bool casts inside if
|
||||
|
||||
|
||||
fix "wordGreaterValue"
|
||||
|
||||
improve code size for "wordGreaterValue" et al.
|
||||
|
||||
|
||||
rockrunner is a lot bigger still than on 10.1
|
||||
paint is bigger than on 10.1
|
||||
|
||||
cx16/testmonogfx is broken
|
||||
cx16/amiga is broken
|
||||
assembler is broken
|
||||
imageviewer is broken
|
||||
paint flood fill is broken
|
||||
@ -40,7 +50,7 @@ ok ok efficient code for if byte comparisons against 0 (== and !=)
|
||||
ok ok efficient code for if word comparisons against 0 (== and !=)
|
||||
ok ok efficient code for if float comparisons against 0 (== and !=)
|
||||
ok ok efficient code for if byte comparisons against a value
|
||||
ok ok efficient code for if word comparisons against a value
|
||||
ok FAIL efficient code for if word comparisons against a value
|
||||
ok ok efficient code for if float comparisons against a value
|
||||
ok ok efficient code for assignment byte comparisons against 0 (== and !=)
|
||||
ok ok efficient code for assignment word comparisons against 0 (== and !=)
|
||||
|
2851
examples/test.p8
2851
examples/test.p8
File diff suppressed because it is too large
Load Diff
Loading…
x
Reference in New Issue
Block a user