From 6021da8e1c8ce9eea95bfe32954b62234695e1e7 Mon Sep 17 00:00:00 2001 From: Jakob Stoklund Olesen Date: Fri, 10 Mar 2017 11:57:49 -0800 Subject: [PATCH] Remove the vconst instruction and the UnaryImmVector format. No instruction sets actually have single instructions for materializing vector constants. You always need to use a constant pool. Cretonne doesn't have constant pools yet, but it will in the future, and that is how vector constants should be represented. --- docs/langref.rst | 1 - lib/cretonne/meta/base/formats.py | 3 +-- lib/cretonne/meta/base/immediates.py | 6 ------ lib/cretonne/meta/base/instructions.py | 12 +----------- lib/cretonne/src/ir/builder.rs | 2 +- lib/cretonne/src/ir/immediates.rs | 6 ------ lib/cretonne/src/ir/instructions.rs | 24 +----------------------- lib/cretonne/src/write.rs | 1 - lib/reader/src/parser.rs | 6 +----- 9 files changed, 5 insertions(+), 56 deletions(-) diff --git a/docs/langref.rst b/docs/langref.rst index cff747752a..b1262c0335 100644 --- a/docs/langref.rst +++ b/docs/langref.rst @@ -643,7 +643,6 @@ Constant materialization .. autoinst:: iconst .. autoinst:: f32const .. autoinst:: f64const -.. autoinst:: vconst Live range splitting -------------------- diff --git a/lib/cretonne/meta/base/formats.py b/lib/cretonne/meta/base/formats.py index 7ed047c330..98547bbbd7 100644 --- a/lib/cretonne/meta/base/formats.py +++ b/lib/cretonne/meta/base/formats.py @@ -8,7 +8,7 @@ in this module. from __future__ import absolute_import from cdsl.formats import InstructionFormat from cdsl.operands import VALUE, VARIABLE_ARGS -from .immediates import imm64, uimm8, ieee32, ieee64, immvector, intcc, floatcc +from .immediates import imm64, uimm8, ieee32, ieee64, intcc, floatcc from .entities import ebb, sig_ref, func_ref, jump_table Nullary = InstructionFormat() @@ -17,7 +17,6 @@ Unary = InstructionFormat(VALUE) UnaryImm = InstructionFormat(imm64) UnaryIeee32 = InstructionFormat(ieee32) UnaryIeee64 = InstructionFormat(ieee64) -UnaryImmVector = InstructionFormat(immvector, boxed_storage=True) UnarySplit = InstructionFormat(VALUE, multiple_results=True) Binary = InstructionFormat(VALUE, VALUE) diff --git a/lib/cretonne/meta/base/immediates.py b/lib/cretonne/meta/base/immediates.py index 565dd26850..05a542b6d9 100644 --- a/lib/cretonne/meta/base/immediates.py +++ b/lib/cretonne/meta/base/immediates.py @@ -27,12 +27,6 @@ ieee32 = ImmediateKind('ieee32', 'A 32-bit immediate floating point number.') #: IEEE 754-2008 binary64 interchange format. ieee64 = ImmediateKind('ieee64', 'A 64-bit immediate floating point number.') -#: A large SIMD vector constant. -immvector = ImmediateKind( - 'immvector', - 'An immediate SIMD vector.', - rust_type='ImmVector') - #: A condition code for comparing integer values. #: #: This enumerated operand kind is used for the :cton:inst:`icmp` instruction diff --git a/lib/cretonne/meta/base/instructions.py b/lib/cretonne/meta/base/instructions.py index 41b6ff6c05..4f5febb0c4 100644 --- a/lib/cretonne/meta/base/instructions.py +++ b/lib/cretonne/meta/base/instructions.py @@ -9,7 +9,7 @@ from cdsl.operands import Operand, VARIABLE_ARGS from cdsl.typevar import TypeVar from cdsl.instructions import Instruction, InstructionGroup from base.types import i8, f32, f64, b1 -from base.immediates import imm64, uimm8, ieee32, ieee64, immvector +from base.immediates import imm64, uimm8, ieee32, ieee64 from base.immediates import intcc, floatcc from base import entities import base.formats # noqa @@ -196,16 +196,6 @@ f64const = Instruction( """, ins=N, outs=a) -N = Operand('N', immvector) -a = Operand('a', TxN, doc='A constant vector value') -vconst = Instruction( - 'vconst', r""" - Vector constant (floating point or integer). - - Create a SIMD vector value where the lanes don't have to be identical. - """, - ins=N, outs=a) - # # Generics. # diff --git a/lib/cretonne/src/ir/builder.rs b/lib/cretonne/src/ir/builder.rs index fa15587445..b6d6a16b6b 100644 --- a/lib/cretonne/src/ir/builder.rs +++ b/lib/cretonne/src/ir/builder.rs @@ -6,7 +6,7 @@ use ir::{types, instructions}; use ir::{InstructionData, DataFlowGraph, Cursor}; use ir::{Opcode, Type, Inst, Value, Ebb, JumpTable, SigRef, FuncRef, ValueList}; -use ir::immediates::{Imm64, Uimm8, Ieee32, Ieee64, ImmVector}; +use ir::immediates::{Imm64, Uimm8, Ieee32, Ieee64}; use ir::condcodes::{IntCC, FloatCC}; /// Base trait for instruction builders. diff --git a/lib/cretonne/src/ir/immediates.rs b/lib/cretonne/src/ir/immediates.rs index 5673af1163..79229fc3a0 100644 --- a/lib/cretonne/src/ir/immediates.rs +++ b/lib/cretonne/src/ir/immediates.rs @@ -434,12 +434,6 @@ impl FromStr for Ieee64 { } } -/// Arbitrary vector immediate. -/// -/// This kind of immediate can represent any kind of SIMD vector constant. -/// The representation is simply the sequence of bytes that would be used to store the vector. -pub type ImmVector = Vec; - #[cfg(test)] mod tests { use super::*; diff --git a/lib/cretonne/src/ir/instructions.rs b/lib/cretonne/src/ir/instructions.rs index 09167907be..1292836d6d 100644 --- a/lib/cretonne/src/ir/instructions.rs +++ b/lib/cretonne/src/ir/instructions.rs @@ -11,7 +11,7 @@ use std::str::FromStr; use std::ops::{Deref, DerefMut}; use ir::{Value, Type, Ebb, JumpTable, SigRef, FuncRef}; -use ir::immediates::{Imm64, Uimm8, Ieee32, Ieee64, ImmVector}; +use ir::immediates::{Imm64, Uimm8, Ieee32, Ieee64}; use ir::condcodes::*; use ir::types; use ir::DataFlowGraph; @@ -123,11 +123,6 @@ pub enum InstructionData { ty: Type, imm: Ieee64, }, - UnaryImmVector { - opcode: Opcode, - ty: Type, - data: Box, - }, UnarySplit { opcode: Opcode, ty: Type, @@ -294,23 +289,6 @@ impl Default for VariableArgs { } } -/// Payload data for `vconst`. -#[derive(Clone, Debug)] -pub struct UnaryImmVectorData { - /// Raw vector data. - pub imm: ImmVector, -} - -impl Display for UnaryImmVectorData { - fn fmt(&self, f: &mut Formatter) -> fmt::Result { - write!(f, "#")?; - for b in &self.imm { - write!(f, "{:02x}", b)?; - } - Ok(()) - } -} - /// Payload data for ternary instructions with multiple results, such as `iadd_carry`. #[derive(Clone, Debug)] pub struct TernaryOverflowData { diff --git a/lib/cretonne/src/write.rs b/lib/cretonne/src/write.rs index 57d31d2e5c..e6880de697 100644 --- a/lib/cretonne/src/write.rs +++ b/lib/cretonne/src/write.rs @@ -233,7 +233,6 @@ fn write_instruction(w: &mut Write, UnaryImm { imm, .. } => writeln!(w, " {}", imm), UnaryIeee32 { imm, .. } => writeln!(w, " {}", imm), UnaryIeee64 { imm, .. } => writeln!(w, " {}", imm), - UnaryImmVector { ref data, .. } => writeln!(w, " {}", data), UnarySplit { arg, .. } => writeln!(w, " {}", arg), Binary { args, .. } => writeln!(w, " {}, {}", args[0], args[1]), BinaryImm { arg, imm, .. } => writeln!(w, " {}, {}", arg, imm), diff --git a/lib/reader/src/parser.rs b/lib/reader/src/parser.rs index 1e5e194785..bd7d65c3ee 100644 --- a/lib/reader/src/parser.rs +++ b/lib/reader/src/parser.rs @@ -171,8 +171,7 @@ impl<'a> Context<'a> { InstructionData::Nullary { .. } | InstructionData::UnaryImm { .. } | InstructionData::UnaryIeee32 { .. } | - InstructionData::UnaryIeee64 { .. } | - InstructionData::UnaryImmVector { .. } => {} + InstructionData::UnaryIeee64 { .. } => {} InstructionData::Unary { ref mut arg, .. } | InstructionData::UnarySplit { ref mut arg, .. } | @@ -1335,9 +1334,6 @@ impl<'a> Parser<'a> { imm: self.match_ieee64("expected immediate 64-bit float operand")?, } } - InstructionFormat::UnaryImmVector => { - unimplemented!(); - } InstructionFormat::UnarySplit => { InstructionData::UnarySplit { opcode: opcode,