From effbb5ce401d3c8f78ff5465683a1bcd4a68c0b6 Mon Sep 17 00:00:00 2001 From: Ian Moffett Date: Sun, 27 Jul 2025 23:13:06 -0400 Subject: oasm: Introduce OR mnemonic Implement mnemonic for the OR instruction: -- or x2, #3 ! x2 = x2 | 3 -- Signed-off-by: Ian Moffett --- usr.bin/oasm/emit.c | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'usr.bin/oasm/emit.c') diff --git a/usr.bin/oasm/emit.c b/usr.bin/oasm/emit.c index ea14cce..ebbd824 100644 --- a/usr.bin/oasm/emit.c +++ b/usr.bin/oasm/emit.c @@ -393,6 +393,13 @@ emit_encode_bitw(struct emit_state *state, struct oasm_token *tok) uint8_t opcode = OSMX64_AND; char *inst_str = "and"; + switch (tok->type) { + case TT_OR: + opcode = OSMX64_OR; + inst_str = "or"; + break; + } + /* Next token should be a register */ tok = TAILQ_NEXT(tok, link); if (tok == NULL) { @@ -519,6 +526,7 @@ emit_process(struct oasm_state *oasm, struct emit_state *emit) curtok = emit_encode_arith(emit, curtok); break; case TT_AND: + case TT_OR: curtok = emit_encode_bitw(emit, curtok); break; case TT_BR: -- cgit v1.2.3