MCPcopy Create free account
hub / github.com/bytecodealliance/wasmtime / replace_lane_op

Method replace_lane_op

winch/codegen/src/codegen/context.rs:593–626  ·  view source on GitHub ↗

Prepares arguments for emitting a replace lane operation.

(
        &mut self,
        masm: &mut M,
        kind: ReplaceLaneKind,
        emit: F,
    )

Source from the content-addressed store, hash-verified

591
592 /// Prepares arguments for emitting a replace lane operation.
593 pub fn replace_lane_op<F, M>(
594 &mut self,
595 masm: &mut M,
596 kind: ReplaceLaneKind,
597 emit: F,
598 ) -> Result<()>
599 where
600 F: FnOnce(&mut M, RegImm, WritableReg, ReplaceLaneKind) -> Result<()>,
601 M: MacroAssembler,
602 {
603 let src = match kind {
604 ReplaceLaneKind::I8x16 | ReplaceLaneKind::I16x8 | ReplaceLaneKind::I32x4 => {
605 self.pop_i32_const().map(RegImm::i32)
606 }
607 ReplaceLaneKind::I64x2 => self.pop_i64_const().map(RegImm::i64),
608 ReplaceLaneKind::F32x4 => self.pop_f32_const().map(|v| RegImm::f32(v.bits())),
609 ReplaceLaneKind::F64x2 => self.pop_f64_const().map(|v| RegImm::f64(v.bits())),
610 }
611 .map_or_else(
612 || Ok(RegImm::reg(self.pop_to_reg(masm, None)?.into())),
613 Ok::<_, crate::Error>,
614 )?;
615
616 let dst = self.pop_to_reg(masm, None)?;
617
618 emit(masm, src, writable!(dst.into()), kind)?;
619
620 if let RegImm::Reg(reg) = src {
621 self.free_reg(reg);
622 }
623 self.stack.push(dst.into());
624
625 Ok(())
626 }
627
628 /// Drops the last `n` elements of the stack, calling the provided
629 /// function for each `n` stack value.

Calls 11

OkFunction · 0.85
emitFunction · 0.85
pop_to_regMethod · 0.80
free_regMethod · 0.80
mapMethod · 0.45
pop_i32_constMethod · 0.45
pop_i64_constMethod · 0.45
pop_f32_constMethod · 0.45
bitsMethod · 0.45
pop_f64_constMethod · 0.45
pushMethod · 0.45

Tested by

no test coverage detected