Skip to content

Commit 177a12d

Browse files
committed
WASM_X64: Support I32Shl() and I32ShrS()
1 parent a045849 commit 177a12d

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

src/libasr/codegen/wasm_to_x64.cpp

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -309,6 +309,19 @@ class X64Visitor : public WASMDecoder<X64Visitor>,
309309
handleI32Opt([&](){ m_a.asm_xor_r64_r64(X64Reg::rax, X64Reg::rbx);});
310310
}
311311

312+
void visit_I32Shl() {
313+
m_a.asm_pop_r64(X64Reg::rcx);
314+
m_a.asm_pop_r64(X64Reg::rax);
315+
m_a.asm_shl_r64_cl(X64Reg::rax);
316+
m_a.asm_push_r64(X64Reg::rax);
317+
}
318+
void visit_I32ShrS() {
319+
m_a.asm_pop_r64(X64Reg::rcx);
320+
m_a.asm_pop_r64(X64Reg::rax);
321+
m_a.asm_sar_r64_cl(X64Reg::rax);
322+
m_a.asm_push_r64(X64Reg::rax);
323+
}
324+
312325
void visit_I32Eqz() {
313326
m_a.asm_mov_r64_imm64(X64Reg::rax, 0);
314327
m_a.asm_push_r64(X64Reg::rax);

0 commit comments

Comments
 (0)