aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/codegen.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/codegen.c')
-rw-r--r--src/codegen.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/codegen.c b/src/codegen.c
index 716660d..cc3f9a7 100644
--- a/src/codegen.c
+++ b/src/codegen.c
@@ -292,6 +292,18 @@ static void codegen_assign_expr_helper(CodeGen* g, AstNode* ast) {
fprintf(g->out, " cqo\n");
fprintf(g->out, " idiv rdi\n");
fprintf(g->out, " mov rax, rdx\n");
+ } else if (ast->node_op == TokenKind_assign_or) {
+ fprintf(g->out, " or rax, rdi\n");
+ } else if (ast->node_op == TokenKind_assign_and) {
+ fprintf(g->out, " and rax, rdi\n");
+ } else if (ast->node_op == TokenKind_assign_xor) {
+ fprintf(g->out, " xor rax, rdi\n");
+ } else if (ast->node_op == TokenKind_assign_lshift) {
+ fprintf(g->out, " mov rcx, rdi\n");
+ fprintf(g->out, " shl rax, cl\n");
+ } else if (ast->node_op == TokenKind_assign_rshift) {
+ fprintf(g->out, " mov rcx, rdi\n");
+ fprintf(g->out, " sar rax, cl\n");
} else {
unreachable();
}