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/emit.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/emit.c')
-rw-r--r-- | usr.bin/oasm/emit.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/usr.bin/oasm/emit.c b/usr.bin/oasm/emit.c index 63f716a..099f0b2 100644 --- a/usr.bin/oasm/emit.c +++ b/usr.bin/oasm/emit.c @@ -402,6 +402,14 @@ emit_encode_bitw(struct emit_state *state, struct oasm_token *tok) opcode = OSMX64_XOR; inst_str = "xor"; break; + case TT_LSR: + opcode = OSMX64_LSR; + inst_str = "lsr"; + break; + case TT_LSL: + opcode = OSMX64_LSL; + inst_str = "lsl"; + break; } /* Next token should be a register */ @@ -532,6 +540,8 @@ emit_process(struct oasm_state *oasm, struct emit_state *emit) case TT_AND: case TT_OR: case TT_XOR: + case TT_LSR: + case TT_LSL: curtok = emit_encode_bitw(emit, curtok); break; case TT_BR: |