commit 388764d5d9b81f65b591e7ff8dd8c187b4c7fd5f from: Benjamin Stürz date: Wed Oct 02 18:31:21 2024 UTC irc: add support for negative EX_INT commit - f5b4351d0b7b927bdca9c46bd239eed63cdf1fac commit + 388764d5d9b81f65b591e7ff8dd8c187b4c7fd5f blob - d955cd56ace44687676d3abbf3a5fe8e0cb19a49 blob + 21693e9db5bb1de3fd4b22b864482179dc333c5e --- cc/irc/irc.c +++ cc/irc/irc.c @@ -159,6 +159,11 @@ begin: nextch (); parse_int (); return TK_REG; + case '-': + nextch (); + parse_int (); + lval.i = -lval.i; + return TK_INT; case '(': case ')': case '{': @@ -1854,7 +1859,6 @@ struct expr *e; break; } break; - // TODO: shifts case EX_LSL: shift (fn, "shl", &fn->regs[e->bin.l], &e->bin.r); break; blob - a40799c281aab31dd6a69cef7462f958a03f0ecd blob + f40174905a6499ded17706cc59a6777e9c9f3b50 --- cc/irc/test.ir +++ cc/irc/test.ir @@ -183,3 +183,7 @@ fn qdiv ($0: qword, $1: qword): qword { let $4: qword = add $2, $3; ret $4; } + +fn negative (): qword { + ret -1; +}