Parse a list of literals (i.e. integers, floats, booleans); e.g. `0 1 2 3`, usually as part of something like `vconst.i32x4 [0 1 2 3]`.
(&mut self, ty: Type)
| 986 | /// Parse a list of literals (i.e. integers, floats, booleans); e.g. `0 1 2 3`, usually as |
| 987 | /// part of something like `vconst.i32x4 [0 1 2 3]`. |
| 988 | fn parse_literals_to_constant_data(&mut self, ty: Type) -> ParseResult<ConstantData> { |
| 989 | macro_rules! consume { |
| 990 | ( $ty:ident, $match_fn:expr ) => {{ |
| 991 | assert!($ty.is_vector()); |
| 992 | let mut data = ConstantData::default(); |
| 993 | for _ in 0..$ty.lane_count() { |
| 994 | data = data.append($match_fn); |
| 995 | } |
| 996 | data |
| 997 | }}; |
| 998 | } |
| 999 | |
| 1000 | if !ty.is_vector() && !ty.is_dynamic_vector() { |
| 1001 | err!(self.loc, "Expected a controlling vector type, not {}", ty) |
| 1002 | } else { |
| 1003 | let constant_data = match ty.lane_type() { |
| 1004 | I8 => consume!(ty, self.match_imm8("Expected an 8-bit integer")?), |
| 1005 | I16 => consume!(ty, self.match_imm16("Expected a 16-bit integer")?), |
| 1006 | I32 => consume!(ty, self.match_imm32("Expected a 32-bit integer")?), |
| 1007 | I64 => consume!(ty, self.match_imm64("Expected a 64-bit integer")?), |
| 1008 | F32 => consume!(ty, self.match_ieee32("Expected a 32-bit float")?), |
| 1009 | F64 => consume!(ty, self.match_ieee64("Expected a 64-bit float")?), |
| 1010 | _ => return err!(self.loc, "Expected a type of: float, int, bool"), |
| 1011 | }; |
| 1012 | Ok(constant_data) |
| 1013 | } |
| 1014 | } |
| 1015 | |
| 1016 | /// Parse a list of test command passes specified in command line. |
| 1017 | pub fn parse_cmdline_passes(&mut self, passes: &'a [String]) -> Vec<TestCommand<'a>> { |