arm64: Implement SIMD shift instructions

Copyright (c) 2020, Arm Limited.
This commit is contained in:
Joey Gouly
2020-07-03 16:47:43 +01:00
parent 08efcbd9d5
commit 3a67d25ed6
5 changed files with 158 additions and 17 deletions

View File

@@ -1352,6 +1352,8 @@ impl MachInstEmit for Inst {
debug_assert_ne!(I64X2, ty);
(0b010_01110_00_1 | enc_size << 1, 0b100111)
}
VecALUOp::Sshl => (0b010_01110_00_1 | enc_size << 1, 0b010001),
VecALUOp::Ushl => (0b011_01110_00_1 | enc_size << 1, 0b010001),
};
sink.put4(enc_vec_rrr(top11, rm, bit15_10, rn, rd));
}

View File

@@ -2473,6 +2473,102 @@ fn test_aarch64_binemit() {
"mul v18.4s, v18.4s, v18.4s",
));
insns.push((
Inst::VecRRR {
alu_op: VecALUOp::Ushl,
rd: writable_vreg(18),
rn: vreg(18),
rm: vreg(18),
ty: I8X16,
},
"5246326E",
"ushl v18.16b, v18.16b, v18.16b",
));
insns.push((
Inst::VecRRR {
alu_op: VecALUOp::Ushl,
rd: writable_vreg(18),
rn: vreg(18),
rm: vreg(18),
ty: I16X8,
},
"5246726E",
"ushl v18.8h, v18.8h, v18.8h",
));
insns.push((
Inst::VecRRR {
alu_op: VecALUOp::Ushl,
rd: writable_vreg(18),
rn: vreg(1),
rm: vreg(21),
ty: I32X4,
},
"3244B56E",
"ushl v18.4s, v1.4s, v21.4s",
));
insns.push((
Inst::VecRRR {
alu_op: VecALUOp::Ushl,
rd: writable_vreg(5),
rn: vreg(7),
rm: vreg(19),
ty: I64X2,
},
"E544F36E",
"ushl v5.2d, v7.2d, v19.2d",
));
insns.push((
Inst::VecRRR {
alu_op: VecALUOp::Sshl,
rd: writable_vreg(18),
rn: vreg(18),
rm: vreg(18),
ty: I8X16,
},
"5246324E",
"sshl v18.16b, v18.16b, v18.16b",
));
insns.push((
Inst::VecRRR {
alu_op: VecALUOp::Sshl,
rd: writable_vreg(30),
rn: vreg(1),
rm: vreg(29),
ty: I16X8,
},
"3E447D4E",
"sshl v30.8h, v1.8h, v29.8h",
));
insns.push((
Inst::VecRRR {
alu_op: VecALUOp::Sshl,
rd: writable_vreg(8),
rn: vreg(22),
rm: vreg(21),
ty: I32X4,
},
"C846B54E",
"sshl v8.4s, v22.4s, v21.4s",
));
insns.push((
Inst::VecRRR {
alu_op: VecALUOp::Sshl,
rd: writable_vreg(8),
rn: vreg(22),
rm: vreg(2),
ty: I64X2,
},
"C846E24E",
"sshl v8.2d, v22.2d, v2.2d",
));
insns.push((
Inst::VecMisc {
op: VecMisc2::Not,

View File

@@ -249,6 +249,10 @@ pub enum VecALUOp {
Sub,
/// Multiply
Mul,
/// Signed shift left
Sshl,
/// Unsigned shift left
Ushl,
}
/// A Vector miscellaneous operation with two registers.
@@ -2751,6 +2755,8 @@ impl ShowWithRRU for Inst {
VecALUOp::Add => ("add", true, ty),
VecALUOp::Sub => ("sub", true, ty),
VecALUOp::Mul => ("mul", true, ty),
VecALUOp::Sshl => ("sshl", true, ty),
VecALUOp::Ushl => ("ushl", true, ty),
};
let show_vreg_fn: fn(Reg, Option<&RealRegUniverse>, Type) -> String = if vector {