Rename Uimm128 to V128Imm
This commit is contained in:
@@ -290,13 +290,13 @@ impl FromStr for Uimm32 {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// A 128-bit unsigned integer immediate operand.
|
/// A 128-bit immediate operand.
|
||||||
///
|
///
|
||||||
/// This is used as an immediate value in SIMD instructions.
|
/// This is used as an immediate value in SIMD instructions.
|
||||||
#[derive(Copy, Clone, PartialEq, Eq, Debug, Hash)]
|
#[derive(Copy, Clone, PartialEq, Eq, Debug, Hash)]
|
||||||
pub struct Uimm128(pub [u8; 16]);
|
pub struct V128Imm(pub [u8; 16]);
|
||||||
|
|
||||||
impl Uimm128 {
|
impl V128Imm {
|
||||||
/// Iterate over the bytes in the constant
|
/// Iterate over the bytes in the constant
|
||||||
pub fn bytes(&self) -> impl Iterator<Item = &u8> {
|
pub fn bytes(&self) -> impl Iterator<Item = &u8> {
|
||||||
self.0.iter()
|
self.0.iter()
|
||||||
@@ -313,7 +313,7 @@ impl Uimm128 {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Display for Uimm128 {
|
impl Display for V128Imm {
|
||||||
// Print a 128-bit vector in hexadecimal, e.g. 0x000102030405060708090a0b0c0d0e0f.
|
// Print a 128-bit vector in hexadecimal, e.g. 0x000102030405060708090a0b0c0d0e0f.
|
||||||
fn fmt(&self, f: &mut Formatter) -> fmt::Result {
|
fn fmt(&self, f: &mut Formatter) -> fmt::Result {
|
||||||
write!(f, "0x")?;
|
write!(f, "0x")?;
|
||||||
@@ -333,24 +333,24 @@ impl Display for Uimm128 {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl From<u64> for Uimm128 {
|
impl From<u64> for V128Imm {
|
||||||
fn from(x: u64) -> Self {
|
fn from(x: u64) -> Self {
|
||||||
let mut buffer: [u8; 16] = [0; 16]; // zero-fill
|
let mut buffer: [u8; 16] = [0; 16]; // zero-fill
|
||||||
(0..8).for_each(|byte| buffer[byte] = (x >> (byte as u64 * 8) & 0xff) as u8); // insert each byte from the u64 into v in little-endian order
|
(0..8).for_each(|byte| buffer[byte] = (x >> (byte as u64 * 8) & 0xff) as u8); // insert each byte from the u64 into v in little-endian order
|
||||||
Uimm128(buffer)
|
V128Imm(buffer)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl From<&[u8]> for Uimm128 {
|
impl From<&[u8]> for V128Imm {
|
||||||
fn from(slice: &[u8]) -> Self {
|
fn from(slice: &[u8]) -> Self {
|
||||||
assert_eq!(slice.len(), 16);
|
assert_eq!(slice.len(), 16);
|
||||||
let mut buffer = [0; 16];
|
let mut buffer = [0; 16];
|
||||||
buffer.copy_from_slice(slice);
|
buffer.copy_from_slice(slice);
|
||||||
Uimm128(buffer)
|
V128Imm(buffer)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl FromStr for Uimm128 {
|
impl FromStr for V128Imm {
|
||||||
type Err = &'static str;
|
type Err = &'static str;
|
||||||
|
|
||||||
// parse a 128-bit vector from a hexadecimal string, formatted as above
|
// parse a 128-bit vector from a hexadecimal string, formatted as above
|
||||||
@@ -384,7 +384,7 @@ impl FromStr for Uimm128 {
|
|||||||
position = position.wrapping_sub(1); // should only wrap on the last iteration
|
position = position.wrapping_sub(1); // should only wrap on the last iteration
|
||||||
}
|
}
|
||||||
|
|
||||||
Ok(Uimm128(buffer))
|
Ok(V128Imm(buffer))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -396,7 +396,7 @@ impl FromStr for Uimm128 {
|
|||||||
/// - this requires the input type (i.e. $ty) to implement ToBytes
|
/// - this requires the input type (i.e. $ty) to implement ToBytes
|
||||||
macro_rules! construct_uimm128_from_iterator_of {
|
macro_rules! construct_uimm128_from_iterator_of {
|
||||||
( $ty:ident, $lanes:expr ) => {
|
( $ty:ident, $lanes:expr ) => {
|
||||||
impl FromIterator<$ty> for Uimm128 {
|
impl FromIterator<$ty> for V128Imm {
|
||||||
fn from_iter<T: IntoIterator<Item = $ty>>(iter: T) -> Self {
|
fn from_iter<T: IntoIterator<Item = $ty>>(iter: T) -> Self {
|
||||||
let mut buffer: [u8; 16] = [0; 16];
|
let mut buffer: [u8; 16] = [0; 16];
|
||||||
iter.into_iter()
|
iter.into_iter()
|
||||||
@@ -405,14 +405,14 @@ macro_rules! construct_uimm128_from_iterator_of {
|
|||||||
.flat_map(|b| b)
|
.flat_map(|b| b)
|
||||||
.enumerate()
|
.enumerate()
|
||||||
.for_each(|(i, b)| buffer[i] = b);
|
.for_each(|(i, b)| buffer[i] = b);
|
||||||
Uimm128(buffer)
|
V128Imm(buffer)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Special case for booleans since we have to decide the bit-width based on the number of items
|
/// Special case for booleans since we have to decide the bit-width based on the number of items
|
||||||
impl FromIterator<bool> for Uimm128 {
|
impl FromIterator<bool> for V128Imm {
|
||||||
fn from_iter<T: IntoIterator<Item = bool>>(iter: T) -> Self {
|
fn from_iter<T: IntoIterator<Item = bool>>(iter: T) -> Self {
|
||||||
let bools = Vec::from_iter(iter);
|
let bools = Vec::from_iter(iter);
|
||||||
let count = bools.len();
|
let count = bools.len();
|
||||||
@@ -425,7 +425,7 @@ impl FromIterator<bool> for Uimm128 {
|
|||||||
.enumerate()
|
.enumerate()
|
||||||
.map(|(i, &b)| (i * step, if b { 1 } else { 0 }))
|
.map(|(i, &b)| (i * step, if b { 1 } else { 0 }))
|
||||||
.for_each(|(i, b)| buffer[i] = b);
|
.for_each(|(i, b)| buffer[i] = b);
|
||||||
Uimm128(buffer)
|
V128Imm(buffer)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1069,51 +1069,51 @@ mod tests {
|
|||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn format_uimm128() {
|
fn format_uimm128() {
|
||||||
assert_eq!(Uimm128::from(0).to_string(), "0x00");
|
assert_eq!(V128Imm::from(0).to_string(), "0x00");
|
||||||
assert_eq!(Uimm128::from(42).to_string(), "0x2a");
|
assert_eq!(V128Imm::from(42).to_string(), "0x2a");
|
||||||
assert_eq!(Uimm128::from(3735928559).to_string(), "0xdeadbeef");
|
assert_eq!(V128Imm::from(3735928559).to_string(), "0xdeadbeef");
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
Uimm128::from(0x0102030405060708).to_string(),
|
V128Imm::from(0x0102030405060708).to_string(),
|
||||||
"0x0102030405060708"
|
"0x0102030405060708"
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn parse_uimm128() {
|
fn parse_uimm128() {
|
||||||
parse_ok::<Uimm128>("0x00", "0x00");
|
parse_ok::<V128Imm>("0x00", "0x00");
|
||||||
parse_ok::<Uimm128>("0x00000042", "0x42");
|
parse_ok::<V128Imm>("0x00000042", "0x42");
|
||||||
parse_ok::<Uimm128>(
|
parse_ok::<V128Imm>(
|
||||||
"0x0102030405060708090a0b0c0d0e0f00",
|
"0x0102030405060708090a0b0c0d0e0f00",
|
||||||
"0x0102030405060708090a0b0c0d0e0f00",
|
"0x0102030405060708090a0b0c0d0e0f00",
|
||||||
);
|
);
|
||||||
parse_ok::<Uimm128>("0x_0000_0043_21", "0x4321");
|
parse_ok::<V128Imm>("0x_0000_0043_21", "0x4321");
|
||||||
|
|
||||||
parse_err::<Uimm128>("", "Expected a hexadecimal string, e.g. 0x1234");
|
parse_err::<V128Imm>("", "Expected a hexadecimal string, e.g. 0x1234");
|
||||||
parse_err::<Uimm128>("0x", "Expected a hexadecimal string, e.g. 0x1234");
|
parse_err::<V128Imm>("0x", "Expected a hexadecimal string, e.g. 0x1234");
|
||||||
parse_err::<Uimm128>(
|
parse_err::<V128Imm>(
|
||||||
"0x042",
|
"0x042",
|
||||||
"Hexadecimal string must have an even number of digits",
|
"Hexadecimal string must have an even number of digits",
|
||||||
);
|
);
|
||||||
parse_err::<Uimm128>(
|
parse_err::<V128Imm>(
|
||||||
"0x00000000000000000000000000000000000000000000000000",
|
"0x00000000000000000000000000000000000000000000000000",
|
||||||
"Hexadecimal string has too many digits to fit in a 128-bit vector",
|
"Hexadecimal string has too many digits to fit in a 128-bit vector",
|
||||||
);
|
);
|
||||||
parse_err::<Uimm128>("0xrstu", "Unable to parse as hexadecimal");
|
parse_err::<V128Imm>("0xrstu", "Unable to parse as hexadecimal");
|
||||||
parse_err::<Uimm128>("0x__", "Hexadecimal string must have some digits");
|
parse_err::<V128Imm>("0x__", "Hexadecimal string must have some digits");
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn uimm128_equivalence() {
|
fn uimm128_equivalence() {
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
"0x01".parse::<Uimm128>().unwrap().0,
|
"0x01".parse::<V128Imm>().unwrap().0,
|
||||||
[1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
|
[1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
|
||||||
);
|
);
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
Uimm128::from_iter(vec![1, 0, 0, 0]).0,
|
V128Imm::from_iter(vec![1, 0, 0, 0]).0,
|
||||||
[1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
|
[1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
|
||||||
);
|
);
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
Uimm128::from(1).0,
|
V128Imm::from(1).0,
|
||||||
[1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
|
[1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -1121,19 +1121,19 @@ mod tests {
|
|||||||
#[test]
|
#[test]
|
||||||
fn uimm128_endianness() {
|
fn uimm128_endianness() {
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
"0x42".parse::<Uimm128>().unwrap().0,
|
"0x42".parse::<V128Imm>().unwrap().0,
|
||||||
[0x42, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
|
[0x42, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
|
||||||
);
|
);
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
"0x00".parse::<Uimm128>().unwrap().0,
|
"0x00".parse::<V128Imm>().unwrap().0,
|
||||||
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
|
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
|
||||||
);
|
);
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
"0x12345678".parse::<Uimm128>().unwrap().0,
|
"0x12345678".parse::<V128Imm>().unwrap().0,
|
||||||
[0x78, 0x56, 0x34, 0x12, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
|
[0x78, 0x56, 0x34, 0x12, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
|
||||||
);
|
);
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
"0x1234_5678".parse::<Uimm128>().unwrap().0,
|
"0x1234_5678".parse::<V128Imm>().unwrap().0,
|
||||||
[0x78, 0x56, 0x34, 0x12, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
|
[0x78, 0x56, 0x34, 0x12, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -1141,17 +1141,17 @@ mod tests {
|
|||||||
#[test]
|
#[test]
|
||||||
fn uimm128_from_iter() {
|
fn uimm128_from_iter() {
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
Uimm128::from_iter(vec![4, 3, 2, 1]).0,
|
V128Imm::from_iter(vec![4, 3, 2, 1]).0,
|
||||||
[4, 0, 0, 0, 3, 0, 0, 0, 2, 0, 0, 0, 1, 0, 0, 0]
|
[4, 0, 0, 0, 3, 0, 0, 0, 2, 0, 0, 0, 1, 0, 0, 0]
|
||||||
);
|
);
|
||||||
|
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
Uimm128::from_iter(vec![false, true]).0,
|
V128Imm::from_iter(vec![false, true]).0,
|
||||||
[/* false */ 0, 0, 0, 0, 0, 0, 0, 0, /* true */ 1, 0, 0, 0, 0, 0, 0, 0]
|
[/* false */ 0, 0, 0, 0, 0, 0, 0, 0, /* true */ 1, 0, 0, 0, 0, 0, 0, 0]
|
||||||
);
|
);
|
||||||
|
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
Uimm128::from_iter(vec![false, true, false, true, false, true, false, true]).0,
|
V128Imm::from_iter(vec![false, true, false, true, false, true, false, true]).0,
|
||||||
[0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0]
|
[0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0]
|
||||||
);
|
);
|
||||||
|
|
||||||
@@ -1160,7 +1160,7 @@ mod tests {
|
|||||||
1 as u8, 2, 3, 4, 5, 6, 7, 8, 9, 0xa, 0xb, 0xc, 0xd, 0xe, 0xf, 0,
|
1 as u8, 2, 3, 4, 5, 6, 7, 8, 9, 0xa, 0xb, 0xc, 0xd, 0xe, 0xf, 0,
|
||||||
];
|
];
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
Uimm128::from_iter(u8s).0,
|
V128Imm::from_iter(u8s).0,
|
||||||
[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 0]
|
[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 0]
|
||||||
);
|
);
|
||||||
|
|
||||||
@@ -1170,7 +1170,7 @@ mod tests {
|
|||||||
.map(|&f| Ieee32::from(f))
|
.map(|&f| Ieee32::from(f))
|
||||||
.collect();
|
.collect();
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
Uimm128::from_iter(ieee32s).0,
|
V128Imm::from_iter(ieee32s).0,
|
||||||
[
|
[
|
||||||
/* 32.4 == */ 0x9a, 0x99, 0x01, 0x42, /* 0 == */ 0, 0, 0, 0,
|
/* 32.4 == */ 0x9a, 0x99, 0x01, 0x42, /* 0 == */ 0, 0, 0, 0,
|
||||||
/* 1 == */ 0, 0, 0x80, 0x3f, /* 6.6666 == */ 0xca, 0x54, 0xd5, 0x40,
|
/* 1 == */ 0, 0, 0x80, 0x3f, /* 6.6666 == */ 0xca, 0x54, 0xd5, 0x40,
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
|
|
||||||
use crate::entity::SecondaryMap;
|
use crate::entity::SecondaryMap;
|
||||||
use crate::ir::entities::AnyEntity;
|
use crate::ir::entities::AnyEntity;
|
||||||
use crate::ir::immediates::Uimm128;
|
use crate::ir::immediates::V128Imm;
|
||||||
use crate::ir::{
|
use crate::ir::{
|
||||||
DataFlowGraph, DisplayFunctionAnnotations, Ebb, Function, Inst, SigRef, Type, Value, ValueDef,
|
DataFlowGraph, DisplayFunctionAnnotations, Ebb, Function, Inst, SigRef, Type, Value, ValueDef,
|
||||||
ValueLoc,
|
ValueLoc,
|
||||||
@@ -509,15 +509,15 @@ pub fn write_operands(
|
|||||||
constant_handle, ..
|
constant_handle, ..
|
||||||
} => {
|
} => {
|
||||||
let data = dfg.constants.get(constant_handle);
|
let data = dfg.constants.get(constant_handle);
|
||||||
let uimm128 = Uimm128::from(&data[..]);
|
let v128 = V128Imm::from(&data[..]);
|
||||||
write!(w, " {}", uimm128)
|
write!(w, " {}", v128)
|
||||||
}
|
}
|
||||||
Shuffle { mask, args, .. } => {
|
Shuffle { mask, args, .. } => {
|
||||||
let data = dfg.immediates.get(mask).expect(
|
let data = dfg.immediates.get(mask).expect(
|
||||||
"Expected the shuffle mask to already be inserted into the immediates table",
|
"Expected the shuffle mask to already be inserted into the immediates table",
|
||||||
);
|
);
|
||||||
let uimm128 = Uimm128::from(&data[..]);
|
let v128 = V128Imm::from(&data[..]);
|
||||||
write!(w, " {}, {}, {}", args[0], args[1], uimm128)
|
write!(w, " {}, {}, {}", args[0], args[1], v128)
|
||||||
}
|
}
|
||||||
IntCompare { cond, args, .. } => write!(w, " {} {}, {}", cond, args[0], args[1]),
|
IntCompare { cond, args, .. } => write!(w, " {} {}, {}", cond, args[0], args[1]),
|
||||||
IntCompareImm { cond, arg, imm, .. } => write!(w, " {} {}, {}", cond, arg, imm),
|
IntCompareImm { cond, arg, imm, .. } => write!(w, " {} {}, {}", cond, arg, imm),
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ use crate::testfile::{Comment, Details, Feature, TestFile};
|
|||||||
use cranelift_codegen::entity::EntityRef;
|
use cranelift_codegen::entity::EntityRef;
|
||||||
use cranelift_codegen::ir;
|
use cranelift_codegen::ir;
|
||||||
use cranelift_codegen::ir::entities::AnyEntity;
|
use cranelift_codegen::ir::entities::AnyEntity;
|
||||||
use cranelift_codegen::ir::immediates::{Ieee32, Ieee64, Imm64, Offset32, Uimm128, Uimm32, Uimm64};
|
use cranelift_codegen::ir::immediates::{Ieee32, Ieee64, Imm64, Offset32, Uimm32, Uimm64, V128Imm};
|
||||||
use cranelift_codegen::ir::instructions::{InstructionData, InstructionFormat, VariableArgs};
|
use cranelift_codegen::ir::instructions::{InstructionData, InstructionFormat, VariableArgs};
|
||||||
use cranelift_codegen::ir::types::INVALID;
|
use cranelift_codegen::ir::types::INVALID;
|
||||||
use cranelift_codegen::ir::types::*;
|
use cranelift_codegen::ir::types::*;
|
||||||
@@ -597,7 +597,7 @@ impl<'a> Parser<'a> {
|
|||||||
|
|
||||||
// Match and consume a Uimm128 immediate; due to size restrictions on InstructionData, Uimm128
|
// Match and consume a Uimm128 immediate; due to size restrictions on InstructionData, Uimm128
|
||||||
// is boxed in cranelift-codegen/meta/src/shared/immediates.rs
|
// is boxed in cranelift-codegen/meta/src/shared/immediates.rs
|
||||||
fn match_uimm128(&mut self, err_msg: &str) -> ParseResult<Uimm128> {
|
fn match_uimm128(&mut self, err_msg: &str) -> ParseResult<V128Imm> {
|
||||||
if let Some(Token::Integer(text)) = self.token() {
|
if let Some(Token::Integer(text)) = self.token() {
|
||||||
self.consume();
|
self.consume();
|
||||||
// Lexer just gives us raw text that looks like hex code.
|
// Lexer just gives us raw text that looks like hex code.
|
||||||
@@ -614,7 +614,7 @@ impl<'a> Parser<'a> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Match and consume either a hexadecimal Uimm128 immediate (e.g. 0x000102...) or its literal list form (e.g. [0 1 2...])
|
// Match and consume either a hexadecimal Uimm128 immediate (e.g. 0x000102...) or its literal list form (e.g. [0 1 2...])
|
||||||
fn match_uimm128_or_literals(&mut self, controlling_type: Type) -> ParseResult<Uimm128> {
|
fn match_uimm128_or_literals(&mut self, controlling_type: Type) -> ParseResult<V128Imm> {
|
||||||
if self.optional(Token::LBracket) {
|
if self.optional(Token::LBracket) {
|
||||||
// parse using a list of values, e.g. vconst.i32x4 [0 1 2 3]
|
// parse using a list of values, e.g. vconst.i32x4 [0 1 2 3]
|
||||||
let uimm128 = self.parse_literals_to_uimm128(controlling_type)?;
|
let uimm128 = self.parse_literals_to_uimm128(controlling_type)?;
|
||||||
@@ -838,7 +838,7 @@ impl<'a> Parser<'a> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Parse a list of literals (i.e. integers, floats, booleans); e.g.
|
/// Parse a list of literals (i.e. integers, floats, booleans); e.g.
|
||||||
fn parse_literals_to_uimm128(&mut self, ty: Type) -> ParseResult<Uimm128> {
|
fn parse_literals_to_uimm128(&mut self, ty: Type) -> ParseResult<V128Imm> {
|
||||||
macro_rules! consume {
|
macro_rules! consume {
|
||||||
( $ty:ident, $match_fn:expr ) => {{
|
( $ty:ident, $match_fn:expr ) => {{
|
||||||
assert!($ty.is_vector());
|
assert!($ty.is_vector());
|
||||||
@@ -846,7 +846,7 @@ impl<'a> Parser<'a> {
|
|||||||
for _ in 0..$ty.lane_count() {
|
for _ in 0..$ty.lane_count() {
|
||||||
v.push($match_fn?);
|
v.push($match_fn?);
|
||||||
}
|
}
|
||||||
Uimm128::from_iter(v)
|
V128Imm::from_iter(v)
|
||||||
}};
|
}};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ use crate::translation_utils::{
|
|||||||
};
|
};
|
||||||
use crate::{wasm_unsupported, HashMap};
|
use crate::{wasm_unsupported, HashMap};
|
||||||
use core::convert::TryFrom;
|
use core::convert::TryFrom;
|
||||||
use cranelift_codegen::ir::immediates::Uimm128;
|
use cranelift_codegen::ir::immediates::V128Imm;
|
||||||
use cranelift_codegen::ir::{self, AbiParam, Signature};
|
use cranelift_codegen::ir::{self, AbiParam, Signature};
|
||||||
use cranelift_entity::EntityRef;
|
use cranelift_entity::EntityRef;
|
||||||
use std::vec::Vec;
|
use std::vec::Vec;
|
||||||
@@ -203,7 +203,7 @@ pub fn parse_global_section(
|
|||||||
Operator::F32Const { value } => GlobalInit::F32Const(value.bits()),
|
Operator::F32Const { value } => GlobalInit::F32Const(value.bits()),
|
||||||
Operator::F64Const { value } => GlobalInit::F64Const(value.bits()),
|
Operator::F64Const { value } => GlobalInit::F64Const(value.bits()),
|
||||||
Operator::V128Const { value } => {
|
Operator::V128Const { value } => {
|
||||||
GlobalInit::V128Const(Uimm128::from(value.bytes().to_vec().as_slice()))
|
GlobalInit::V128Const(V128Imm::from(value.bytes().to_vec().as_slice()))
|
||||||
}
|
}
|
||||||
Operator::GetGlobal { global_index } => {
|
Operator::GetGlobal { global_index } => {
|
||||||
GlobalInit::GetGlobal(GlobalIndex::from_u32(global_index))
|
GlobalInit::GetGlobal(GlobalIndex::from_u32(global_index))
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ use crate::wasm_unsupported;
|
|||||||
use core::u32;
|
use core::u32;
|
||||||
use cranelift_codegen::entity::entity_impl;
|
use cranelift_codegen::entity::entity_impl;
|
||||||
use cranelift_codegen::ir;
|
use cranelift_codegen::ir;
|
||||||
use cranelift_codegen::ir::immediates::Uimm128;
|
use cranelift_codegen::ir::immediates::V128Imm;
|
||||||
#[cfg(feature = "enable-serde")]
|
#[cfg(feature = "enable-serde")]
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
use wasmparser;
|
use wasmparser;
|
||||||
@@ -78,7 +78,7 @@ pub enum GlobalInit {
|
|||||||
/// An `f64.const`.
|
/// An `f64.const`.
|
||||||
F64Const(u64),
|
F64Const(u64),
|
||||||
/// A `vconst`.
|
/// A `vconst`.
|
||||||
V128Const(Uimm128),
|
V128Const(V128Imm),
|
||||||
/// A `get_global` of another global.
|
/// A `get_global` of another global.
|
||||||
GetGlobal(GlobalIndex),
|
GetGlobal(GlobalIndex),
|
||||||
///< The global is imported from, and thus initialized by, a different module.
|
///< The global is imported from, and thus initialized by, a different module.
|
||||||
|
|||||||
Reference in New Issue
Block a user