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/lex.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/lex.c')
-rw-r--r-- | usr.bin/oasm/lex.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/usr.bin/oasm/lex.c b/usr.bin/oasm/lex.c index ce97400..1f58d07 100644 --- a/usr.bin/oasm/lex.c +++ b/usr.bin/oasm/lex.c @@ -57,6 +57,8 @@ static char putback = '\0'; #define S_IMN_AND "and" #define S_IMN_OR "or" #define S_IMN_XOR "xor" +#define S_IMN_LSL "lsl" +#define S_IMN_LSR "lsr" /* Instruction length */ #define OSMX64_INST_LEN 4 @@ -269,6 +271,12 @@ token_bitw(char *p) return token; } + if (strcmp(p, S_IMN_LSL) == 0) { + return TT_LSL; + } else if (strcmp(p, S_IMN_LSR) == 0) { + return TT_LSR; + } + return TT_UNKNOWN; } |