diff options
author | Bob Wilson <bob.wilson@apple.com> | 2009-07-26 00:39:34 +0000 |
---|---|---|
committer | Bob Wilson <bob.wilson@apple.com> | 2009-07-26 00:39:34 +0000 |
commit | c1cd72e05f3324eb2d7f1db44848e11541a8fa5a (patch) | |
tree | efd9a938e443fb0b9ab8efd7f3f60fa0a9210709 /lib/Target/ARM/ARMISelLowering.cpp | |
parent | 1be1386ebdb11b9fc2212c12b874ca61773a63f8 (diff) | |
download | external_llvm-c1cd72e05f3324eb2d7f1db44848e11541a8fa5a.zip external_llvm-c1cd72e05f3324eb2d7f1db44848e11541a8fa5a.tar.gz external_llvm-c1cd72e05f3324eb2d7f1db44848e11541a8fa5a.tar.bz2 |
Add support for ARM Neon VREV instructions.
Patch by Anton Korzh, with some modifications from me.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@77101 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Target/ARM/ARMISelLowering.cpp')
-rw-r--r-- | lib/Target/ARM/ARMISelLowering.cpp | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/lib/Target/ARM/ARMISelLowering.cpp b/lib/Target/ARM/ARMISelLowering.cpp index 7e2bbcd..226f161 100644 --- a/lib/Target/ARM/ARMISelLowering.cpp +++ b/lib/Target/ARM/ARMISelLowering.cpp @@ -2188,6 +2188,30 @@ SDValue ARM::getVMOVImm(SDNode *N, unsigned ByteSize, SelectionDAG &DAG) { SplatBitSize, DAG); } +/// isVREVMask - Check if a vector shuffle corresponds to a VREV +/// instruction with the specified blocksize. (The order of the elements +/// within each block of the vector is reversed.) +bool ARM::isVREVMask(ShuffleVectorSDNode *N, unsigned BlockSize) { + assert((BlockSize==16 || BlockSize==32 || BlockSize==64) && + "Only possible block sizes for VREV are: 16, 32, 64"); + + MVT VT = N->getValueType(0); + unsigned NumElts = VT.getVectorNumElements(); + unsigned EltSz = VT.getVectorElementType().getSizeInBits(); + unsigned BlockElts = N->getMaskElt(0) + 1; + + if (BlockSize <= EltSz || BlockSize != BlockElts * EltSz) + return false; + + for (unsigned i = 0; i < NumElts; ++i) { + if ((unsigned) N->getMaskElt(i) != + (i - i%BlockElts) + (BlockElts - 1 - i%BlockElts)) + return false; + } + + return true; +} + static SDValue BuildSplat(SDValue Val, MVT VT, SelectionDAG &DAG, DebugLoc dl) { // Canonicalize all-zeros and all-ones vectors. ConstantSDNode *ConstVal = dyn_cast<ConstantSDNode>(Val.getNode()); |