forked from OSchip/llvm-project
ARMEB: Vector extend operations
Reviewed at http://reviews.llvm.org/D4043 llvm-svn: 211520
This commit is contained in:
parent
1d555c4e91
commit
6f81e75dab
|
@ -4504,6 +4504,11 @@ static SDValue isNEONModifiedImm(uint64_t SplatBits, uint64_t SplatUndef,
|
|||
BitMask <<= 8;
|
||||
ImmMask <<= 1;
|
||||
}
|
||||
|
||||
if (DAG.getTargetLoweringInfo().isBigEndian())
|
||||
// swap higher and lower 32 bit word
|
||||
Imm = ((Imm & 0xf) << 4) | ((Imm & 0xf0) >> 4);
|
||||
|
||||
// Op=1, Cmode=1110.
|
||||
OpCmode = 0x1e;
|
||||
VT = is128Bits ? MVT::v2i64 : MVT::v1i64;
|
||||
|
|
|
@ -6372,6 +6372,32 @@ multiclass Lengthen_HalfSingle<string DestLanes, string DestTy, string SrcTy,
|
|||
dsub_0)>;
|
||||
}
|
||||
|
||||
// The following class definition is basically a copy of the
|
||||
// Lengthen_HalfSingle definition above, however with an additional parameter
|
||||
// "RevLanes" to select the correct VREV32dXX instruction. This is to convert
|
||||
// data loaded by VLD1LN into proper vector format in big endian mode.
|
||||
multiclass Lengthen_HalfSingle_Big_Endian<string DestLanes, string DestTy, string SrcTy,
|
||||
string InsnLanes, string InsnTy, string RevLanes> {
|
||||
def _Any : Pat<(!cast<ValueType>("v" # DestLanes # DestTy)
|
||||
(!cast<PatFrag>("extloadv" # SrcTy) addrmode6oneL32:$addr)),
|
||||
(EXTRACT_SUBREG (!cast<Instruction>("VMOVLuv" # InsnLanes # InsnTy)
|
||||
(!cast<Instruction>("VREV32d" # RevLanes)
|
||||
(VLD1LNd32 addrmode6oneL32:$addr, (f64 (IMPLICIT_DEF)), (i32 0)))),
|
||||
dsub_0)>;
|
||||
def _Z : Pat<(!cast<ValueType>("v" # DestLanes # DestTy)
|
||||
(!cast<PatFrag>("zextloadv" # SrcTy) addrmode6oneL32:$addr)),
|
||||
(EXTRACT_SUBREG (!cast<Instruction>("VMOVLuv" # InsnLanes # InsnTy)
|
||||
(!cast<Instruction>("VREV32d" # RevLanes)
|
||||
(VLD1LNd32 addrmode6oneL32:$addr, (f64 (IMPLICIT_DEF)), (i32 0)))),
|
||||
dsub_0)>;
|
||||
def _S : Pat<(!cast<ValueType>("v" # DestLanes # DestTy)
|
||||
(!cast<PatFrag>("sextloadv" # SrcTy) addrmode6oneL32:$addr)),
|
||||
(EXTRACT_SUBREG (!cast<Instruction>("VMOVLsv" # InsnLanes # InsnTy)
|
||||
(!cast<Instruction>("VREV32d" # RevLanes)
|
||||
(VLD1LNd32 addrmode6oneL32:$addr, (f64 (IMPLICIT_DEF)), (i32 0)))),
|
||||
dsub_0)>;
|
||||
}
|
||||
|
||||
// extload, zextload and sextload for a lengthening load followed by another
|
||||
// lengthening load, to quadruple the initial length.
|
||||
//
|
||||
|
@ -6406,6 +6432,36 @@ multiclass Lengthen_Double<string DestLanes, string DestTy, string SrcTy,
|
|||
dsub_0))>;
|
||||
}
|
||||
|
||||
// The following class definition is basically a copy of the
|
||||
// Lengthen_Double definition above, however with an additional parameter
|
||||
// "RevLanes" to select the correct VREV32dXX instruction. This is to convert
|
||||
// data loaded by VLD1LN into proper vector format in big endian mode.
|
||||
multiclass Lengthen_Double_Big_Endian<string DestLanes, string DestTy, string SrcTy,
|
||||
string Insn1Lanes, string Insn1Ty, string Insn2Lanes,
|
||||
string Insn2Ty, string RevLanes> {
|
||||
def _Any : Pat<(!cast<ValueType>("v" # DestLanes # DestTy)
|
||||
(!cast<PatFrag>("extloadv" # SrcTy) addrmode6oneL32:$addr)),
|
||||
(!cast<Instruction>("VMOVLuv" # Insn2Lanes # Insn2Ty)
|
||||
(EXTRACT_SUBREG (!cast<Instruction>("VMOVLuv" # Insn1Lanes # Insn1Ty)
|
||||
(!cast<Instruction>("VREV32d" # RevLanes)
|
||||
(VLD1LNd32 addrmode6oneL32:$addr, (f64 (IMPLICIT_DEF)), (i32 0)))),
|
||||
dsub_0))>;
|
||||
def _Z : Pat<(!cast<ValueType>("v" # DestLanes # DestTy)
|
||||
(!cast<PatFrag>("zextloadv" # SrcTy) addrmode6oneL32:$addr)),
|
||||
(!cast<Instruction>("VMOVLuv" # Insn2Lanes # Insn2Ty)
|
||||
(EXTRACT_SUBREG (!cast<Instruction>("VMOVLuv" # Insn1Lanes # Insn1Ty)
|
||||
(!cast<Instruction>("VREV32d" # RevLanes)
|
||||
(VLD1LNd32 addrmode6oneL32:$addr, (f64 (IMPLICIT_DEF)), (i32 0)))),
|
||||
dsub_0))>;
|
||||
def _S : Pat<(!cast<ValueType>("v" # DestLanes # DestTy)
|
||||
(!cast<PatFrag>("sextloadv" # SrcTy) addrmode6oneL32:$addr)),
|
||||
(!cast<Instruction>("VMOVLsv" # Insn2Lanes # Insn2Ty)
|
||||
(EXTRACT_SUBREG (!cast<Instruction>("VMOVLsv" # Insn1Lanes # Insn1Ty)
|
||||
(!cast<Instruction>("VREV32d" # RevLanes)
|
||||
(VLD1LNd32 addrmode6oneL32:$addr, (f64 (IMPLICIT_DEF)), (i32 0)))),
|
||||
dsub_0))>;
|
||||
}
|
||||
|
||||
// extload, zextload and sextload for a lengthening load followed by another
|
||||
// lengthening load, to quadruple the initial length, but which ends up only
|
||||
// requiring half the available lanes (a 64-bit outcome instead of a 128-bit).
|
||||
|
@ -6443,33 +6499,102 @@ multiclass Lengthen_HalfDouble<string DestLanes, string DestTy, string SrcTy,
|
|||
dsub_0)>;
|
||||
}
|
||||
|
||||
// The following class definition is basically a copy of the
|
||||
// Lengthen_HalfDouble definition above, however with an additional VREV16d8
|
||||
// instruction to convert data loaded by VLD1LN into proper vector format
|
||||
// in big endian mode.
|
||||
multiclass Lengthen_HalfDouble_Big_Endian<string DestLanes, string DestTy, string SrcTy,
|
||||
string Insn1Lanes, string Insn1Ty, string Insn2Lanes,
|
||||
string Insn2Ty> {
|
||||
def _Any : Pat<(!cast<ValueType>("v" # DestLanes # DestTy)
|
||||
(!cast<PatFrag>("extloadv" # SrcTy) addrmode6:$addr)),
|
||||
(EXTRACT_SUBREG (!cast<Instruction>("VMOVLuv" # Insn2Lanes # Insn2Ty)
|
||||
(EXTRACT_SUBREG (!cast<Instruction>("VMOVLuv" # Insn1Lanes # Insn1Ty)
|
||||
(!cast<Instruction>("VREV16d8")
|
||||
(VLD1LNd16 addrmode6:$addr, (f64 (IMPLICIT_DEF)), (i32 0)))),
|
||||
dsub_0)),
|
||||
dsub_0)>;
|
||||
def _Z : Pat<(!cast<ValueType>("v" # DestLanes # DestTy)
|
||||
(!cast<PatFrag>("zextloadv" # SrcTy) addrmode6:$addr)),
|
||||
(EXTRACT_SUBREG (!cast<Instruction>("VMOVLuv" # Insn2Lanes # Insn2Ty)
|
||||
(EXTRACT_SUBREG (!cast<Instruction>("VMOVLuv" # Insn1Lanes # Insn1Ty)
|
||||
(!cast<Instruction>("VREV16d8")
|
||||
(VLD1LNd16 addrmode6:$addr, (f64 (IMPLICIT_DEF)), (i32 0)))),
|
||||
dsub_0)),
|
||||
dsub_0)>;
|
||||
def _S : Pat<(!cast<ValueType>("v" # DestLanes # DestTy)
|
||||
(!cast<PatFrag>("sextloadv" # SrcTy) addrmode6:$addr)),
|
||||
(EXTRACT_SUBREG (!cast<Instruction>("VMOVLsv" # Insn2Lanes # Insn2Ty)
|
||||
(EXTRACT_SUBREG (!cast<Instruction>("VMOVLsv" # Insn1Lanes # Insn1Ty)
|
||||
(!cast<Instruction>("VREV16d8")
|
||||
(VLD1LNd16 addrmode6:$addr, (f64 (IMPLICIT_DEF)), (i32 0)))),
|
||||
dsub_0)),
|
||||
dsub_0)>;
|
||||
}
|
||||
|
||||
defm : Lengthen_Single<"8", "i16", "8">; // v8i8 -> v8i16
|
||||
defm : Lengthen_Single<"4", "i32", "16">; // v4i16 -> v4i32
|
||||
defm : Lengthen_Single<"2", "i64", "32">; // v2i32 -> v2i64
|
||||
|
||||
defm : Lengthen_HalfSingle<"4", "i16", "i8", "8", "i16">; // v4i8 -> v4i16
|
||||
defm : Lengthen_HalfSingle<"2", "i32", "i16", "4", "i32">; // v2i16 -> v2i32
|
||||
let Predicates = [IsLE] in {
|
||||
defm : Lengthen_HalfSingle<"4", "i16", "i8", "8", "i16">; // v4i8 -> v4i16
|
||||
defm : Lengthen_HalfSingle<"2", "i32", "i16", "4", "i32">; // v2i16 -> v2i32
|
||||
|
||||
// Double lengthening - v4i8 -> v4i16 -> v4i32
|
||||
defm : Lengthen_Double<"4", "i32", "i8", "8", "i16", "4", "i32">;
|
||||
// v2i8 -> v2i16 -> v2i32
|
||||
defm : Lengthen_HalfDouble<"2", "i32", "i8", "8", "i16", "4", "i32">;
|
||||
// v2i16 -> v2i32 -> v2i64
|
||||
defm : Lengthen_Double<"2", "i64", "i16", "4", "i32", "2", "i64">;
|
||||
// Double lengthening - v4i8 -> v4i16 -> v4i32
|
||||
defm : Lengthen_Double<"4", "i32", "i8", "8", "i16", "4", "i32">;
|
||||
// v2i8 -> v2i16 -> v2i32
|
||||
defm : Lengthen_HalfDouble<"2", "i32", "i8", "8", "i16", "4", "i32">;
|
||||
// v2i16 -> v2i32 -> v2i64
|
||||
defm : Lengthen_Double<"2", "i64", "i16", "4", "i32", "2", "i64">;
|
||||
}
|
||||
|
||||
let Predicates = [IsBE] in {
|
||||
defm : Lengthen_HalfSingle_Big_Endian<"4", "i16", "i8", "8", "i16", "8">; // v4i8 -> v4i16
|
||||
defm : Lengthen_HalfSingle_Big_Endian<"2", "i32", "i16", "4", "i32", "16">; // v2i16 -> v2i32
|
||||
|
||||
// Double lengthening - v4i8 -> v4i16 -> v4i32
|
||||
defm : Lengthen_Double_Big_Endian<"4", "i32", "i8", "8", "i16", "4", "i32", "8">;
|
||||
// v2i8 -> v2i16 -> v2i32
|
||||
defm : Lengthen_HalfDouble_Big_Endian<"2", "i32", "i8", "8", "i16", "4", "i32">;
|
||||
// v2i16 -> v2i32 -> v2i64
|
||||
defm : Lengthen_Double_Big_Endian<"2", "i64", "i16", "4", "i32", "2", "i64", "16">;
|
||||
}
|
||||
|
||||
// Triple lengthening - v2i8 -> v2i16 -> v2i32 -> v2i64
|
||||
def : Pat<(v2i64 (extloadvi8 addrmode6:$addr)),
|
||||
(VMOVLuv2i64 (EXTRACT_SUBREG (VMOVLuv4i32 (EXTRACT_SUBREG (VMOVLuv8i16
|
||||
(VLD1LNd16 addrmode6:$addr,
|
||||
(f64 (IMPLICIT_DEF)), (i32 0))), dsub_0)), dsub_0))>;
|
||||
def : Pat<(v2i64 (zextloadvi8 addrmode6:$addr)),
|
||||
(VMOVLuv2i64 (EXTRACT_SUBREG (VMOVLuv4i32 (EXTRACT_SUBREG (VMOVLuv8i16
|
||||
(VLD1LNd16 addrmode6:$addr,
|
||||
(f64 (IMPLICIT_DEF)), (i32 0))), dsub_0)), dsub_0))>;
|
||||
def : Pat<(v2i64 (sextloadvi8 addrmode6:$addr)),
|
||||
(VMOVLsv2i64 (EXTRACT_SUBREG (VMOVLsv4i32 (EXTRACT_SUBREG (VMOVLsv8i16
|
||||
(VLD1LNd16 addrmode6:$addr,
|
||||
(f64 (IMPLICIT_DEF)), (i32 0))), dsub_0)), dsub_0))>;
|
||||
let Predicates = [IsLE] in {
|
||||
def : Pat<(v2i64 (extloadvi8 addrmode6:$addr)),
|
||||
(VMOVLuv2i64 (EXTRACT_SUBREG (VMOVLuv4i32 (EXTRACT_SUBREG (VMOVLuv8i16
|
||||
(VLD1LNd16 addrmode6:$addr,
|
||||
(f64 (IMPLICIT_DEF)), (i32 0))), dsub_0)), dsub_0))>;
|
||||
def : Pat<(v2i64 (zextloadvi8 addrmode6:$addr)),
|
||||
(VMOVLuv2i64 (EXTRACT_SUBREG (VMOVLuv4i32 (EXTRACT_SUBREG (VMOVLuv8i16
|
||||
(VLD1LNd16 addrmode6:$addr,
|
||||
(f64 (IMPLICIT_DEF)), (i32 0))), dsub_0)), dsub_0))>;
|
||||
def : Pat<(v2i64 (sextloadvi8 addrmode6:$addr)),
|
||||
(VMOVLsv2i64 (EXTRACT_SUBREG (VMOVLsv4i32 (EXTRACT_SUBREG (VMOVLsv8i16
|
||||
(VLD1LNd16 addrmode6:$addr,
|
||||
(f64 (IMPLICIT_DEF)), (i32 0))), dsub_0)), dsub_0))>;
|
||||
}
|
||||
// The following patterns are basically a copy of the patterns above,
|
||||
// however with an additional VREV16d instruction to convert data
|
||||
// loaded by VLD1LN into proper vector format in big endian mode.
|
||||
let Predicates = [IsBE] in {
|
||||
def : Pat<(v2i64 (extloadvi8 addrmode6:$addr)),
|
||||
(VMOVLuv2i64 (EXTRACT_SUBREG (VMOVLuv4i32 (EXTRACT_SUBREG (VMOVLuv8i16
|
||||
(!cast<Instruction>("VREV16d8")
|
||||
(VLD1LNd16 addrmode6:$addr,
|
||||
(f64 (IMPLICIT_DEF)), (i32 0)))), dsub_0)), dsub_0))>;
|
||||
def : Pat<(v2i64 (zextloadvi8 addrmode6:$addr)),
|
||||
(VMOVLuv2i64 (EXTRACT_SUBREG (VMOVLuv4i32 (EXTRACT_SUBREG (VMOVLuv8i16
|
||||
(!cast<Instruction>("VREV16d8")
|
||||
(VLD1LNd16 addrmode6:$addr,
|
||||
(f64 (IMPLICIT_DEF)), (i32 0)))), dsub_0)), dsub_0))>;
|
||||
def : Pat<(v2i64 (sextloadvi8 addrmode6:$addr)),
|
||||
(VMOVLsv2i64 (EXTRACT_SUBREG (VMOVLsv4i32 (EXTRACT_SUBREG (VMOVLsv8i16
|
||||
(!cast<Instruction>("VREV16d8")
|
||||
(VLD1LNd16 addrmode6:$addr,
|
||||
(f64 (IMPLICIT_DEF)), (i32 0)))), dsub_0)), dsub_0))>;
|
||||
}
|
||||
|
||||
//===----------------------------------------------------------------------===//
|
||||
// Assembler aliases
|
||||
|
|
|
@ -0,0 +1,81 @@
|
|||
; RUN: llc < %s -mtriple armeb-eabi -mattr v7,neon -o - | FileCheck %s
|
||||
|
||||
define void @vector_ext_2i8_to_2i64( <2 x i8>* %loadaddr, <2 x i64>* %storeaddr ) {
|
||||
; CHECK-LABEL: vector_ext_2i8_to_2i64:
|
||||
; CHECK: vld1.16 {[[REG:d[0-9]+]]
|
||||
; CHECK: vmov.i64 {{q[0-9]+}}, #0xff
|
||||
; CHECK: vrev16.8 [[REG]], [[REG]]
|
||||
; CHECK: vmovl.u8 {{q[0-9]+}}, [[REG]]
|
||||
%1 = load <2 x i8>* %loadaddr
|
||||
%2 = zext <2 x i8> %1 to <2 x i64>
|
||||
store <2 x i64> %2, <2 x i64>* %storeaddr
|
||||
ret void
|
||||
}
|
||||
|
||||
define void @vector_ext_2i16_to_2i64( <2 x i16>* %loadaddr, <2 x i64>* %storeaddr ) {
|
||||
; CHECK-LABEL: vector_ext_2i16_to_2i64:
|
||||
; CHECK: vld1.32 {[[REG:d[0-9]+]]
|
||||
; CHECK: vmov.i64 {{q[0-9]+}}, #0xffff
|
||||
; CHECK: vrev32.16 [[REG]], [[REG]]
|
||||
; CHECK: vmovl.u16 {{q[0-9]+}}, [[REG]]
|
||||
%1 = load <2 x i16>* %loadaddr
|
||||
%2 = zext <2 x i16> %1 to <2 x i64>
|
||||
store <2 x i64> %2, <2 x i64>* %storeaddr
|
||||
ret void
|
||||
}
|
||||
|
||||
|
||||
define void @vector_ext_2i8_to_2i32( <2 x i8>* %loadaddr, <2 x i32>* %storeaddr ) {
|
||||
; CHECK-LABEL: vector_ext_2i8_to_2i32:
|
||||
; CHECK: vld1.16 {[[REG:d[0-9]+]]
|
||||
; CHECK: vrev16.8 [[REG]], [[REG]]
|
||||
%1 = load <2 x i8>* %loadaddr
|
||||
%2 = zext <2 x i8> %1 to <2 x i32>
|
||||
store <2 x i32> %2, <2 x i32>* %storeaddr
|
||||
ret void
|
||||
}
|
||||
|
||||
define void @vector_ext_2i16_to_2i32( <2 x i16>* %loadaddr, <2 x i32>* %storeaddr ) {
|
||||
; CHECK-LABEL: vector_ext_2i16_to_2i32:
|
||||
; CHECK: vld1.32 {[[REG:d[0-9]+]]
|
||||
; CHECK: vrev32.16 [[REG]], [[REG]]
|
||||
; CHECK: vmovl.u16 {{q[0-9]+}}, [[REG]]
|
||||
%1 = load <2 x i16>* %loadaddr
|
||||
%2 = zext <2 x i16> %1 to <2 x i32>
|
||||
store <2 x i32> %2, <2 x i32>* %storeaddr
|
||||
ret void
|
||||
}
|
||||
|
||||
define void @vector_ext_2i8_to_2i16( <2 x i8>* %loadaddr, <2 x i16>* %storeaddr ) {
|
||||
; CHECK-LABEL: vector_ext_2i8_to_2i16:
|
||||
; CHECK: vld1.16 {[[REG:d[0-9]+]]
|
||||
; CHECK: vrev16.8 [[REG]], [[REG]]
|
||||
; CHECK: vmovl.u8 {{q[0-9]+}}, [[REG]]
|
||||
%1 = load <2 x i8>* %loadaddr
|
||||
%2 = zext <2 x i8> %1 to <2 x i16>
|
||||
store <2 x i16> %2, <2 x i16>* %storeaddr
|
||||
ret void
|
||||
}
|
||||
|
||||
define void @vector_ext_4i8_to_4i32( <4 x i8>* %loadaddr, <4 x i32>* %storeaddr ) {
|
||||
; CHECK-LABEL: vector_ext_4i8_to_4i32:
|
||||
; CHECK: vld1.32 {[[REG:d[0-9]+]]
|
||||
; CHECK: vrev32.8 [[REG]], [[REG]]
|
||||
; CHECK: vmovl.u8 {{q[0-9]+}}, [[REG]]
|
||||
%1 = load <4 x i8>* %loadaddr
|
||||
%2 = zext <4 x i8> %1 to <4 x i32>
|
||||
store <4 x i32> %2, <4 x i32>* %storeaddr
|
||||
ret void
|
||||
}
|
||||
|
||||
define void @vector_ext_4i8_to_4i16( <4 x i8>* %loadaddr, <4 x i16>* %storeaddr ) {
|
||||
; CHECK-LABEL: vector_ext_4i8_to_4i16:
|
||||
; CHECK: vld1.32 {[[REG:d[0-9]+]]
|
||||
; CHECK: vrev32.8 [[REG]], [[REG]]
|
||||
; CHECK: vmovl.u8 {{q[0-9]+}}, [[REG]]
|
||||
%1 = load <4 x i8>* %loadaddr
|
||||
%2 = zext <4 x i8> %1 to <4 x i16>
|
||||
store <4 x i16> %2, <4 x i16>* %storeaddr
|
||||
ret void
|
||||
}
|
||||
|
Loading…
Reference in New Issue