Rename functions referring to VMOV immediates to refer to NEON "modified

immediate" operands.  These functions have so far only been used for VMOV
but they also apply to other NEON instructions with modified immediate
operands.  No functional changes.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@105969 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Bob Wilson 2010-06-14 22:19:57 +00:00
parent c834f413ae
commit d3c4284849
3 changed files with 34 additions and 30 deletions

View File

@ -2758,13 +2758,15 @@ static SDValue LowerVSETCC(SDValue Op, SelectionDAG &DAG) {
return Result; return Result;
} }
/// isVMOVSplat - Check if the specified splat value corresponds to an immediate /// isNEONModifiedImm - Check if the specified splat value corresponds to a
/// VMOV instruction. If so, return either the constant being splatted or the /// valid vector constant for a NEON instruction with a "modified immediate"
/// encoded value, depending on the DoEncode parameter. The format of the /// operand (e.g., VMOV). If so, return either the constant being
/// encoded value is: bit12=Op, bits11-8=Cmode, bits7-0=Immediate. /// splatted or the encoded value, depending on the DoEncode parameter. The
static SDValue isVMOVSplat(uint64_t SplatBits, uint64_t SplatUndef, /// format of the encoded value is: bit12=Op, bits11-8=Cmode,
unsigned SplatBitSize, SelectionDAG &DAG, /// bits7-0=Immediate.
bool DoEncode) { static SDValue isNEONModifiedImm(uint64_t SplatBits, uint64_t SplatUndef,
unsigned SplatBitSize, SelectionDAG &DAG,
bool DoEncode) {
unsigned Op, Cmode, Imm; unsigned Op, Cmode, Imm;
EVT VT; EVT VT;
@ -2885,11 +2887,12 @@ static SDValue isVMOVSplat(uint64_t SplatBits, uint64_t SplatUndef,
return DAG.getTargetConstant(SplatBits, VT); return DAG.getTargetConstant(SplatBits, VT);
} }
/// getVMOVImm - If this is a build_vector of constants which can be
/// formed by using a VMOV instruction of the specified element size, /// getNEONModImm - If this is a valid vector constant for a NEON instruction
/// return the constant being splatted. The ByteSize field indicates the /// with a "modified immediate" operand (e.g., VMOV) of the specified element
/// number of bytes of each element [1248]. /// size, return the encoded value for that immediate. The ByteSize field
SDValue ARM::getVMOVImm(SDNode *N, unsigned ByteSize, SelectionDAG &DAG) { /// indicates the number of bytes of each element [1248].
SDValue ARM::getNEONModImm(SDNode *N, unsigned ByteSize, SelectionDAG &DAG) {
BuildVectorSDNode *BVN = dyn_cast<BuildVectorSDNode>(N); BuildVectorSDNode *BVN = dyn_cast<BuildVectorSDNode>(N);
APInt SplatBits, SplatUndef; APInt SplatBits, SplatUndef;
unsigned SplatBitSize; unsigned SplatBitSize;
@ -2901,8 +2904,8 @@ SDValue ARM::getVMOVImm(SDNode *N, unsigned ByteSize, SelectionDAG &DAG) {
if (SplatBitSize > ByteSize * 8) if (SplatBitSize > ByteSize * 8)
return SDValue(); return SDValue();
return isVMOVSplat(SplatBits.getZExtValue(), SplatUndef.getZExtValue(), return isNEONModifiedImm(SplatBits.getZExtValue(), SplatUndef.getZExtValue(),
SplatBitSize, DAG, true); SplatBitSize, DAG, true);
} }
static bool isVEXTMask(const SmallVectorImpl<int> &M, EVT VT, static bool isVEXTMask(const SmallVectorImpl<int> &M, EVT VT,
@ -3142,9 +3145,10 @@ static SDValue LowerBUILD_VECTOR(SDValue Op, SelectionDAG &DAG) {
bool HasAnyUndefs; bool HasAnyUndefs;
if (BVN->isConstantSplat(SplatBits, SplatUndef, SplatBitSize, HasAnyUndefs)) { if (BVN->isConstantSplat(SplatBits, SplatUndef, SplatBitSize, HasAnyUndefs)) {
if (SplatBitSize <= 64) { if (SplatBitSize <= 64) {
SDValue Val = isVMOVSplat(SplatBits.getZExtValue(), // Check if an immediate VMOV works.
SplatUndef.getZExtValue(), SplatBitSize, DAG, SDValue Val = isNEONModifiedImm(SplatBits.getZExtValue(),
false); SplatUndef.getZExtValue(),
SplatBitSize, DAG, false);
if (Val.getNode()) if (Val.getNode())
return BuildSplat(Val, VT, DAG, dl); return BuildSplat(Val, VT, DAG, dl);
} }

View File

@ -150,11 +150,11 @@ namespace llvm {
/// Define some predicates that are used for node matching. /// Define some predicates that are used for node matching.
namespace ARM { namespace ARM {
/// getVMOVImm - If this is a build_vector of constants which can be /// getNEONModImm - If this is a valid vector constant for a NEON
/// formed by using a VMOV instruction of the specified element size, /// instruction with a "modified immediate" operand (e.g., VMOV) of the
/// return the constant being splatted. The ByteSize field indicates the /// specified element size, return the encoded value for that immediate.
/// number of bytes of each element [1248]. /// The ByteSize field indicates the number of bytes of each element [1248].
SDValue getVMOVImm(SDNode *N, unsigned ByteSize, SelectionDAG &DAG); SDValue getNEONModImm(SDNode *N, unsigned ByteSize, SelectionDAG &DAG);
/// getVFPf32Imm / getVFPf64Imm - If the given fp immediate can be /// getVFPf32Imm / getVFPf64Imm - If the given fp immediate can be
/// materialized with a VMOV.f32 / VMOV.f64 (i.e. fconsts / fconstd) /// materialized with a VMOV.f32 / VMOV.f64 (i.e. fconsts / fconstd)

View File

@ -2820,34 +2820,34 @@ def VMOVQQQQ : PseudoInst<(outs QQQQPR:$dst), (ins QQQQPR:$src),
// VMOV_get_imm8 xform function: convert build_vector to VMOV.i8 imm. // VMOV_get_imm8 xform function: convert build_vector to VMOV.i8 imm.
def VMOV_get_imm8 : SDNodeXForm<build_vector, [{ def VMOV_get_imm8 : SDNodeXForm<build_vector, [{
return ARM::getVMOVImm(N, 1, *CurDAG); return ARM::getNEONModImm(N, 1, *CurDAG);
}]>; }]>;
def vmovImm8 : PatLeaf<(build_vector), [{ def vmovImm8 : PatLeaf<(build_vector), [{
return ARM::getVMOVImm(N, 1, *CurDAG).getNode() != 0; return ARM::getNEONModImm(N, 1, *CurDAG).getNode() != 0;
}], VMOV_get_imm8>; }], VMOV_get_imm8>;
// VMOV_get_imm16 xform function: convert build_vector to VMOV.i16 imm. // VMOV_get_imm16 xform function: convert build_vector to VMOV.i16 imm.
def VMOV_get_imm16 : SDNodeXForm<build_vector, [{ def VMOV_get_imm16 : SDNodeXForm<build_vector, [{
return ARM::getVMOVImm(N, 2, *CurDAG); return ARM::getNEONModImm(N, 2, *CurDAG);
}]>; }]>;
def vmovImm16 : PatLeaf<(build_vector), [{ def vmovImm16 : PatLeaf<(build_vector), [{
return ARM::getVMOVImm(N, 2, *CurDAG).getNode() != 0; return ARM::getNEONModImm(N, 2, *CurDAG).getNode() != 0;
}], VMOV_get_imm16>; }], VMOV_get_imm16>;
// VMOV_get_imm32 xform function: convert build_vector to VMOV.i32 imm. // VMOV_get_imm32 xform function: convert build_vector to VMOV.i32 imm.
def VMOV_get_imm32 : SDNodeXForm<build_vector, [{ def VMOV_get_imm32 : SDNodeXForm<build_vector, [{
return ARM::getVMOVImm(N, 4, *CurDAG); return ARM::getNEONModImm(N, 4, *CurDAG);
}]>; }]>;
def vmovImm32 : PatLeaf<(build_vector), [{ def vmovImm32 : PatLeaf<(build_vector), [{
return ARM::getVMOVImm(N, 4, *CurDAG).getNode() != 0; return ARM::getNEONModImm(N, 4, *CurDAG).getNode() != 0;
}], VMOV_get_imm32>; }], VMOV_get_imm32>;
// VMOV_get_imm64 xform function: convert build_vector to VMOV.i64 imm. // VMOV_get_imm64 xform function: convert build_vector to VMOV.i64 imm.
def VMOV_get_imm64 : SDNodeXForm<build_vector, [{ def VMOV_get_imm64 : SDNodeXForm<build_vector, [{
return ARM::getVMOVImm(N, 8, *CurDAG); return ARM::getNEONModImm(N, 8, *CurDAG);
}]>; }]>;
def vmovImm64 : PatLeaf<(build_vector), [{ def vmovImm64 : PatLeaf<(build_vector), [{
return ARM::getVMOVImm(N, 8, *CurDAG).getNode() != 0; return ARM::getNEONModImm(N, 8, *CurDAG).getNode() != 0;
}], VMOV_get_imm64>; }], VMOV_get_imm64>;
// Note: Some of the cmode bits in the following VMOV instructions need to // Note: Some of the cmode bits in the following VMOV instructions need to