~vdupras/duskos

a74baaaaaa3e05788784cd0c2952376cd6c1f3af — Virgil Dupras a month ago d814a6c
halcc: fix another binop bug
3 files changed, 6 insertions(+), 1 deletions(-)

M fs/comp/c/egen.fs
M fs/tests/comp/c/cc.fs
M fs/tests/comp/c/test.c
M fs/comp/c/egen.fs => fs/comp/c/egen.fs +1 -1
@@ 93,7 93,7 @@ UOPSCNT wordtbl uoptbl ( res -- res )
: cmpop doer 4 for ' execute , next does> ( left right 'conds )
  over Result :unsigned? not if CELLSZ << + then
  over Result :isW? if CELLSZ + @ >r swap else @ >r then ( left right )
  Result :?freeCurrentW Result :hal$ over Result :?>W cmp, r> C>W, ;
  Result :?freeCurrentW over Result :?>W Result :hal$ cmp, r> C>W, ;
cmpop _==, Z) Z) Z) Z)       cmpop _!=, NZ) NZ) NZ) NZ)
cmpop _<, <) >=) s<) s>=)    cmpop _<=, <=) >) s<=) s>)
cmpop _>, >) <=) s>) s<=)   cmpop _>=, >=) <) s>=) s<)

M fs/tests/comp/c/cc.fs => fs/tests/comp/c/cc.fs +2 -0
@@ 92,6 92,8 @@ $72 2 binop11 $1c #eq
1 42 binop13 1 #eq
-1 42 binop13 0 #eq
binop14 $100 #eq
S" abc" S" aac" 1 binop15 #
S" abc" S" aac" 2 binop15 not #
structop1 44 #eq
structop2 44 #eq
structop2 45 #eq

M fs/tests/comp/c/test.c => fs/tests/comp/c/test.c +3 -0
@@ 370,6 370,9 @@ int binop13(ushort a, ushort b) {
int binop14() {
	return 1 << 8;
}
int binop15(char *a, char *b, int i) {
	return a[i] == b[i];
}
short structop1() {
    globdata.bar += 2;
    return globdata.bar;