diff options
author | Ian Moffett <ian@osmora.org> | 2025-07-30 16:34:48 -0400 |
---|---|---|
committer | Ian Moffett <ian@osmora.org> | 2025-07-30 16:34:48 -0400 |
commit | caa652ae2b3da86de945fa8d5ece55ddbbb2cf31 (patch) | |
tree | d0154134b1130f7d43037b319b107cf76e6b2bc3 /usr.bin/oasm/parse.c | |
parent | 2d1097e8a1ecffd09cd6810978b876f8c8cdb16f (diff) |
oasm: Introduce logical shift operations
This commit introduces LSR/LSL which are used as bitwise shift
operations.
--
lsr x1, #1 !! x1 >>= 1
lsl x1, #1 !! x1 <<= 1
--
Signed-off-by: Ian Moffett <ian@osmora.org>
Diffstat (limited to 'usr.bin/oasm/parse.c')
-rw-r--r-- | usr.bin/oasm/parse.c | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/usr.bin/oasm/parse.c b/usr.bin/oasm/parse.c index ce5a446..042cce8 100644 --- a/usr.bin/oasm/parse.c +++ b/usr.bin/oasm/parse.c @@ -51,7 +51,9 @@ static const char *tokstr[] = { [ TT_DEC ] = "dec", [ TT_MOV ] = "mov", [ TT_IMM ] = "<imm>", - [ TT_LABEL] = "<label>", + [ TT_LABEL ] = "<label>", + [ TT_LSR ] = "lsr", + [ TT_LSL ] = "lsl", /* Bitwise */ [ TT_MROB ] = "mrob", @@ -129,6 +131,8 @@ parse_reg(struct oasm_state *state, struct oasm_token *tok) case TT_AND: case TT_OR: case TT_XOR: + case TT_LSR: + case TT_LSL: state->last = tok->type; break; default: @@ -195,6 +199,14 @@ parse_tok(struct oasm_state *state, struct oasm_token *tok) state->last = tok->type; emit_osmx64(&emit_state, tok); break; + case TT_LSR: + state->last = tok->type; + emit_osmx64(&emit_state, tok); + break; + case TT_LSL: + state->last = tok->type; + emit_osmx64(&emit_state, tok); + break; case TT_MOV: state->last = tok->type; emit_osmx64(&emit_state, tok); |