|
|
@ -203,6 +203,7 @@ where |
|
|
|
OperandSize::S32, |
|
|
|
&mut |masm: &mut M, dst, src, size| { |
|
|
|
masm.float_add(dst, dst, src, size); |
|
|
|
TypedReg::f32(dst) |
|
|
|
}, |
|
|
|
); |
|
|
|
} |
|
|
@ -213,6 +214,7 @@ where |
|
|
|
OperandSize::S64, |
|
|
|
&mut |masm: &mut M, dst, src, size| { |
|
|
|
masm.float_add(dst, dst, src, size); |
|
|
|
TypedReg::f64(dst) |
|
|
|
}, |
|
|
|
); |
|
|
|
} |
|
|
@ -223,6 +225,7 @@ where |
|
|
|
OperandSize::S32, |
|
|
|
&mut |masm: &mut M, dst, src, size| { |
|
|
|
masm.float_sub(dst, dst, src, size); |
|
|
|
TypedReg::f32(dst) |
|
|
|
}, |
|
|
|
); |
|
|
|
} |
|
|
@ -233,6 +236,7 @@ where |
|
|
|
OperandSize::S64, |
|
|
|
&mut |masm: &mut M, dst, src, size| { |
|
|
|
masm.float_sub(dst, dst, src, size); |
|
|
|
TypedReg::f64(dst) |
|
|
|
}, |
|
|
|
); |
|
|
|
} |
|
|
@ -243,6 +247,7 @@ where |
|
|
|
OperandSize::S32, |
|
|
|
&mut |masm: &mut M, dst, src, size| { |
|
|
|
masm.float_mul(dst, dst, src, size); |
|
|
|
TypedReg::f32(dst) |
|
|
|
}, |
|
|
|
); |
|
|
|
} |
|
|
@ -253,6 +258,7 @@ where |
|
|
|
OperandSize::S64, |
|
|
|
&mut |masm: &mut M, dst, src, size| { |
|
|
|
masm.float_mul(dst, dst, src, size); |
|
|
|
TypedReg::f64(dst) |
|
|
|
}, |
|
|
|
); |
|
|
|
} |
|
|
@ -263,6 +269,7 @@ where |
|
|
|
OperandSize::S32, |
|
|
|
&mut |masm: &mut M, dst, src, size| { |
|
|
|
masm.float_div(dst, dst, src, size); |
|
|
|
TypedReg::f32(dst) |
|
|
|
}, |
|
|
|
); |
|
|
|
} |
|
|
@ -273,6 +280,7 @@ where |
|
|
|
OperandSize::S64, |
|
|
|
&mut |masm: &mut M, dst, src, size| { |
|
|
|
masm.float_div(dst, dst, src, size); |
|
|
|
TypedReg::f64(dst) |
|
|
|
}, |
|
|
|
); |
|
|
|
} |
|
|
@ -283,6 +291,7 @@ where |
|
|
|
OperandSize::S32, |
|
|
|
&mut |masm: &mut M, dst, src, size| { |
|
|
|
masm.float_min(dst, dst, src, size); |
|
|
|
TypedReg::f32(dst) |
|
|
|
}, |
|
|
|
); |
|
|
|
} |
|
|
@ -293,6 +302,7 @@ where |
|
|
|
OperandSize::S64, |
|
|
|
&mut |masm: &mut M, dst, src, size| { |
|
|
|
masm.float_min(dst, dst, src, size); |
|
|
|
TypedReg::f64(dst) |
|
|
|
}, |
|
|
|
); |
|
|
|
} |
|
|
@ -303,6 +313,7 @@ where |
|
|
|
OperandSize::S32, |
|
|
|
&mut |masm: &mut M, dst, src, size| { |
|
|
|
masm.float_max(dst, dst, src, size); |
|
|
|
TypedReg::f32(dst) |
|
|
|
}, |
|
|
|
); |
|
|
|
} |
|
|
@ -313,6 +324,7 @@ where |
|
|
|
OperandSize::S64, |
|
|
|
&mut |masm: &mut M, dst, src, size| { |
|
|
|
masm.float_max(dst, dst, src, size); |
|
|
|
TypedReg::f64(dst) |
|
|
|
}, |
|
|
|
); |
|
|
|
} |
|
|
@ -323,6 +335,7 @@ where |
|
|
|
OperandSize::S32, |
|
|
|
&mut |masm: &mut M, dst, src, size| { |
|
|
|
masm.float_copysign(dst, dst, src, size); |
|
|
|
TypedReg::f32(dst) |
|
|
|
}, |
|
|
|
); |
|
|
|
} |
|
|
@ -333,6 +346,7 @@ where |
|
|
|
OperandSize::S64, |
|
|
|
&mut |masm: &mut M, dst, src, size| { |
|
|
|
masm.float_copysign(dst, dst, src, size); |
|
|
|
TypedReg::f64(dst) |
|
|
|
}, |
|
|
|
); |
|
|
|
} |
|
|
@ -341,6 +355,7 @@ where |
|
|
|
self.context |
|
|
|
.unop(self.masm, OperandSize::S32, &mut |masm, reg, size| { |
|
|
|
masm.float_abs(reg, size); |
|
|
|
TypedReg::f32(reg) |
|
|
|
}); |
|
|
|
} |
|
|
|
|
|
|
@ -348,6 +363,7 @@ where |
|
|
|
self.context |
|
|
|
.unop(self.masm, OperandSize::S64, &mut |masm, reg, size| { |
|
|
|
masm.float_abs(reg, size); |
|
|
|
TypedReg::f64(reg) |
|
|
|
}); |
|
|
|
} |
|
|
|
|
|
|
@ -355,6 +371,7 @@ where |
|
|
|
self.context |
|
|
|
.unop(self.masm, OperandSize::S32, &mut |masm, reg, size| { |
|
|
|
masm.float_neg(reg, size); |
|
|
|
TypedReg::f32(reg) |
|
|
|
}); |
|
|
|
} |
|
|
|
|
|
|
@ -362,6 +379,7 @@ where |
|
|
|
self.context |
|
|
|
.unop(self.masm, OperandSize::S64, &mut |masm, reg, size| { |
|
|
|
masm.float_neg(reg, size); |
|
|
|
TypedReg::f64(reg) |
|
|
|
}); |
|
|
|
} |
|
|
|
|
|
|
@ -409,6 +427,7 @@ where |
|
|
|
self.context |
|
|
|
.unop(self.masm, OperandSize::S32, &mut |masm, reg, size| { |
|
|
|
masm.float_sqrt(reg, reg, size); |
|
|
|
TypedReg::f32(reg) |
|
|
|
}); |
|
|
|
} |
|
|
|
|
|
|
@ -416,6 +435,7 @@ where |
|
|
|
self.context |
|
|
|
.unop(self.masm, OperandSize::S64, &mut |masm, reg, size| { |
|
|
|
masm.float_sqrt(reg, reg, size); |
|
|
|
TypedReg::f64(reg) |
|
|
|
}); |
|
|
|
} |
|
|
|
|
|
|
@ -542,36 +562,42 @@ where |
|
|
|
fn visit_i32_add(&mut self) { |
|
|
|
self.context.i32_binop(self.masm, |masm, dst, src, size| { |
|
|
|
masm.add(dst, dst, src, size); |
|
|
|
TypedReg::i32(dst) |
|
|
|
}); |
|
|
|
} |
|
|
|
|
|
|
|
fn visit_i64_add(&mut self) { |
|
|
|
self.context.i64_binop(self.masm, |masm, dst, src, size| { |
|
|
|
masm.add(dst, dst, src, size); |
|
|
|
TypedReg::i64(dst) |
|
|
|
}); |
|
|
|
} |
|
|
|
|
|
|
|
fn visit_i32_sub(&mut self) { |
|
|
|
self.context.i32_binop(self.masm, |masm, dst, src, size| { |
|
|
|
masm.sub(dst, dst, src, size); |
|
|
|
TypedReg::i32(dst) |
|
|
|
}); |
|
|
|
} |
|
|
|
|
|
|
|
fn visit_i64_sub(&mut self) { |
|
|
|
self.context.i64_binop(self.masm, |masm, dst, src, size| { |
|
|
|
masm.sub(dst, dst, src, size); |
|
|
|
TypedReg::i64(dst) |
|
|
|
}); |
|
|
|
} |
|
|
|
|
|
|
|
fn visit_i32_mul(&mut self) { |
|
|
|
self.context.i32_binop(self.masm, |masm, dst, src, size| { |
|
|
|
masm.mul(dst, dst, src, size); |
|
|
|
TypedReg::i32(dst) |
|
|
|
}); |
|
|
|
} |
|
|
|
|
|
|
|
fn visit_i64_mul(&mut self) { |
|
|
|
self.context.i64_binop(self.masm, |masm, dst, src, size| { |
|
|
|
masm.mul(dst, dst, src, size); |
|
|
|
TypedReg::i64(dst) |
|
|
|
}); |
|
|
|
} |
|
|
|
|
|
|
@ -716,6 +742,7 @@ where |
|
|
|
|
|
|
|
self.context.unop(self.masm, S32, &mut |masm, reg, size| { |
|
|
|
masm.cmp_with_set(RegImm::i32(0), reg.into(), IntCmpKind::Eq, size); |
|
|
|
TypedReg::i32(reg) |
|
|
|
}); |
|
|
|
} |
|
|
|
|
|
|
@ -724,6 +751,7 @@ where |
|
|
|
|
|
|
|
self.context.unop(self.masm, S64, &mut |masm, reg, size| { |
|
|
|
masm.cmp_with_set(RegImm::i64(0), reg.into(), IntCmpKind::Eq, size); |
|
|
|
TypedReg::i32(reg) // Return value for `i64.eqz` is an `i32`.
|
|
|
|
}); |
|
|
|
} |
|
|
|
|
|
|
@ -732,6 +760,7 @@ where |
|
|
|
|
|
|
|
self.context.unop(self.masm, S32, &mut |masm, reg, size| { |
|
|
|
masm.clz(reg, reg, size); |
|
|
|
TypedReg::i32(reg) |
|
|
|
}); |
|
|
|
} |
|
|
|
|
|
|
@ -740,6 +769,7 @@ where |
|
|
|
|
|
|
|
self.context.unop(self.masm, S64, &mut |masm, reg, size| { |
|
|
|
masm.clz(reg, reg, size); |
|
|
|
TypedReg::i64(reg) |
|
|
|
}); |
|
|
|
} |
|
|
|
|
|
|
@ -748,6 +778,7 @@ where |
|
|
|
|
|
|
|
self.context.unop(self.masm, S32, &mut |masm, reg, size| { |
|
|
|
masm.ctz(reg, reg, size); |
|
|
|
TypedReg::i32(reg) |
|
|
|
}); |
|
|
|
} |
|
|
|
|
|
|
@ -756,42 +787,49 @@ where |
|
|
|
|
|
|
|
self.context.unop(self.masm, S64, &mut |masm, reg, size| { |
|
|
|
masm.ctz(reg, reg, size); |
|
|
|
TypedReg::i64(reg) |
|
|
|
}); |
|
|
|
} |
|
|
|
|
|
|
|
fn visit_i32_and(&mut self) { |
|
|
|
self.context.i32_binop(self.masm, |masm, dst, src, size| { |
|
|
|
masm.and(dst, dst, src, size); |
|
|
|
TypedReg::i32(dst) |
|
|
|
}); |
|
|
|
} |
|
|
|
|
|
|
|
fn visit_i64_and(&mut self) { |
|
|
|
self.context.i64_binop(self.masm, |masm, dst, src, size| { |
|
|
|
masm.and(dst, dst, src, size); |
|
|
|
TypedReg::i64(dst) |
|
|
|
}); |
|
|
|
} |
|
|
|
|
|
|
|
fn visit_i32_or(&mut self) { |
|
|
|
self.context.i32_binop(self.masm, |masm, dst, src, size| { |
|
|
|
masm.or(dst, dst, src, size); |
|
|
|
TypedReg::i32(dst) |
|
|
|
}); |
|
|
|
} |
|
|
|
|
|
|
|
fn visit_i64_or(&mut self) { |
|
|
|
self.context.i64_binop(self.masm, |masm, dst, src, size| { |
|
|
|
masm.or(dst, dst, src, size); |
|
|
|
TypedReg::i64(dst) |
|
|
|
}); |
|
|
|
} |
|
|
|
|
|
|
|
fn visit_i32_xor(&mut self) { |
|
|
|
self.context.i32_binop(self.masm, |masm, dst, src, size| { |
|
|
|
masm.xor(dst, dst, src, size); |
|
|
|
TypedReg::i32(dst) |
|
|
|
}); |
|
|
|
} |
|
|
|
|
|
|
|
fn visit_i64_xor(&mut self) { |
|
|
|
self.context.i64_binop(self.masm, |masm, dst, src, size| { |
|
|
|
masm.xor(dst, dst, src, size); |
|
|
|
TypedReg::i64(dst) |
|
|
|
}); |
|
|
|
} |
|
|
|
|
|
|
@ -1368,6 +1406,7 @@ where |
|
|
|
fn cmp_i32s(&mut self, kind: IntCmpKind) { |
|
|
|
self.context.i32_binop(self.masm, |masm, dst, src, size| { |
|
|
|
masm.cmp_with_set(src, dst, kind, size); |
|
|
|
TypedReg::i32(dst) |
|
|
|
}); |
|
|
|
} |
|
|
|
|
|
|
@ -1375,6 +1414,7 @@ where |
|
|
|
self.context |
|
|
|
.i64_binop(self.masm, move |masm, dst, src, size| { |
|
|
|
masm.cmp_with_set(src, dst, kind, size); |
|
|
|
TypedReg::i32(dst) // Return value for comparisons is an `i32`.
|
|
|
|
}); |
|
|
|
} |
|
|
|
} |
|
|
|