Use ConstantData exclusively for inserting data into the constant pool
Previously we allowed anything that could be converted into ConstantData (e.g. a Vec).
This commit is contained in:
@@ -6,7 +6,7 @@ use crate::cursor::{Cursor, FuncCursor};
|
||||
use crate::flowgraph::ControlFlowGraph;
|
||||
use crate::ir::condcodes::{FloatCC, IntCC};
|
||||
use crate::ir::types::*;
|
||||
use crate::ir::{self, ConstantData, Function, Inst, InstBuilder};
|
||||
use crate::ir::{self, Function, Inst, InstBuilder};
|
||||
use crate::isa::constraints::*;
|
||||
use crate::isa::enc_tables::*;
|
||||
use crate::isa::encoding::base_size;
|
||||
@@ -15,7 +15,6 @@ use crate::isa::RegUnit;
|
||||
use crate::isa::{self, TargetIsa};
|
||||
use crate::predicates;
|
||||
use crate::regalloc::RegDiversions;
|
||||
use std::vec::Vec;
|
||||
|
||||
include!(concat!(env!("OUT_DIR"), "/encoding-x86.rs"));
|
||||
include!(concat!(env!("OUT_DIR"), "/legalize-x86.rs"));
|
||||
@@ -928,7 +927,7 @@ fn convert_shuffle(
|
||||
.clone();
|
||||
if a == b {
|
||||
// PSHUFB the first argument (since it is the same as the second).
|
||||
let constructed_mask: Vec<u8> = mask
|
||||
let constructed_mask = mask
|
||||
.iter()
|
||||
// If the mask is greater than 15 it still may be referring to a lane in b.
|
||||
.map(|&b| if b > 15 { b.wrapping_sub(16) } else { b })
|
||||
@@ -942,8 +941,7 @@ fn convert_shuffle(
|
||||
pos.func.dfg.replace(inst).x86_pshufb(a, mask_value);
|
||||
} else {
|
||||
// PSHUFB the first argument, placing zeroes for unused lanes.
|
||||
let constructed_mask: Vec<u8> =
|
||||
mask.iter().cloned().map(zero_unknown_lane_index).collect();
|
||||
let constructed_mask = mask.iter().cloned().map(zero_unknown_lane_index).collect();
|
||||
let handle = pos.func.dfg.constants.insert(constructed_mask);
|
||||
// Move the built mask into another XMM register.
|
||||
let a_type = pos.func.dfg.value_type(a);
|
||||
@@ -952,7 +950,7 @@ fn convert_shuffle(
|
||||
let shuffled_first_arg = pos.ins().x86_pshufb(a, mask_value);
|
||||
|
||||
// PSHUFB the second argument, placing zeroes for unused lanes.
|
||||
let constructed_mask: Vec<u8> = mask
|
||||
let constructed_mask = mask
|
||||
.iter()
|
||||
.map(|b| b.wrapping_sub(16))
|
||||
.map(zero_unknown_lane_index)
|
||||
@@ -1110,11 +1108,7 @@ fn convert_ineg(
|
||||
{
|
||||
let value_type = pos.func.dfg.value_type(arg);
|
||||
if value_type.is_vector() && value_type.lane_type().is_int() {
|
||||
let zero_immediate = pos
|
||||
.func
|
||||
.dfg
|
||||
.constants
|
||||
.insert(ConstantData::from(vec![0; 16]));
|
||||
let zero_immediate = pos.func.dfg.constants.insert(vec![0; 16].into());
|
||||
let zero_value = pos.ins().vconst(value_type, zero_immediate); // this should be legalized to a PXOR
|
||||
pos.func.dfg.replace(inst).isub(zero_value, arg);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user