Skip to content

Commit

Permalink
[simd/jit]: Implement simple i32x4 arithmetic operations
Browse files Browse the repository at this point in the history
  • Loading branch information
haoyu-zc committed Jul 17, 2023
1 parent 991d10b commit 8add5df
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/engine/x86-64/X86_64SinglePassCompiler.v3
Original file line number Diff line number Diff line change
Expand Up @@ -464,13 +464,20 @@ class X86_64SinglePassCompiler extends SinglePassCompiler {
def visit_I8X16_ADD() { do_op2_x_x(ValueKind.V128, asm.paddb_s_s); }
def visit_I8X16_SUB() { do_op2_x_x(ValueKind.V128, asm.psubb_s_s); }

def visit_I32X4_ADD() { do_op2_x_x(ValueKind.V128, asm.paddd_s_s); }
def visit_I32X4_SUB() { do_op2_x_x(ValueKind.V128, asm.psubd_s_s); }
def visit_I32X4_MUL() { do_op2_x_x(ValueKind.V128, asm.pmulld_s_s); }

private def visit_V128_NEG<T>(emit: (X86_64Xmmr, X86_64Xmmr) -> T) -> void {
var sv = popReg(), r = X(sv.reg);
var tmp = allocTmp(ValueKind.V128), t = X(tmp);
emit(r, t);
state.push(sv.kindFlagsMatching(ValueKind.V128, IN_REG), sv.reg, 0);
}
def visit_I8X16_NEG() { visit_V128_NEG(mmasm.emit_i8x16_neg); }

def visit_I32X4_NEG() { visit_V128_NEG(mmasm.emit_i32x4_neg); }

def visit_V128_BITSELECT() {
var c = popReg();
var b = popReg();
Expand Down

0 comments on commit 8add5df

Please sign in to comment.