[llvm] r314059 - [X86] Move the getInsertVINSERTImmediate and getExtractVEXTRACTImmediate helper functions over to X86ISelDAGToDAG.cpp
Craig Topper via llvm-commits
llvm-commits at lists.llvm.org
Fri Sep 22 22:34:08 PDT 2017
Author: ctopper
Date: Fri Sep 22 22:34:07 2017
New Revision: 314059
URL: http://llvm.org/viewvc/llvm-project?rev=314059&view=rev
Log:
[X86] Move the getInsertVINSERTImmediate and getExtractVEXTRACTImmediate helper functions over to X86ISelDAGToDAG.cpp
Redefine them to call getI8Imm and return that directly.
Modified:
llvm/trunk/lib/Target/X86/X86ISelDAGToDAG.cpp
llvm/trunk/lib/Target/X86/X86ISelLowering.cpp
llvm/trunk/lib/Target/X86/X86ISelLowering.h
llvm/trunk/lib/Target/X86/X86InstrFragmentsSIMD.td
Modified: llvm/trunk/lib/Target/X86/X86ISelDAGToDAG.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86ISelDAGToDAG.cpp?rev=314059&r1=314058&r2=314059&view=diff
==============================================================================
--- llvm/trunk/lib/Target/X86/X86ISelDAGToDAG.cpp (original)
+++ llvm/trunk/lib/Target/X86/X86ISelDAGToDAG.cpp Fri Sep 22 22:34:07 2017
@@ -366,6 +366,24 @@ namespace {
return CurDAG->getTargetConstant(Imm, DL, MVT::i32);
}
+ SDValue getExtractVEXTRACTImmediate(SDNode *N, unsigned VecWidth,
+ const SDLoc &DL) {
+ assert((VecWidth == 128 || VecWidth == 256) && "Unexpected vector width");
+ uint64_t Index = N->getConstantOperandVal(1);
+ MVT VecVT = N->getOperand(0).getSimpleValueType();
+ unsigned NumElemsPerChunk = VecWidth / VecVT.getScalarSizeInBits();
+ return getI8Imm(Index / NumElemsPerChunk, DL);
+ }
+
+ SDValue getInsertVINSERTImmediate(SDNode *N, unsigned VecWidth,
+ const SDLoc &DL) {
+ assert((VecWidth == 128 || VecWidth == 256) && "Unexpected vector width");
+ uint64_t Index = N->getConstantOperandVal(2);
+ MVT VecVT = N->getSimpleValueType(0);
+ unsigned NumElemsPerChunk = VecWidth / VecVT.getScalarSizeInBits();
+ return getI8Imm(Index / NumElemsPerChunk, DL);
+ }
+
/// Return an SDNode that returns the value of the global base register.
/// Output instructions required to initialize the global base register,
/// if necessary.
Modified: llvm/trunk/lib/Target/X86/X86ISelLowering.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86ISelLowering.cpp?rev=314059&r1=314058&r2=314059&view=diff
==============================================================================
--- llvm/trunk/lib/Target/X86/X86ISelLowering.cpp (original)
+++ llvm/trunk/lib/Target/X86/X86ISelLowering.cpp Fri Sep 22 22:34:07 2017
@@ -4809,52 +4809,6 @@ static bool canWidenShuffleElements(Arra
return true;
}
-static unsigned getExtractVEXTRACTImmediate(SDNode *N, unsigned vecWidth) {
- assert((vecWidth == 128 || vecWidth == 256) && "Unsupported vector width");
- assert(isa<ConstantSDNode>(N->getOperand(1).getNode()) &&
- "Illegal extract subvector for VEXTRACT");
-
- uint64_t Index = N->getConstantOperandVal(1);
- MVT VecVT = N->getOperand(0).getSimpleValueType();
- unsigned NumElemsPerChunk = vecWidth / VecVT.getScalarSizeInBits();
- return Index / NumElemsPerChunk;
-}
-
-static unsigned getInsertVINSERTImmediate(SDNode *N, unsigned vecWidth) {
- assert((vecWidth == 128 || vecWidth == 256) && "Unsupported vector width");
- assert(isa<ConstantSDNode>(N->getOperand(2).getNode()) &&
- "Illegal insert subvector for VINSERT");
-
- uint64_t Index = N->getConstantOperandVal(2);
- MVT VecVT = N->getSimpleValueType(0);
- unsigned NumElemsPerChunk = vecWidth / VecVT.getScalarSizeInBits();
- return Index / NumElemsPerChunk;
-}
-
-/// Return the appropriate immediate to extract the specified
-/// EXTRACT_SUBVECTOR index with VEXTRACTF128 and VINSERTI128 instructions.
-unsigned X86::getExtractVEXTRACT128Immediate(SDNode *N) {
- return getExtractVEXTRACTImmediate(N, 128);
-}
-
-/// Return the appropriate immediate to extract the specified
-/// EXTRACT_SUBVECTOR index with VEXTRACTF64x4 and VINSERTI64x4 instructions.
-unsigned X86::getExtractVEXTRACT256Immediate(SDNode *N) {
- return getExtractVEXTRACTImmediate(N, 256);
-}
-
-/// Return the appropriate immediate to insert at the specified
-/// INSERT_SUBVECTOR index with VINSERTF128 and VINSERTI128 instructions.
-unsigned X86::getInsertVINSERT128Immediate(SDNode *N) {
- return getInsertVINSERTImmediate(N, 128);
-}
-
-/// Return the appropriate immediate to insert at the specified
-/// INSERT_SUBVECTOR index with VINSERTF46x4 and VINSERTI64x4 instructions.
-unsigned X86::getInsertVINSERT256Immediate(SDNode *N) {
- return getInsertVINSERTImmediate(N, 256);
-}
-
/// Returns true if Elt is a constant zero or a floating point constant +0.0.
bool X86::isZeroNode(SDValue Elt) {
return isNullConstant(Elt) || isNullFPConstant(Elt);
Modified: llvm/trunk/lib/Target/X86/X86ISelLowering.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86ISelLowering.h?rev=314059&r1=314058&r2=314059&view=diff
==============================================================================
--- llvm/trunk/lib/Target/X86/X86ISelLowering.h (original)
+++ llvm/trunk/lib/Target/X86/X86ISelLowering.h Fri Sep 22 22:34:07 2017
@@ -624,26 +624,6 @@ namespace llvm {
/// Define some predicates that are used for node matching.
namespace X86 {
- /// Return the appropriate
- /// immediate to extract the specified EXTRACT_SUBVECTOR index
- /// with VEXTRACTF128, VEXTRACTI128 instructions.
- unsigned getExtractVEXTRACT128Immediate(SDNode *N);
-
- /// Return the appropriate
- /// immediate to insert at the specified INSERT_SUBVECTOR index
- /// with VINSERTF128, VINSERT128 instructions.
- unsigned getInsertVINSERT128Immediate(SDNode *N);
-
- /// Return the appropriate
- /// immediate to extract the specified EXTRACT_SUBVECTOR index
- /// with VEXTRACTF64X4, VEXTRACTI64x4 instructions.
- unsigned getExtractVEXTRACT256Immediate(SDNode *N);
-
- /// Return the appropriate
- /// immediate to insert at the specified INSERT_SUBVECTOR index
- /// with VINSERTF64x4, VINSERTI64x4 instructions.
- unsigned getInsertVINSERT256Immediate(SDNode *N);
-
/// Returns true if Elt is a constant zero or floating point constant +0.0.
bool isZeroNode(SDValue Elt);
Modified: llvm/trunk/lib/Target/X86/X86InstrFragmentsSIMD.td
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86InstrFragmentsSIMD.td?rev=314059&r1=314058&r2=314059&view=diff
==============================================================================
--- llvm/trunk/lib/Target/X86/X86InstrFragmentsSIMD.td (original)
+++ llvm/trunk/lib/Target/X86/X86InstrFragmentsSIMD.td Fri Sep 22 22:34:07 2017
@@ -884,25 +884,25 @@ def BYTE_imm : SDNodeXForm<imm, [{
// EXTRACT_get_vextract128_imm xform function: convert extract_subvector index
// to VEXTRACTF128/VEXTRACTI128 imm.
def EXTRACT_get_vextract128_imm : SDNodeXForm<extract_subvector, [{
- return getI8Imm(X86::getExtractVEXTRACT128Immediate(N), SDLoc(N));
+ return getExtractVEXTRACTImmediate(N, 128, SDLoc(N));
}]>;
// INSERT_get_vinsert128_imm xform function: convert insert_subvector index to
// VINSERTF128/VINSERTI128 imm.
def INSERT_get_vinsert128_imm : SDNodeXForm<insert_subvector, [{
- return getI8Imm(X86::getInsertVINSERT128Immediate(N), SDLoc(N));
+ return getInsertVINSERTImmediate(N, 128, SDLoc(N));
}]>;
// EXTRACT_get_vextract256_imm xform function: convert extract_subvector index
// to VEXTRACTF64x4 imm.
def EXTRACT_get_vextract256_imm : SDNodeXForm<extract_subvector, [{
- return getI8Imm(X86::getExtractVEXTRACT256Immediate(N), SDLoc(N));
+ return getExtractVEXTRACTImmediate(N, 256, SDLoc(N));
}]>;
// INSERT_get_vinsert256_imm xform function: convert insert_subvector index to
// VINSERTF64x4 imm.
def INSERT_get_vinsert256_imm : SDNodeXForm<insert_subvector, [{
- return getI8Imm(X86::getInsertVINSERT256Immediate(N), SDLoc(N));
+ return getInsertVINSERTImmediate(N, 256, SDLoc(N));
}]>;
def vextract128_extract : PatFrag<(ops node:$bigvec, node:$index),
More information about the llvm-commits
mailing list