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

Method visit_select

winch/codegen/src/visitor.rs:2098–2116  ·  view source on GitHub ↗
(&mut self)

Source from the content-addressed store, hash-verified

2096 }
2097
2098 fn visit_select(&mut self) -> Self::Output {
2099 let cond = self.context.pop_to_reg(self.masm, None)?;
2100 let val2 = self.context.pop_to_reg(self.masm, None)?;
2101 let val1 = self.context.pop_to_reg(self.masm, None)?;
2102 self.masm.cmp(cond.reg, RegImm::i32(0), OperandSize::S32)?;
2103 // Conditionally move val1 to val2 if the comparison is
2104 // not zero.
2105 self.masm.cmov(
2106 writable!(val2.into()),
2107 val1.into(),
2108 IntCmpKind::Ne,
2109 val1.ty.try_into()?,
2110 )?;
2111 self.context.stack.push(val2.into());
2112 self.context.free_reg(val1.reg);
2113 self.context.free_reg(cond);
2114
2115 Ok(())
2116 }
2117
2118 fn visit_typed_select(&mut self, _ty: ValType) -> Self::Output {
2119 self.visit_select()

Callers 1

visit_typed_selectMethod · 0.80

Calls 7

OkFunction · 0.85
pop_to_regMethod · 0.80
free_regMethod · 0.80
cmpMethod · 0.45
cmovMethod · 0.45
try_intoMethod · 0.45
pushMethod · 0.45

Tested by

no test coverage detected