1
0
mirror of https://github.com/dschmenk/PLASMA.git synced 2025-04-22 12:37:36 +00:00

Optimize NOT before branch

This commit is contained in:
David Schmenk 2017-06-07 17:41:50 -07:00
parent 7d35fd7726
commit 92535477ff
2 changed files with 25 additions and 4 deletions

View File

@ -32,17 +32,18 @@ byte constr = "Constant expression = "
byte[] offsets = "Structure offsets:"
word array[] = 1, 10, 100, 1000, 10000
word ptr
byte spaces = " "
//
// Define functions.
//
def tens(start)
word i
word i, pptr
i = start
pptr = @print
repeat
print:hex(i)
print:str(@spaces)
print:dec(i)
print:str(" ")
pptr=>dec(i)
print:newln()
i = i / 10
until i == 0
@ -76,10 +77,15 @@ def nums(range)
puti(array[1]);putln
end
export def main(range)
byte a
a = 10
nums(*range)
tens(*range*10)
ascii
putln
puts("10 * 8 = "); puti(a * 8); putln
puts("10 / 2 = "); puti(a / 2); putln
puts(@hello)
when MACHID & $C8
is $08

View File

@ -1187,6 +1187,21 @@ int crunch_seq(t_opseq **seq)
break;
}
break; // GADDR_CODE
case LOGIC_NOT_CODE:
switch (opnext->code)
{
case BRFALSE_CODE:
op->code = BRTRUE_CODE;
op->tag = opnext->tag;
freeops = 1;
break;
case BRTRUE_CODE:
op->code = BRFALSE_CODE;
op->tag = opnext->tag;
freeops = 1;
break;
}
break; // LOGIC_NOT_CODE
}
//
// Free up crunched ops