zingen/masm/integer.rs
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132
// Integer instructions
use crate::{wasm::ToLSBytes, MacroAssembler, Result};
use wasmparser::{Ieee32, Ieee64};
impl MacroAssembler {
/// Sub two numbers.
pub fn _sub(&mut self) -> Result<()> {
self._swap1()?;
self.asm._sub()
}
/// Push a 32-bit integer value on the stack.
pub fn _i32_const(&mut self, value: i32) -> Result<()> {
if value == 0 {
self._push0()
} else {
self.push(value.to_ls_bytes().as_ref())
}
}
/// Push a 64-bit integer value on the stack.
pub fn _i64_const(&mut self, value: i64) -> Result<()> {
if value == 0 {
self._push0()
} else {
self.push(value.to_ls_bytes().as_ref())
}
}
/// Push a 32-bit float value on the stack.
pub fn _f32_const(&mut self, _value: Ieee32) -> Result<()> {
todo!()
}
/// Push a 64-bit float value on the stack.
pub fn _f64_const(&mut self, _value: Ieee64) -> Result<()> {
todo!()
}
/// wrap a 64-bit integer to a 32-bit integer.
pub fn _i32_wrap_i64(&mut self) -> Result<()> {
todo!()
}
/// Extend a signed 32-bit integer to a 64-bit integer.
pub fn _i64_extend_i32_s(&mut self) -> Result<()> {
todo!()
}
/// Extend an unsigned 32-bit integer to a 64-bit integer.
pub fn _i64_extend_i32_u(&mut self) -> Result<()> {
todo!()
}
/// Truncate a 64-bit float to a signed 32-bit integer.
pub fn _f32_demote_f64(&mut self) -> Result<()> {
todo!()
}
/// Truncate a 64-bit float to an unsigned 32-bit integer.
pub fn _f64_promote_f32(&mut self) -> Result<()> {
todo!()
}
/// Convert a signed 32-bit integer to a 32-bit float.
pub fn _i32_reinterpret_f32(&mut self) -> Result<()> {
todo!()
}
/// Convert a signed 64-bit integer to a 64-bit float.
pub fn _i64_reinterpret_f64(&mut self) -> Result<()> {
todo!()
}
/// Convert a 32-bit float to a signed 32-bit integer.
pub fn _f32_reinterpret_i32(&mut self) -> Result<()> {
todo!()
}
/// Convert a 64-bit float to a signed 64-bit integer.
pub fn _f64_reinterpret_i64(&mut self) -> Result<()> {
todo!()
}
/// sign-agnostic rotate left
///
/// Return the result of rotating i1 left by k bits.
pub fn _rotl(&mut self) -> Result<()> {
todo!()
}
/// sign-agnostic rotate right
///
/// Return the result of rotating i1 right by k bits.
pub fn _rotr(&mut self) -> Result<()> {
todo!()
}
/// sign-agnostic count leading zero bits
///
/// Return the number of leading zero bits in i, all zero bits
/// are considered leading if the value is zero.
pub fn _clz(&mut self) -> Result<()> {
todo!()
}
/// sign-agnostic count leading zero bits
///
/// Return the number of leading zero bits in i, all zero bits
/// are considered trailing if the value is zero.
pub fn _ctz(&mut self) -> Result<()> {
todo!()
}
/// sign-agnostic count number of one bits
///
/// Return the count of no zero bits in i.
pub fn _popcnt(&mut self) -> Result<()> {
todo!()
}
/// Truncate a 32-bit float to an integer
pub fn _trunc_f32(&mut self) -> Result<()> {
todo!()
}
/// Truncate a 64-bit float to an integer
pub fn _trunc_f64(&mut self) -> Result<()> {
todo!()
}
}