Skip to content

Commit

Permalink
Winch: Rename v128 extend kind enum (#10166)
Browse files Browse the repository at this point in the history
  • Loading branch information
jeffcharles authored Jan 31, 2025
1 parent f6c8d73 commit a0338af
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 26 deletions.
16 changes: 8 additions & 8 deletions winch/codegen/src/isa/x64/asm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use crate::{
isa::{reg::Reg, CallingConvention},
masm::{
DivKind, Extend, ExtendKind, ExtendType, IntCmpKind, MulWideKind, OperandSize, RemKind,
RoundingMode, ShiftKind, Signed, VectorExtendKind, Zero,
RoundingMode, ShiftKind, Signed, V128LoadExtendKind, Zero,
},
reg::writable,
x64::regs::scratch,
Expand Down Expand Up @@ -497,18 +497,18 @@ impl Assembler {
&mut self,
src: &Address,
dst: WritableReg,
ext: VectorExtendKind,
ext: V128LoadExtendKind,
flags: MemFlags,
) {
assert!(dst.to_reg().is_float());

let op = match ext {
VectorExtendKind::V128Extend8x8S => AvxOpcode::Vpmovsxbw,
VectorExtendKind::V128Extend8x8U => AvxOpcode::Vpmovzxbw,
VectorExtendKind::V128Extend16x4S => AvxOpcode::Vpmovsxwd,
VectorExtendKind::V128Extend16x4U => AvxOpcode::Vpmovzxwd,
VectorExtendKind::V128Extend32x2S => AvxOpcode::Vpmovsxdq,
VectorExtendKind::V128Extend32x2U => AvxOpcode::Vpmovzxdq,
V128LoadExtendKind::E8x8S => AvxOpcode::Vpmovsxbw,
V128LoadExtendKind::E8x8U => AvxOpcode::Vpmovzxbw,
V128LoadExtendKind::E16x4S => AvxOpcode::Vpmovsxwd,
V128LoadExtendKind::E16x4U => AvxOpcode::Vpmovzxwd,
V128LoadExtendKind::E32x2S => AvxOpcode::Vpmovsxdq,
V128LoadExtendKind::E32x2U => AvxOpcode::Vpmovzxdq,
};

let src = Self::to_synthetic_amode(
Expand Down
22 changes: 11 additions & 11 deletions winch/codegen/src/masm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -287,23 +287,23 @@ impl ExtendKind {
}
}

/// Kinds of vector extends in WebAssembly. Each MacroAssembler implementation
/// is responsible for emitting the correct sequence of instructions when
/// lowering to machine code.
/// Kinds of vector load and extends in WebAssembly. Each MacroAssembler
/// implementation is responsible for emitting the correct sequence of
/// instructions when lowering to machine code.
#[derive(Copy, Clone)]
pub(crate) enum VectorExtendKind {
pub(crate) enum V128LoadExtendKind {
/// Sign extends eight 8 bit integers to eight 16 bit lanes.
V128Extend8x8S,
E8x8S,
/// Zero extends eight 8 bit integers to eight 16 bit lanes.
V128Extend8x8U,
E8x8U,
/// Sign extends four 16 bit integers to four 32 bit lanes.
V128Extend16x4S,
E16x4S,
/// Zero extends four 16 bit integers to four 32 bit lanes.
V128Extend16x4U,
E16x4U,
/// Sign extends two 32 bit integers to two 64 bit lanes.
V128Extend32x2S,
E32x2S,
/// Zero extends two 32 bit integers to two 64 bit lanes.
V128Extend32x2U,
E32x2U,
}

/// Kinds of splat loads supported by WebAssembly.
Expand Down Expand Up @@ -431,7 +431,7 @@ pub(crate) enum LoadKind {
/// Scalar (non-vector) extend.
ScalarExtend(ExtendKind),
/// Vector extend.
VectorExtend(VectorExtendKind),
VectorExtend(V128LoadExtendKind),
/// Load content into select lane.
VectorLane(LaneSelector),
}
Expand Down
14 changes: 7 additions & 7 deletions winch/codegen/src/visitor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ use crate::masm::{
DivKind, Extend, ExtractLaneKind, FloatCmpKind, IntCmpKind, LoadKind, MacroAssembler,
MemMoveDirection, MulWideKind, OperandSize, RegImm, RemKind, ReplaceLaneKind, RmwOp,
RoundingMode, SPOffset, ShiftKind, Signed, SplatKind, SplatLoadKind, StoreKind, TruncKind,
VectorCompareKind, VectorEqualityKind, VectorExtendKind, Zero,
V128LoadExtendKind, VectorCompareKind, VectorEqualityKind, Zero,
};

use crate::reg::{writable, Reg};
Expand Down Expand Up @@ -2790,47 +2790,47 @@ where
self.emit_wasm_load(
&memarg,
WasmValType::V128,
LoadKind::VectorExtend(VectorExtendKind::V128Extend8x8S),
LoadKind::VectorExtend(V128LoadExtendKind::E8x8S),
)
}

fn visit_v128_load8x8_u(&mut self, memarg: MemArg) -> Self::Output {
self.emit_wasm_load(
&memarg,
WasmValType::V128,
LoadKind::VectorExtend(VectorExtendKind::V128Extend8x8U),
LoadKind::VectorExtend(V128LoadExtendKind::E8x8U),
)
}

fn visit_v128_load16x4_s(&mut self, memarg: MemArg) -> Self::Output {
self.emit_wasm_load(
&memarg,
WasmValType::V128,
LoadKind::VectorExtend(VectorExtendKind::V128Extend16x4S),
LoadKind::VectorExtend(V128LoadExtendKind::E16x4S),
)
}

fn visit_v128_load16x4_u(&mut self, memarg: MemArg) -> Self::Output {
self.emit_wasm_load(
&memarg,
WasmValType::V128,
LoadKind::VectorExtend(VectorExtendKind::V128Extend16x4U),
LoadKind::VectorExtend(V128LoadExtendKind::E16x4U),
)
}

fn visit_v128_load32x2_s(&mut self, memarg: MemArg) -> Self::Output {
self.emit_wasm_load(
&memarg,
WasmValType::V128,
LoadKind::VectorExtend(VectorExtendKind::V128Extend32x2S),
LoadKind::VectorExtend(V128LoadExtendKind::E32x2S),
)
}

fn visit_v128_load32x2_u(&mut self, memarg: MemArg) -> Self::Output {
self.emit_wasm_load(
&memarg,
WasmValType::V128,
LoadKind::VectorExtend(VectorExtendKind::V128Extend32x2U),
LoadKind::VectorExtend(V128LoadExtendKind::E32x2U),
)
}

Expand Down

0 comments on commit a0338af

Please sign in to comment.