Prepares arguments for emitting an extract lane operation.
(
&mut self,
masm: &mut M,
kind: ExtractLaneKind,
emit: F,
)
| 541 | |
| 542 | /// Prepares arguments for emitting an extract lane operation. |
| 543 | pub fn extract_lane_op<F, M>( |
| 544 | &mut self, |
| 545 | masm: &mut M, |
| 546 | kind: ExtractLaneKind, |
| 547 | emit: F, |
| 548 | ) -> Result<()> |
| 549 | where |
| 550 | F: FnOnce(&mut M, Reg, WritableReg, ExtractLaneKind) -> Result<()>, |
| 551 | M: MacroAssembler, |
| 552 | { |
| 553 | let src = self.pop_to_reg(masm, None)?; |
| 554 | let dst = writable!(match kind { |
| 555 | ExtractLaneKind::I8x16S |
| 556 | | ExtractLaneKind::I8x16U |
| 557 | | ExtractLaneKind::I16x8S |
| 558 | | ExtractLaneKind::I16x8U |
| 559 | | ExtractLaneKind::I32x4 |
| 560 | | ExtractLaneKind::I64x2 => self.any_gpr(masm)?, |
| 561 | ExtractLaneKind::F32x4 | ExtractLaneKind::F64x2 => src.reg, |
| 562 | }); |
| 563 | |
| 564 | emit(masm, src.reg, dst, kind)?; |
| 565 | |
| 566 | match kind { |
| 567 | ExtractLaneKind::I8x16S |
| 568 | | ExtractLaneKind::I8x16U |
| 569 | | ExtractLaneKind::I16x8S |
| 570 | | ExtractLaneKind::I16x8U |
| 571 | | ExtractLaneKind::I32x4 |
| 572 | | ExtractLaneKind::I64x2 => self.free_reg(src), |
| 573 | _ => (), |
| 574 | } |
| 575 | |
| 576 | let dst = dst.to_reg(); |
| 577 | let dst = match kind { |
| 578 | ExtractLaneKind::I8x16S |
| 579 | | ExtractLaneKind::I8x16U |
| 580 | | ExtractLaneKind::I16x8S |
| 581 | | ExtractLaneKind::I16x8U |
| 582 | | ExtractLaneKind::I32x4 => TypedReg::i32(dst), |
| 583 | ExtractLaneKind::I64x2 => TypedReg::i64(dst), |
| 584 | ExtractLaneKind::F32x4 => TypedReg::f32(dst), |
| 585 | ExtractLaneKind::F64x2 => TypedReg::f64(dst), |
| 586 | }; |
| 587 | |
| 588 | self.stack.push(Val::Reg(dst)); |
| 589 | Ok(()) |
| 590 | } |
| 591 | |
| 592 | /// Prepares arguments for emitting a replace lane operation. |
| 593 | pub fn replace_lane_op<F, M>( |
no test coverage detected