Legalize load.i128 and store.i128

This commit is contained in:
bjorn3
2019-06-29 17:40:36 +02:00
committed by Dan Gohman
parent 3ae78fddde
commit fa9602df80
3 changed files with 47 additions and 5 deletions

View File

@@ -14,7 +14,7 @@ use crate::cdsl::type_inference::Constraint;
use crate::cdsl::types::{LaneType, ReferenceType, ValueType, VectorType};
use crate::cdsl::typevar::TypeVar;
#[derive(Copy, Clone, PartialEq, Eq, Hash, PartialOrd, Ord)]
#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct OpcodeNumber(u32);
entity_impl!(OpcodeNumber);

View File

@@ -247,16 +247,16 @@ pub(crate) fn define(insts: &InstructionGroup, imm: &Immediates) -> TransformGro
def!((xl, xh) = isplit(x)),
def!(
a = icmp_imm(
Literal::enumerator_for(intcc, "eq"),
Literal::enumerator_for(&imm.intcc, "eq"),
xl,
Literal::constant(imm64, 0)
Literal::constant(&imm.imm64, 0)
)
),
def!(
b = icmp_imm(
Literal::enumerator_for(intcc, "eq"),
Literal::enumerator_for(&imm.intcc, "eq"),
xh,
Literal::constant(imm64, 0)
Literal::constant(&imm.imm64, 0)
)
),
def!(c = band(a, b)),
@@ -273,6 +273,30 @@ pub(crate) fn define(insts: &InstructionGroup, imm: &Immediates) -> TransformGro
],
);
// FIXME generalize to any offset once offset+8 can be represented
narrow.legalize(
def!(a = load.I128(flags, ptr, Literal::constant(&imm.offset32, 0))),
vec![
def!(al = load.I64(flags, ptr, Literal::constant(&imm.offset32, 0))),
def!(ah = load.I64(flags, ptr, Literal::constant(&imm.offset32, 8))),
// `iconcat` expects the same byte order as stored in memory,
// so no need to swap depending on endianness.
def!(a = iconcat(al, ah)),
],
);
// FIXME generalize to any offset once offset+8 can be represented
narrow.legalize(
def!(store.I128(flags, a, ptr, Literal::constant(&imm.offset32, 0))),
vec![
// `isplit` gives the same byte order as stored in memory,
// so no need to swap depending on endianness.
def!((al, ah) = isplit(a)),
def!(store.I64(flags, al, ptr, Literal::constant(&imm.offset32, 0))),
def!(store.I64(flags, ah, ptr, Literal::constant(&imm.offset32, 8))),
],
);
// Widen instructions with one input operand.
for &op in &[bnot, popcnt] {
for &int_ty in &[I8, I16] {