From caa652ae2b3da86de945fa8d5ece55ddbbb2cf31 Mon Sep 17 00:00:00 2001 From: Ian Moffett Date: Wed, 30 Jul 2025 16:34:48 -0400 Subject: 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 --- usr.bin/oasm/emit.c | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'usr.bin/oasm/emit.c') 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: -- cgit v1.2.3