2012-05-05 04:18:50 +08:00
|
|
|
//===-- NVPTXISelDAGToDAG.cpp - A dag to dag inst selector for NVPTX ------===//
|
|
|
|
//
|
|
|
|
// The LLVM Compiler Infrastructure
|
|
|
|
//
|
|
|
|
// This file is distributed under the University of Illinois Open Source
|
|
|
|
// License. See LICENSE.TXT for details.
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
//
|
|
|
|
// This file defines an instruction selector for the NVPTX target.
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
|
|
|
#include "NVPTXISelDAGToDAG.h"
|
2015-08-06 07:11:57 +08:00
|
|
|
#include "NVPTXUtilities.h"
|
2015-07-21 05:28:54 +08:00
|
|
|
#include "llvm/Analysis/ValueTracking.h"
|
2013-01-02 19:36:10 +08:00
|
|
|
#include "llvm/IR/GlobalValue.h"
|
|
|
|
#include "llvm/IR/Instructions.h"
|
2012-12-04 00:50:05 +08:00
|
|
|
#include "llvm/Support/CommandLine.h"
|
2012-05-05 04:18:50 +08:00
|
|
|
#include "llvm/Support/Debug.h"
|
|
|
|
#include "llvm/Support/ErrorHandling.h"
|
2012-12-04 00:50:05 +08:00
|
|
|
#include "llvm/Support/raw_ostream.h"
|
2012-05-05 04:18:50 +08:00
|
|
|
#include "llvm/Target/TargetIntrinsicInfo.h"
|
|
|
|
|
|
|
|
using namespace llvm;
|
|
|
|
|
2014-04-22 10:41:26 +08:00
|
|
|
#define DEBUG_TYPE "nvptx-isel"
|
|
|
|
|
2013-03-30 22:29:21 +08:00
|
|
|
static cl::opt<int> UsePrecDivF32(
|
2013-10-19 07:38:13 +08:00
|
|
|
"nvptx-prec-divf32", cl::ZeroOrMore, cl::Hidden,
|
2013-03-30 22:29:21 +08:00
|
|
|
cl::desc("NVPTX Specifies: 0 use div.approx, 1 use div.full, 2 use"
|
2014-08-12 02:04:46 +08:00
|
|
|
" IEEE Compliant F32 div.rnd if available."),
|
2013-03-30 22:29:21 +08:00
|
|
|
cl::init(2));
|
2012-05-05 04:18:50 +08:00
|
|
|
|
2013-05-22 00:51:30 +08:00
|
|
|
static cl::opt<bool>
|
2013-10-19 07:38:13 +08:00
|
|
|
UsePrecSqrtF32("nvptx-prec-sqrtf32", cl::Hidden,
|
2013-05-22 00:51:30 +08:00
|
|
|
cl::desc("NVPTX Specific: 0 use sqrt.approx, 1 use sqrt.rn."),
|
|
|
|
cl::init(true));
|
|
|
|
|
2013-07-22 20:18:04 +08:00
|
|
|
static cl::opt<bool>
|
2013-10-19 07:38:13 +08:00
|
|
|
FtzEnabled("nvptx-f32ftz", cl::ZeroOrMore, cl::Hidden,
|
2013-07-22 20:18:04 +08:00
|
|
|
cl::desc("NVPTX Specific: Flush f32 subnormals to sign-preserving zero."),
|
|
|
|
cl::init(false));
|
|
|
|
|
2012-05-05 04:18:50 +08:00
|
|
|
/// createNVPTXISelDag - This pass converts a legalized DAG into a
|
|
|
|
/// NVPTX-specific DAG, ready for instruction scheduling.
|
|
|
|
FunctionPass *llvm::createNVPTXISelDag(NVPTXTargetMachine &TM,
|
|
|
|
llvm::CodeGenOpt::Level OptLevel) {
|
|
|
|
return new NVPTXDAGToDAGISel(TM, OptLevel);
|
|
|
|
}
|
|
|
|
|
|
|
|
NVPTXDAGToDAGISel::NVPTXDAGToDAGISel(NVPTXTargetMachine &tm,
|
|
|
|
CodeGenOpt::Level OptLevel)
|
2015-02-19 08:08:27 +08:00
|
|
|
: SelectionDAGISel(tm, OptLevel), TM(tm) {
|
2012-05-05 04:18:50 +08:00
|
|
|
doMulWide = (OptLevel > 0);
|
2013-07-22 20:18:04 +08:00
|
|
|
}
|
|
|
|
|
2015-01-30 09:40:59 +08:00
|
|
|
bool NVPTXDAGToDAGISel::runOnMachineFunction(MachineFunction &MF) {
|
|
|
|
Subtarget = &static_cast<const NVPTXSubtarget &>(MF.getSubtarget());
|
|
|
|
return SelectionDAGISel::runOnMachineFunction(MF);
|
|
|
|
}
|
|
|
|
|
2013-07-22 20:18:04 +08:00
|
|
|
int NVPTXDAGToDAGISel::getDivF32Level() const {
|
|
|
|
if (UsePrecDivF32.getNumOccurrences() > 0) {
|
|
|
|
// If nvptx-prec-div32=N is used on the command-line, always honor it
|
|
|
|
return UsePrecDivF32;
|
|
|
|
} else {
|
|
|
|
// Otherwise, use div.approx if fast math is enabled
|
|
|
|
if (TM.Options.UnsafeFPMath)
|
|
|
|
return 0;
|
|
|
|
else
|
|
|
|
return 2;
|
|
|
|
}
|
|
|
|
}
|
2012-05-05 04:18:50 +08:00
|
|
|
|
2013-07-22 20:18:04 +08:00
|
|
|
bool NVPTXDAGToDAGISel::usePrecSqrtF32() const {
|
|
|
|
if (UsePrecSqrtF32.getNumOccurrences() > 0) {
|
|
|
|
// If nvptx-prec-sqrtf32 is used on the command-line, always honor it
|
|
|
|
return UsePrecSqrtF32;
|
|
|
|
} else {
|
|
|
|
// Otherwise, use sqrt.approx if fast math is enabled
|
2015-03-24 00:26:23 +08:00
|
|
|
return !TM.Options.UnsafeFPMath;
|
2013-07-22 20:18:04 +08:00
|
|
|
}
|
|
|
|
}
|
2012-05-05 04:18:50 +08:00
|
|
|
|
2013-07-22 20:18:04 +08:00
|
|
|
bool NVPTXDAGToDAGISel::useF32FTZ() const {
|
|
|
|
if (FtzEnabled.getNumOccurrences() > 0) {
|
|
|
|
// If nvptx-f32ftz is used on the command-line, always honor it
|
|
|
|
return FtzEnabled;
|
|
|
|
} else {
|
|
|
|
const Function *F = MF->getFunction();
|
|
|
|
// Otherwise, check for an nvptx-f32ftz attribute on the function
|
|
|
|
if (F->hasFnAttribute("nvptx-f32ftz"))
|
2015-02-14 23:35:43 +08:00
|
|
|
return F->getFnAttribute("nvptx-f32ftz").getValueAsString() == "true";
|
2013-07-22 20:18:04 +08:00
|
|
|
else
|
|
|
|
return false;
|
|
|
|
}
|
2012-05-05 04:18:50 +08:00
|
|
|
}
|
|
|
|
|
2014-07-18 02:10:09 +08:00
|
|
|
bool NVPTXDAGToDAGISel::allowFMA() const {
|
2015-01-30 09:40:59 +08:00
|
|
|
const NVPTXTargetLowering *TL = Subtarget->getTargetLowering();
|
2014-07-18 02:10:09 +08:00
|
|
|
return TL->allowFMA(*MF, OptLevel);
|
|
|
|
}
|
|
|
|
|
2017-01-14 02:48:13 +08:00
|
|
|
bool NVPTXDAGToDAGISel::allowUnsafeFPMath() const {
|
|
|
|
const NVPTXTargetLowering *TL = Subtarget->getTargetLowering();
|
|
|
|
return TL->allowUnsafeFPMath(*MF);
|
|
|
|
}
|
|
|
|
|
2012-05-05 04:18:50 +08:00
|
|
|
/// Select - Select instructions not customized! Used for
|
|
|
|
/// expanded, promoted and normal instructions.
|
2016-05-14 05:12:53 +08:00
|
|
|
void NVPTXDAGToDAGISel::Select(SDNode *N) {
|
2012-05-05 04:18:50 +08:00
|
|
|
|
2013-09-22 16:21:56 +08:00
|
|
|
if (N->isMachineOpcode()) {
|
|
|
|
N->setNodeId(-1);
|
2016-05-14 05:12:53 +08:00
|
|
|
return; // Already selected.
|
2013-09-22 16:21:56 +08:00
|
|
|
}
|
2012-05-05 04:18:50 +08:00
|
|
|
|
|
|
|
switch (N->getOpcode()) {
|
|
|
|
case ISD::LOAD:
|
2016-05-14 05:12:53 +08:00
|
|
|
if (tryLoad(N))
|
|
|
|
return;
|
2012-05-05 04:18:50 +08:00
|
|
|
break;
|
|
|
|
case ISD::STORE:
|
2016-05-14 05:12:53 +08:00
|
|
|
if (tryStore(N))
|
|
|
|
return;
|
2012-05-05 04:18:50 +08:00
|
|
|
break;
|
2013-02-12 22:18:49 +08:00
|
|
|
case NVPTXISD::LoadV2:
|
|
|
|
case NVPTXISD::LoadV4:
|
2016-05-14 05:12:53 +08:00
|
|
|
if (tryLoadVector(N))
|
|
|
|
return;
|
2013-02-12 22:18:49 +08:00
|
|
|
break;
|
|
|
|
case NVPTXISD::LDGV2:
|
|
|
|
case NVPTXISD::LDGV4:
|
|
|
|
case NVPTXISD::LDUV2:
|
|
|
|
case NVPTXISD::LDUV4:
|
2016-05-14 05:12:53 +08:00
|
|
|
if (tryLDGLDU(N))
|
|
|
|
return;
|
2013-02-12 22:18:49 +08:00
|
|
|
break;
|
|
|
|
case NVPTXISD::StoreV2:
|
|
|
|
case NVPTXISD::StoreV4:
|
2016-05-14 05:12:53 +08:00
|
|
|
if (tryStoreVector(N))
|
|
|
|
return;
|
2013-02-12 22:18:49 +08:00
|
|
|
break;
|
2013-06-29 01:57:59 +08:00
|
|
|
case NVPTXISD::LoadParam:
|
|
|
|
case NVPTXISD::LoadParamV2:
|
|
|
|
case NVPTXISD::LoadParamV4:
|
2016-05-14 05:12:53 +08:00
|
|
|
if (tryLoadParam(N))
|
|
|
|
return;
|
2013-06-29 01:57:59 +08:00
|
|
|
break;
|
|
|
|
case NVPTXISD::StoreRetval:
|
|
|
|
case NVPTXISD::StoreRetvalV2:
|
|
|
|
case NVPTXISD::StoreRetvalV4:
|
2016-05-14 05:12:53 +08:00
|
|
|
if (tryStoreRetval(N))
|
|
|
|
return;
|
2013-06-29 01:57:59 +08:00
|
|
|
break;
|
|
|
|
case NVPTXISD::StoreParam:
|
|
|
|
case NVPTXISD::StoreParamV2:
|
|
|
|
case NVPTXISD::StoreParamV4:
|
|
|
|
case NVPTXISD::StoreParamS32:
|
|
|
|
case NVPTXISD::StoreParamU32:
|
2016-05-14 05:12:53 +08:00
|
|
|
if (tryStoreParam(N))
|
|
|
|
return;
|
2013-06-29 01:57:59 +08:00
|
|
|
break;
|
2014-04-09 23:39:15 +08:00
|
|
|
case ISD::INTRINSIC_WO_CHAIN:
|
2016-05-14 05:12:53 +08:00
|
|
|
if (tryIntrinsicNoChain(N))
|
|
|
|
return;
|
2014-04-09 23:39:15 +08:00
|
|
|
break;
|
2014-06-28 02:35:51 +08:00
|
|
|
case ISD::INTRINSIC_W_CHAIN:
|
2016-05-14 05:12:53 +08:00
|
|
|
if (tryIntrinsicChain(N))
|
|
|
|
return;
|
2014-06-28 02:35:51 +08:00
|
|
|
break;
|
2014-07-17 19:59:04 +08:00
|
|
|
case NVPTXISD::Tex1DFloatS32:
|
2014-04-09 23:39:15 +08:00
|
|
|
case NVPTXISD::Tex1DFloatFloat:
|
|
|
|
case NVPTXISD::Tex1DFloatFloatLevel:
|
|
|
|
case NVPTXISD::Tex1DFloatFloatGrad:
|
2014-07-17 19:59:04 +08:00
|
|
|
case NVPTXISD::Tex1DS32S32:
|
|
|
|
case NVPTXISD::Tex1DS32Float:
|
|
|
|
case NVPTXISD::Tex1DS32FloatLevel:
|
|
|
|
case NVPTXISD::Tex1DS32FloatGrad:
|
|
|
|
case NVPTXISD::Tex1DU32S32:
|
|
|
|
case NVPTXISD::Tex1DU32Float:
|
|
|
|
case NVPTXISD::Tex1DU32FloatLevel:
|
|
|
|
case NVPTXISD::Tex1DU32FloatGrad:
|
|
|
|
case NVPTXISD::Tex1DArrayFloatS32:
|
2014-04-09 23:39:15 +08:00
|
|
|
case NVPTXISD::Tex1DArrayFloatFloat:
|
|
|
|
case NVPTXISD::Tex1DArrayFloatFloatLevel:
|
|
|
|
case NVPTXISD::Tex1DArrayFloatFloatGrad:
|
2014-07-17 19:59:04 +08:00
|
|
|
case NVPTXISD::Tex1DArrayS32S32:
|
|
|
|
case NVPTXISD::Tex1DArrayS32Float:
|
|
|
|
case NVPTXISD::Tex1DArrayS32FloatLevel:
|
|
|
|
case NVPTXISD::Tex1DArrayS32FloatGrad:
|
|
|
|
case NVPTXISD::Tex1DArrayU32S32:
|
|
|
|
case NVPTXISD::Tex1DArrayU32Float:
|
|
|
|
case NVPTXISD::Tex1DArrayU32FloatLevel:
|
|
|
|
case NVPTXISD::Tex1DArrayU32FloatGrad:
|
|
|
|
case NVPTXISD::Tex2DFloatS32:
|
2014-04-09 23:39:15 +08:00
|
|
|
case NVPTXISD::Tex2DFloatFloat:
|
|
|
|
case NVPTXISD::Tex2DFloatFloatLevel:
|
|
|
|
case NVPTXISD::Tex2DFloatFloatGrad:
|
2014-07-17 19:59:04 +08:00
|
|
|
case NVPTXISD::Tex2DS32S32:
|
|
|
|
case NVPTXISD::Tex2DS32Float:
|
|
|
|
case NVPTXISD::Tex2DS32FloatLevel:
|
|
|
|
case NVPTXISD::Tex2DS32FloatGrad:
|
|
|
|
case NVPTXISD::Tex2DU32S32:
|
|
|
|
case NVPTXISD::Tex2DU32Float:
|
|
|
|
case NVPTXISD::Tex2DU32FloatLevel:
|
|
|
|
case NVPTXISD::Tex2DU32FloatGrad:
|
|
|
|
case NVPTXISD::Tex2DArrayFloatS32:
|
2014-04-09 23:39:15 +08:00
|
|
|
case NVPTXISD::Tex2DArrayFloatFloat:
|
|
|
|
case NVPTXISD::Tex2DArrayFloatFloatLevel:
|
|
|
|
case NVPTXISD::Tex2DArrayFloatFloatGrad:
|
2014-07-17 19:59:04 +08:00
|
|
|
case NVPTXISD::Tex2DArrayS32S32:
|
|
|
|
case NVPTXISD::Tex2DArrayS32Float:
|
|
|
|
case NVPTXISD::Tex2DArrayS32FloatLevel:
|
|
|
|
case NVPTXISD::Tex2DArrayS32FloatGrad:
|
|
|
|
case NVPTXISD::Tex2DArrayU32S32:
|
|
|
|
case NVPTXISD::Tex2DArrayU32Float:
|
|
|
|
case NVPTXISD::Tex2DArrayU32FloatLevel:
|
|
|
|
case NVPTXISD::Tex2DArrayU32FloatGrad:
|
|
|
|
case NVPTXISD::Tex3DFloatS32:
|
2014-04-09 23:39:15 +08:00
|
|
|
case NVPTXISD::Tex3DFloatFloat:
|
|
|
|
case NVPTXISD::Tex3DFloatFloatLevel:
|
|
|
|
case NVPTXISD::Tex3DFloatFloatGrad:
|
2014-07-17 19:59:04 +08:00
|
|
|
case NVPTXISD::Tex3DS32S32:
|
|
|
|
case NVPTXISD::Tex3DS32Float:
|
|
|
|
case NVPTXISD::Tex3DS32FloatLevel:
|
|
|
|
case NVPTXISD::Tex3DS32FloatGrad:
|
|
|
|
case NVPTXISD::Tex3DU32S32:
|
|
|
|
case NVPTXISD::Tex3DU32Float:
|
|
|
|
case NVPTXISD::Tex3DU32FloatLevel:
|
|
|
|
case NVPTXISD::Tex3DU32FloatGrad:
|
|
|
|
case NVPTXISD::TexCubeFloatFloat:
|
|
|
|
case NVPTXISD::TexCubeFloatFloatLevel:
|
|
|
|
case NVPTXISD::TexCubeS32Float:
|
|
|
|
case NVPTXISD::TexCubeS32FloatLevel:
|
|
|
|
case NVPTXISD::TexCubeU32Float:
|
|
|
|
case NVPTXISD::TexCubeU32FloatLevel:
|
|
|
|
case NVPTXISD::TexCubeArrayFloatFloat:
|
|
|
|
case NVPTXISD::TexCubeArrayFloatFloatLevel:
|
|
|
|
case NVPTXISD::TexCubeArrayS32Float:
|
|
|
|
case NVPTXISD::TexCubeArrayS32FloatLevel:
|
|
|
|
case NVPTXISD::TexCubeArrayU32Float:
|
|
|
|
case NVPTXISD::TexCubeArrayU32FloatLevel:
|
|
|
|
case NVPTXISD::Tld4R2DFloatFloat:
|
|
|
|
case NVPTXISD::Tld4G2DFloatFloat:
|
|
|
|
case NVPTXISD::Tld4B2DFloatFloat:
|
|
|
|
case NVPTXISD::Tld4A2DFloatFloat:
|
|
|
|
case NVPTXISD::Tld4R2DS64Float:
|
|
|
|
case NVPTXISD::Tld4G2DS64Float:
|
|
|
|
case NVPTXISD::Tld4B2DS64Float:
|
|
|
|
case NVPTXISD::Tld4A2DS64Float:
|
|
|
|
case NVPTXISD::Tld4R2DU64Float:
|
|
|
|
case NVPTXISD::Tld4G2DU64Float:
|
|
|
|
case NVPTXISD::Tld4B2DU64Float:
|
|
|
|
case NVPTXISD::Tld4A2DU64Float:
|
|
|
|
case NVPTXISD::TexUnified1DFloatS32:
|
|
|
|
case NVPTXISD::TexUnified1DFloatFloat:
|
|
|
|
case NVPTXISD::TexUnified1DFloatFloatLevel:
|
|
|
|
case NVPTXISD::TexUnified1DFloatFloatGrad:
|
|
|
|
case NVPTXISD::TexUnified1DS32S32:
|
|
|
|
case NVPTXISD::TexUnified1DS32Float:
|
|
|
|
case NVPTXISD::TexUnified1DS32FloatLevel:
|
|
|
|
case NVPTXISD::TexUnified1DS32FloatGrad:
|
|
|
|
case NVPTXISD::TexUnified1DU32S32:
|
|
|
|
case NVPTXISD::TexUnified1DU32Float:
|
|
|
|
case NVPTXISD::TexUnified1DU32FloatLevel:
|
|
|
|
case NVPTXISD::TexUnified1DU32FloatGrad:
|
|
|
|
case NVPTXISD::TexUnified1DArrayFloatS32:
|
|
|
|
case NVPTXISD::TexUnified1DArrayFloatFloat:
|
|
|
|
case NVPTXISD::TexUnified1DArrayFloatFloatLevel:
|
|
|
|
case NVPTXISD::TexUnified1DArrayFloatFloatGrad:
|
|
|
|
case NVPTXISD::TexUnified1DArrayS32S32:
|
|
|
|
case NVPTXISD::TexUnified1DArrayS32Float:
|
|
|
|
case NVPTXISD::TexUnified1DArrayS32FloatLevel:
|
|
|
|
case NVPTXISD::TexUnified1DArrayS32FloatGrad:
|
|
|
|
case NVPTXISD::TexUnified1DArrayU32S32:
|
|
|
|
case NVPTXISD::TexUnified1DArrayU32Float:
|
|
|
|
case NVPTXISD::TexUnified1DArrayU32FloatLevel:
|
|
|
|
case NVPTXISD::TexUnified1DArrayU32FloatGrad:
|
|
|
|
case NVPTXISD::TexUnified2DFloatS32:
|
|
|
|
case NVPTXISD::TexUnified2DFloatFloat:
|
|
|
|
case NVPTXISD::TexUnified2DFloatFloatLevel:
|
|
|
|
case NVPTXISD::TexUnified2DFloatFloatGrad:
|
|
|
|
case NVPTXISD::TexUnified2DS32S32:
|
|
|
|
case NVPTXISD::TexUnified2DS32Float:
|
|
|
|
case NVPTXISD::TexUnified2DS32FloatLevel:
|
|
|
|
case NVPTXISD::TexUnified2DS32FloatGrad:
|
|
|
|
case NVPTXISD::TexUnified2DU32S32:
|
|
|
|
case NVPTXISD::TexUnified2DU32Float:
|
|
|
|
case NVPTXISD::TexUnified2DU32FloatLevel:
|
|
|
|
case NVPTXISD::TexUnified2DU32FloatGrad:
|
|
|
|
case NVPTXISD::TexUnified2DArrayFloatS32:
|
|
|
|
case NVPTXISD::TexUnified2DArrayFloatFloat:
|
|
|
|
case NVPTXISD::TexUnified2DArrayFloatFloatLevel:
|
|
|
|
case NVPTXISD::TexUnified2DArrayFloatFloatGrad:
|
|
|
|
case NVPTXISD::TexUnified2DArrayS32S32:
|
|
|
|
case NVPTXISD::TexUnified2DArrayS32Float:
|
|
|
|
case NVPTXISD::TexUnified2DArrayS32FloatLevel:
|
|
|
|
case NVPTXISD::TexUnified2DArrayS32FloatGrad:
|
|
|
|
case NVPTXISD::TexUnified2DArrayU32S32:
|
|
|
|
case NVPTXISD::TexUnified2DArrayU32Float:
|
|
|
|
case NVPTXISD::TexUnified2DArrayU32FloatLevel:
|
|
|
|
case NVPTXISD::TexUnified2DArrayU32FloatGrad:
|
|
|
|
case NVPTXISD::TexUnified3DFloatS32:
|
|
|
|
case NVPTXISD::TexUnified3DFloatFloat:
|
|
|
|
case NVPTXISD::TexUnified3DFloatFloatLevel:
|
|
|
|
case NVPTXISD::TexUnified3DFloatFloatGrad:
|
|
|
|
case NVPTXISD::TexUnified3DS32S32:
|
|
|
|
case NVPTXISD::TexUnified3DS32Float:
|
|
|
|
case NVPTXISD::TexUnified3DS32FloatLevel:
|
|
|
|
case NVPTXISD::TexUnified3DS32FloatGrad:
|
|
|
|
case NVPTXISD::TexUnified3DU32S32:
|
|
|
|
case NVPTXISD::TexUnified3DU32Float:
|
|
|
|
case NVPTXISD::TexUnified3DU32FloatLevel:
|
|
|
|
case NVPTXISD::TexUnified3DU32FloatGrad:
|
|
|
|
case NVPTXISD::TexUnifiedCubeFloatFloat:
|
|
|
|
case NVPTXISD::TexUnifiedCubeFloatFloatLevel:
|
|
|
|
case NVPTXISD::TexUnifiedCubeS32Float:
|
|
|
|
case NVPTXISD::TexUnifiedCubeS32FloatLevel:
|
|
|
|
case NVPTXISD::TexUnifiedCubeU32Float:
|
|
|
|
case NVPTXISD::TexUnifiedCubeU32FloatLevel:
|
|
|
|
case NVPTXISD::TexUnifiedCubeArrayFloatFloat:
|
|
|
|
case NVPTXISD::TexUnifiedCubeArrayFloatFloatLevel:
|
|
|
|
case NVPTXISD::TexUnifiedCubeArrayS32Float:
|
|
|
|
case NVPTXISD::TexUnifiedCubeArrayS32FloatLevel:
|
|
|
|
case NVPTXISD::TexUnifiedCubeArrayU32Float:
|
|
|
|
case NVPTXISD::TexUnifiedCubeArrayU32FloatLevel:
|
|
|
|
case NVPTXISD::Tld4UnifiedR2DFloatFloat:
|
|
|
|
case NVPTXISD::Tld4UnifiedG2DFloatFloat:
|
|
|
|
case NVPTXISD::Tld4UnifiedB2DFloatFloat:
|
|
|
|
case NVPTXISD::Tld4UnifiedA2DFloatFloat:
|
|
|
|
case NVPTXISD::Tld4UnifiedR2DS64Float:
|
|
|
|
case NVPTXISD::Tld4UnifiedG2DS64Float:
|
|
|
|
case NVPTXISD::Tld4UnifiedB2DS64Float:
|
|
|
|
case NVPTXISD::Tld4UnifiedA2DS64Float:
|
|
|
|
case NVPTXISD::Tld4UnifiedR2DU64Float:
|
|
|
|
case NVPTXISD::Tld4UnifiedG2DU64Float:
|
|
|
|
case NVPTXISD::Tld4UnifiedB2DU64Float:
|
|
|
|
case NVPTXISD::Tld4UnifiedA2DU64Float:
|
2016-05-14 05:12:53 +08:00
|
|
|
if (tryTextureIntrinsic(N))
|
|
|
|
return;
|
2014-04-09 23:39:15 +08:00
|
|
|
break;
|
2014-07-17 19:59:04 +08:00
|
|
|
case NVPTXISD::Suld1DI8Clamp:
|
|
|
|
case NVPTXISD::Suld1DI16Clamp:
|
|
|
|
case NVPTXISD::Suld1DI32Clamp:
|
|
|
|
case NVPTXISD::Suld1DI64Clamp:
|
|
|
|
case NVPTXISD::Suld1DV2I8Clamp:
|
|
|
|
case NVPTXISD::Suld1DV2I16Clamp:
|
|
|
|
case NVPTXISD::Suld1DV2I32Clamp:
|
|
|
|
case NVPTXISD::Suld1DV2I64Clamp:
|
|
|
|
case NVPTXISD::Suld1DV4I8Clamp:
|
|
|
|
case NVPTXISD::Suld1DV4I16Clamp:
|
|
|
|
case NVPTXISD::Suld1DV4I32Clamp:
|
|
|
|
case NVPTXISD::Suld1DArrayI8Clamp:
|
|
|
|
case NVPTXISD::Suld1DArrayI16Clamp:
|
|
|
|
case NVPTXISD::Suld1DArrayI32Clamp:
|
|
|
|
case NVPTXISD::Suld1DArrayI64Clamp:
|
|
|
|
case NVPTXISD::Suld1DArrayV2I8Clamp:
|
|
|
|
case NVPTXISD::Suld1DArrayV2I16Clamp:
|
|
|
|
case NVPTXISD::Suld1DArrayV2I32Clamp:
|
|
|
|
case NVPTXISD::Suld1DArrayV2I64Clamp:
|
|
|
|
case NVPTXISD::Suld1DArrayV4I8Clamp:
|
|
|
|
case NVPTXISD::Suld1DArrayV4I16Clamp:
|
|
|
|
case NVPTXISD::Suld1DArrayV4I32Clamp:
|
|
|
|
case NVPTXISD::Suld2DI8Clamp:
|
|
|
|
case NVPTXISD::Suld2DI16Clamp:
|
|
|
|
case NVPTXISD::Suld2DI32Clamp:
|
|
|
|
case NVPTXISD::Suld2DI64Clamp:
|
|
|
|
case NVPTXISD::Suld2DV2I8Clamp:
|
|
|
|
case NVPTXISD::Suld2DV2I16Clamp:
|
|
|
|
case NVPTXISD::Suld2DV2I32Clamp:
|
|
|
|
case NVPTXISD::Suld2DV2I64Clamp:
|
|
|
|
case NVPTXISD::Suld2DV4I8Clamp:
|
|
|
|
case NVPTXISD::Suld2DV4I16Clamp:
|
|
|
|
case NVPTXISD::Suld2DV4I32Clamp:
|
|
|
|
case NVPTXISD::Suld2DArrayI8Clamp:
|
|
|
|
case NVPTXISD::Suld2DArrayI16Clamp:
|
|
|
|
case NVPTXISD::Suld2DArrayI32Clamp:
|
|
|
|
case NVPTXISD::Suld2DArrayI64Clamp:
|
|
|
|
case NVPTXISD::Suld2DArrayV2I8Clamp:
|
|
|
|
case NVPTXISD::Suld2DArrayV2I16Clamp:
|
|
|
|
case NVPTXISD::Suld2DArrayV2I32Clamp:
|
|
|
|
case NVPTXISD::Suld2DArrayV2I64Clamp:
|
|
|
|
case NVPTXISD::Suld2DArrayV4I8Clamp:
|
|
|
|
case NVPTXISD::Suld2DArrayV4I16Clamp:
|
|
|
|
case NVPTXISD::Suld2DArrayV4I32Clamp:
|
|
|
|
case NVPTXISD::Suld3DI8Clamp:
|
|
|
|
case NVPTXISD::Suld3DI16Clamp:
|
|
|
|
case NVPTXISD::Suld3DI32Clamp:
|
|
|
|
case NVPTXISD::Suld3DI64Clamp:
|
|
|
|
case NVPTXISD::Suld3DV2I8Clamp:
|
|
|
|
case NVPTXISD::Suld3DV2I16Clamp:
|
|
|
|
case NVPTXISD::Suld3DV2I32Clamp:
|
|
|
|
case NVPTXISD::Suld3DV2I64Clamp:
|
|
|
|
case NVPTXISD::Suld3DV4I8Clamp:
|
|
|
|
case NVPTXISD::Suld3DV4I16Clamp:
|
|
|
|
case NVPTXISD::Suld3DV4I32Clamp:
|
2014-04-09 23:39:15 +08:00
|
|
|
case NVPTXISD::Suld1DI8Trap:
|
|
|
|
case NVPTXISD::Suld1DI16Trap:
|
|
|
|
case NVPTXISD::Suld1DI32Trap:
|
2014-07-17 19:59:04 +08:00
|
|
|
case NVPTXISD::Suld1DI64Trap:
|
2014-04-09 23:39:15 +08:00
|
|
|
case NVPTXISD::Suld1DV2I8Trap:
|
|
|
|
case NVPTXISD::Suld1DV2I16Trap:
|
|
|
|
case NVPTXISD::Suld1DV2I32Trap:
|
2014-07-17 19:59:04 +08:00
|
|
|
case NVPTXISD::Suld1DV2I64Trap:
|
2014-04-09 23:39:15 +08:00
|
|
|
case NVPTXISD::Suld1DV4I8Trap:
|
|
|
|
case NVPTXISD::Suld1DV4I16Trap:
|
|
|
|
case NVPTXISD::Suld1DV4I32Trap:
|
|
|
|
case NVPTXISD::Suld1DArrayI8Trap:
|
|
|
|
case NVPTXISD::Suld1DArrayI16Trap:
|
|
|
|
case NVPTXISD::Suld1DArrayI32Trap:
|
2014-07-17 19:59:04 +08:00
|
|
|
case NVPTXISD::Suld1DArrayI64Trap:
|
2014-04-09 23:39:15 +08:00
|
|
|
case NVPTXISD::Suld1DArrayV2I8Trap:
|
|
|
|
case NVPTXISD::Suld1DArrayV2I16Trap:
|
|
|
|
case NVPTXISD::Suld1DArrayV2I32Trap:
|
2014-07-17 19:59:04 +08:00
|
|
|
case NVPTXISD::Suld1DArrayV2I64Trap:
|
2014-04-09 23:39:15 +08:00
|
|
|
case NVPTXISD::Suld1DArrayV4I8Trap:
|
|
|
|
case NVPTXISD::Suld1DArrayV4I16Trap:
|
|
|
|
case NVPTXISD::Suld1DArrayV4I32Trap:
|
|
|
|
case NVPTXISD::Suld2DI8Trap:
|
|
|
|
case NVPTXISD::Suld2DI16Trap:
|
|
|
|
case NVPTXISD::Suld2DI32Trap:
|
2014-07-17 19:59:04 +08:00
|
|
|
case NVPTXISD::Suld2DI64Trap:
|
2014-04-09 23:39:15 +08:00
|
|
|
case NVPTXISD::Suld2DV2I8Trap:
|
|
|
|
case NVPTXISD::Suld2DV2I16Trap:
|
|
|
|
case NVPTXISD::Suld2DV2I32Trap:
|
2014-07-17 19:59:04 +08:00
|
|
|
case NVPTXISD::Suld2DV2I64Trap:
|
2014-04-09 23:39:15 +08:00
|
|
|
case NVPTXISD::Suld2DV4I8Trap:
|
|
|
|
case NVPTXISD::Suld2DV4I16Trap:
|
|
|
|
case NVPTXISD::Suld2DV4I32Trap:
|
|
|
|
case NVPTXISD::Suld2DArrayI8Trap:
|
|
|
|
case NVPTXISD::Suld2DArrayI16Trap:
|
|
|
|
case NVPTXISD::Suld2DArrayI32Trap:
|
2014-07-17 19:59:04 +08:00
|
|
|
case NVPTXISD::Suld2DArrayI64Trap:
|
2014-04-09 23:39:15 +08:00
|
|
|
case NVPTXISD::Suld2DArrayV2I8Trap:
|
|
|
|
case NVPTXISD::Suld2DArrayV2I16Trap:
|
|
|
|
case NVPTXISD::Suld2DArrayV2I32Trap:
|
2014-07-17 19:59:04 +08:00
|
|
|
case NVPTXISD::Suld2DArrayV2I64Trap:
|
2014-04-09 23:39:15 +08:00
|
|
|
case NVPTXISD::Suld2DArrayV4I8Trap:
|
|
|
|
case NVPTXISD::Suld2DArrayV4I16Trap:
|
|
|
|
case NVPTXISD::Suld2DArrayV4I32Trap:
|
|
|
|
case NVPTXISD::Suld3DI8Trap:
|
|
|
|
case NVPTXISD::Suld3DI16Trap:
|
|
|
|
case NVPTXISD::Suld3DI32Trap:
|
2014-07-17 19:59:04 +08:00
|
|
|
case NVPTXISD::Suld3DI64Trap:
|
2014-04-09 23:39:15 +08:00
|
|
|
case NVPTXISD::Suld3DV2I8Trap:
|
|
|
|
case NVPTXISD::Suld3DV2I16Trap:
|
|
|
|
case NVPTXISD::Suld3DV2I32Trap:
|
2014-07-17 19:59:04 +08:00
|
|
|
case NVPTXISD::Suld3DV2I64Trap:
|
2014-04-09 23:39:15 +08:00
|
|
|
case NVPTXISD::Suld3DV4I8Trap:
|
|
|
|
case NVPTXISD::Suld3DV4I16Trap:
|
|
|
|
case NVPTXISD::Suld3DV4I32Trap:
|
2014-07-17 19:59:04 +08:00
|
|
|
case NVPTXISD::Suld1DI8Zero:
|
|
|
|
case NVPTXISD::Suld1DI16Zero:
|
|
|
|
case NVPTXISD::Suld1DI32Zero:
|
|
|
|
case NVPTXISD::Suld1DI64Zero:
|
|
|
|
case NVPTXISD::Suld1DV2I8Zero:
|
|
|
|
case NVPTXISD::Suld1DV2I16Zero:
|
|
|
|
case NVPTXISD::Suld1DV2I32Zero:
|
|
|
|
case NVPTXISD::Suld1DV2I64Zero:
|
|
|
|
case NVPTXISD::Suld1DV4I8Zero:
|
|
|
|
case NVPTXISD::Suld1DV4I16Zero:
|
|
|
|
case NVPTXISD::Suld1DV4I32Zero:
|
|
|
|
case NVPTXISD::Suld1DArrayI8Zero:
|
|
|
|
case NVPTXISD::Suld1DArrayI16Zero:
|
|
|
|
case NVPTXISD::Suld1DArrayI32Zero:
|
|
|
|
case NVPTXISD::Suld1DArrayI64Zero:
|
|
|
|
case NVPTXISD::Suld1DArrayV2I8Zero:
|
|
|
|
case NVPTXISD::Suld1DArrayV2I16Zero:
|
|
|
|
case NVPTXISD::Suld1DArrayV2I32Zero:
|
|
|
|
case NVPTXISD::Suld1DArrayV2I64Zero:
|
|
|
|
case NVPTXISD::Suld1DArrayV4I8Zero:
|
|
|
|
case NVPTXISD::Suld1DArrayV4I16Zero:
|
|
|
|
case NVPTXISD::Suld1DArrayV4I32Zero:
|
|
|
|
case NVPTXISD::Suld2DI8Zero:
|
|
|
|
case NVPTXISD::Suld2DI16Zero:
|
|
|
|
case NVPTXISD::Suld2DI32Zero:
|
|
|
|
case NVPTXISD::Suld2DI64Zero:
|
|
|
|
case NVPTXISD::Suld2DV2I8Zero:
|
|
|
|
case NVPTXISD::Suld2DV2I16Zero:
|
|
|
|
case NVPTXISD::Suld2DV2I32Zero:
|
|
|
|
case NVPTXISD::Suld2DV2I64Zero:
|
|
|
|
case NVPTXISD::Suld2DV4I8Zero:
|
|
|
|
case NVPTXISD::Suld2DV4I16Zero:
|
|
|
|
case NVPTXISD::Suld2DV4I32Zero:
|
|
|
|
case NVPTXISD::Suld2DArrayI8Zero:
|
|
|
|
case NVPTXISD::Suld2DArrayI16Zero:
|
|
|
|
case NVPTXISD::Suld2DArrayI32Zero:
|
|
|
|
case NVPTXISD::Suld2DArrayI64Zero:
|
|
|
|
case NVPTXISD::Suld2DArrayV2I8Zero:
|
|
|
|
case NVPTXISD::Suld2DArrayV2I16Zero:
|
|
|
|
case NVPTXISD::Suld2DArrayV2I32Zero:
|
|
|
|
case NVPTXISD::Suld2DArrayV2I64Zero:
|
|
|
|
case NVPTXISD::Suld2DArrayV4I8Zero:
|
|
|
|
case NVPTXISD::Suld2DArrayV4I16Zero:
|
|
|
|
case NVPTXISD::Suld2DArrayV4I32Zero:
|
|
|
|
case NVPTXISD::Suld3DI8Zero:
|
|
|
|
case NVPTXISD::Suld3DI16Zero:
|
|
|
|
case NVPTXISD::Suld3DI32Zero:
|
|
|
|
case NVPTXISD::Suld3DI64Zero:
|
|
|
|
case NVPTXISD::Suld3DV2I8Zero:
|
|
|
|
case NVPTXISD::Suld3DV2I16Zero:
|
|
|
|
case NVPTXISD::Suld3DV2I32Zero:
|
|
|
|
case NVPTXISD::Suld3DV2I64Zero:
|
|
|
|
case NVPTXISD::Suld3DV4I8Zero:
|
|
|
|
case NVPTXISD::Suld3DV4I16Zero:
|
|
|
|
case NVPTXISD::Suld3DV4I32Zero:
|
2016-05-14 05:12:53 +08:00
|
|
|
if (trySurfaceIntrinsic(N))
|
|
|
|
return;
|
2014-04-09 23:39:15 +08:00
|
|
|
break;
|
2014-06-28 02:35:27 +08:00
|
|
|
case ISD::AND:
|
|
|
|
case ISD::SRA:
|
|
|
|
case ISD::SRL:
|
|
|
|
// Try to select BFE
|
2016-05-14 05:12:53 +08:00
|
|
|
if (tryBFE(N))
|
|
|
|
return;
|
2014-06-28 02:35:27 +08:00
|
|
|
break;
|
2014-03-24 19:17:53 +08:00
|
|
|
case ISD::ADDRSPACECAST:
|
2016-05-14 05:12:53 +08:00
|
|
|
SelectAddrSpaceCast(N);
|
|
|
|
return;
|
2017-01-14 04:56:17 +08:00
|
|
|
case ISD::ConstantFP:
|
|
|
|
if (tryConstantFP16(N))
|
|
|
|
return;
|
|
|
|
break;
|
2013-03-30 22:29:21 +08:00
|
|
|
default:
|
|
|
|
break;
|
2012-05-05 04:18:50 +08:00
|
|
|
}
|
2016-05-14 05:12:53 +08:00
|
|
|
SelectCode(N);
|
2012-05-05 04:18:50 +08:00
|
|
|
}
|
|
|
|
|
2016-05-14 05:12:53 +08:00
|
|
|
bool NVPTXDAGToDAGISel::tryIntrinsicChain(SDNode *N) {
|
2014-06-28 02:35:51 +08:00
|
|
|
unsigned IID = cast<ConstantSDNode>(N->getOperand(1))->getZExtValue();
|
|
|
|
switch (IID) {
|
|
|
|
default:
|
2016-05-14 05:12:53 +08:00
|
|
|
return false;
|
2014-06-28 02:35:51 +08:00
|
|
|
case Intrinsic::nvvm_ldg_global_f:
|
|
|
|
case Intrinsic::nvvm_ldg_global_i:
|
|
|
|
case Intrinsic::nvvm_ldg_global_p:
|
|
|
|
case Intrinsic::nvvm_ldu_global_f:
|
|
|
|
case Intrinsic::nvvm_ldu_global_i:
|
|
|
|
case Intrinsic::nvvm_ldu_global_p:
|
2016-05-14 05:12:53 +08:00
|
|
|
return tryLDGLDU(N);
|
2014-06-28 02:35:51 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-01-14 04:56:17 +08:00
|
|
|
// There's no way to specify FP16 immediates in .f16 ops, so we have to
|
|
|
|
// load them into an .f16 register first.
|
|
|
|
bool NVPTXDAGToDAGISel::tryConstantFP16(SDNode *N) {
|
|
|
|
if (N->getValueType(0) != MVT::f16)
|
|
|
|
return false;
|
|
|
|
SDValue Val = CurDAG->getTargetConstantFP(
|
|
|
|
cast<ConstantFPSDNode>(N)->getValueAPF(), SDLoc(N), MVT::f16);
|
|
|
|
SDNode *LoadConstF16 =
|
|
|
|
CurDAG->getMachineNode(NVPTX::LOAD_CONST_F16, SDLoc(N), MVT::f16, Val);
|
|
|
|
ReplaceNode(N, LoadConstF16);
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2015-01-30 09:41:01 +08:00
|
|
|
static unsigned int getCodeAddrSpace(MemSDNode *N) {
|
2014-04-15 15:22:52 +08:00
|
|
|
const Value *Src = N->getMemOperand()->getValue();
|
2013-06-10 21:29:47 +08:00
|
|
|
|
2012-05-05 04:18:50 +08:00
|
|
|
if (!Src)
|
2013-06-10 21:29:47 +08:00
|
|
|
return NVPTX::PTXLdStInstCode::GENERIC;
|
2012-05-05 04:18:50 +08:00
|
|
|
|
2015-08-02 06:20:21 +08:00
|
|
|
if (auto *PT = dyn_cast<PointerType>(Src->getType())) {
|
2012-05-05 04:18:50 +08:00
|
|
|
switch (PT->getAddressSpace()) {
|
2013-06-10 21:29:47 +08:00
|
|
|
case llvm::ADDRESS_SPACE_LOCAL: return NVPTX::PTXLdStInstCode::LOCAL;
|
|
|
|
case llvm::ADDRESS_SPACE_GLOBAL: return NVPTX::PTXLdStInstCode::GLOBAL;
|
|
|
|
case llvm::ADDRESS_SPACE_SHARED: return NVPTX::PTXLdStInstCode::SHARED;
|
|
|
|
case llvm::ADDRESS_SPACE_GENERIC: return NVPTX::PTXLdStInstCode::GENERIC;
|
|
|
|
case llvm::ADDRESS_SPACE_PARAM: return NVPTX::PTXLdStInstCode::PARAM;
|
|
|
|
case llvm::ADDRESS_SPACE_CONST: return NVPTX::PTXLdStInstCode::CONSTANT;
|
|
|
|
default: break;
|
2012-05-05 04:18:50 +08:00
|
|
|
}
|
|
|
|
}
|
2013-06-10 21:29:47 +08:00
|
|
|
return NVPTX::PTXLdStInstCode::GENERIC;
|
2012-05-05 04:18:50 +08:00
|
|
|
}
|
|
|
|
|
2015-07-21 05:28:54 +08:00
|
|
|
static bool canLowerToLDG(MemSDNode *N, const NVPTXSubtarget &Subtarget,
|
2015-08-06 07:11:57 +08:00
|
|
|
unsigned CodeAddrSpace, MachineFunction *F) {
|
2016-09-11 09:39:04 +08:00
|
|
|
// We use ldg (i.e. ld.global.nc) for invariant loads from the global address
|
|
|
|
// space.
|
2015-08-06 07:11:57 +08:00
|
|
|
//
|
2016-09-11 09:39:04 +08:00
|
|
|
// We have two ways of identifying invariant loads: Loads may be explicitly
|
|
|
|
// marked as invariant, or we may infer them to be invariant.
|
|
|
|
//
|
|
|
|
// We currently infer invariance only for kernel function pointer params that
|
|
|
|
// are noalias (i.e. __restrict) and never written to.
|
|
|
|
//
|
|
|
|
// TODO: Perform a more powerful invariance analysis (ideally IPO, and ideally
|
|
|
|
// not during the SelectionDAG phase).
|
|
|
|
//
|
|
|
|
// TODO: Infer invariance only at -O2. We still want to use ldg at -O0 for
|
|
|
|
// explicitly invariant loads because these are how clang tells us to use ldg
|
|
|
|
// when the user uses a builtin.
|
|
|
|
if (!Subtarget.hasLDG() || CodeAddrSpace != NVPTX::PTXLdStInstCode::GLOBAL)
|
|
|
|
return false;
|
|
|
|
|
|
|
|
if (N->isInvariant())
|
|
|
|
return true;
|
|
|
|
|
|
|
|
// Load wasn't explicitly invariant. Attempt to infer invariance.
|
|
|
|
if (!isKernelFunction(*F->getFunction()))
|
2015-07-21 05:28:54 +08:00
|
|
|
return false;
|
|
|
|
|
2015-08-06 07:11:57 +08:00
|
|
|
// We use GetUnderlyingObjects() here instead of
|
|
|
|
// GetUnderlyingObject() mainly because the former looks through phi
|
|
|
|
// nodes while the latter does not. We need to look through phi
|
|
|
|
// nodes to handle pointer induction variables.
|
|
|
|
SmallVector<Value *, 8> Objs;
|
|
|
|
GetUnderlyingObjects(const_cast<Value *>(N->getMemOperand()->getValue()),
|
|
|
|
Objs, F->getDataLayout());
|
|
|
|
for (Value *Obj : Objs) {
|
|
|
|
auto *A = dyn_cast<const Argument>(Obj);
|
|
|
|
if (!A || !A->onlyReadsMemory() || !A->hasNoAliasAttr()) return false;
|
|
|
|
}
|
2015-07-21 05:28:54 +08:00
|
|
|
|
2015-08-06 07:11:57 +08:00
|
|
|
return true;
|
2015-07-21 05:28:54 +08:00
|
|
|
}
|
|
|
|
|
2016-05-14 05:12:53 +08:00
|
|
|
bool NVPTXDAGToDAGISel::tryIntrinsicNoChain(SDNode *N) {
|
2014-04-09 23:39:15 +08:00
|
|
|
unsigned IID = cast<ConstantSDNode>(N->getOperand(0))->getZExtValue();
|
|
|
|
switch (IID) {
|
|
|
|
default:
|
2016-05-14 05:12:53 +08:00
|
|
|
return false;
|
2014-04-09 23:39:15 +08:00
|
|
|
case Intrinsic::nvvm_texsurf_handle_internal:
|
2016-05-14 05:12:53 +08:00
|
|
|
SelectTexSurfHandle(N);
|
|
|
|
return true;
|
2014-04-09 23:39:15 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-05-14 05:12:53 +08:00
|
|
|
void NVPTXDAGToDAGISel::SelectTexSurfHandle(SDNode *N) {
|
2014-04-09 23:39:15 +08:00
|
|
|
// Op 0 is the intrinsic ID
|
|
|
|
SDValue Wrapper = N->getOperand(1);
|
|
|
|
SDValue GlobalVal = Wrapper.getOperand(0);
|
2016-05-14 05:12:53 +08:00
|
|
|
ReplaceNode(N, CurDAG->getMachineNode(NVPTX::texsurf_handles, SDLoc(N),
|
|
|
|
MVT::i64, GlobalVal));
|
2014-04-09 23:39:15 +08:00
|
|
|
}
|
|
|
|
|
2016-05-14 05:12:53 +08:00
|
|
|
void NVPTXDAGToDAGISel::SelectAddrSpaceCast(SDNode *N) {
|
2014-03-24 19:17:53 +08:00
|
|
|
SDValue Src = N->getOperand(0);
|
|
|
|
AddrSpaceCastSDNode *CastN = cast<AddrSpaceCastSDNode>(N);
|
|
|
|
unsigned SrcAddrSpace = CastN->getSrcAddressSpace();
|
|
|
|
unsigned DstAddrSpace = CastN->getDestAddressSpace();
|
|
|
|
|
|
|
|
assert(SrcAddrSpace != DstAddrSpace &&
|
|
|
|
"addrspacecast must be between different address spaces");
|
|
|
|
|
|
|
|
if (DstAddrSpace == ADDRESS_SPACE_GENERIC) {
|
|
|
|
// Specific to generic
|
|
|
|
unsigned Opc;
|
|
|
|
switch (SrcAddrSpace) {
|
|
|
|
default: report_fatal_error("Bad address space in addrspacecast");
|
|
|
|
case ADDRESS_SPACE_GLOBAL:
|
2015-02-19 08:08:27 +08:00
|
|
|
Opc = TM.is64Bit() ? NVPTX::cvta_global_yes_64 : NVPTX::cvta_global_yes;
|
2014-03-24 19:17:53 +08:00
|
|
|
break;
|
|
|
|
case ADDRESS_SPACE_SHARED:
|
2015-02-19 08:08:27 +08:00
|
|
|
Opc = TM.is64Bit() ? NVPTX::cvta_shared_yes_64 : NVPTX::cvta_shared_yes;
|
2014-03-24 19:17:53 +08:00
|
|
|
break;
|
|
|
|
case ADDRESS_SPACE_CONST:
|
2015-02-19 08:08:27 +08:00
|
|
|
Opc = TM.is64Bit() ? NVPTX::cvta_const_yes_64 : NVPTX::cvta_const_yes;
|
2014-03-24 19:17:53 +08:00
|
|
|
break;
|
|
|
|
case ADDRESS_SPACE_LOCAL:
|
2015-02-19 08:08:27 +08:00
|
|
|
Opc = TM.is64Bit() ? NVPTX::cvta_local_yes_64 : NVPTX::cvta_local_yes;
|
2014-03-24 19:17:53 +08:00
|
|
|
break;
|
|
|
|
}
|
2016-05-14 05:12:53 +08:00
|
|
|
ReplaceNode(N, CurDAG->getMachineNode(Opc, SDLoc(N), N->getValueType(0),
|
|
|
|
Src));
|
|
|
|
return;
|
2014-03-24 19:17:53 +08:00
|
|
|
} else {
|
|
|
|
// Generic to specific
|
|
|
|
if (SrcAddrSpace != 0)
|
|
|
|
report_fatal_error("Cannot cast between two non-generic address spaces");
|
|
|
|
unsigned Opc;
|
|
|
|
switch (DstAddrSpace) {
|
|
|
|
default: report_fatal_error("Bad address space in addrspacecast");
|
|
|
|
case ADDRESS_SPACE_GLOBAL:
|
2015-02-19 08:08:27 +08:00
|
|
|
Opc = TM.is64Bit() ? NVPTX::cvta_to_global_yes_64
|
|
|
|
: NVPTX::cvta_to_global_yes;
|
2014-03-24 19:17:53 +08:00
|
|
|
break;
|
|
|
|
case ADDRESS_SPACE_SHARED:
|
2015-02-19 08:08:27 +08:00
|
|
|
Opc = TM.is64Bit() ? NVPTX::cvta_to_shared_yes_64
|
|
|
|
: NVPTX::cvta_to_shared_yes;
|
2014-03-24 19:17:53 +08:00
|
|
|
break;
|
|
|
|
case ADDRESS_SPACE_CONST:
|
2015-02-19 08:08:27 +08:00
|
|
|
Opc =
|
|
|
|
TM.is64Bit() ? NVPTX::cvta_to_const_yes_64 : NVPTX::cvta_to_const_yes;
|
2014-03-24 19:17:53 +08:00
|
|
|
break;
|
|
|
|
case ADDRESS_SPACE_LOCAL:
|
2015-02-19 08:08:27 +08:00
|
|
|
Opc =
|
|
|
|
TM.is64Bit() ? NVPTX::cvta_to_local_yes_64 : NVPTX::cvta_to_local_yes;
|
2014-03-24 19:17:53 +08:00
|
|
|
break;
|
2015-06-05 05:28:26 +08:00
|
|
|
case ADDRESS_SPACE_PARAM:
|
|
|
|
Opc = TM.is64Bit() ? NVPTX::nvvm_ptr_gen_to_param_64
|
|
|
|
: NVPTX::nvvm_ptr_gen_to_param;
|
|
|
|
break;
|
2014-03-24 19:17:53 +08:00
|
|
|
}
|
2016-05-14 05:12:53 +08:00
|
|
|
ReplaceNode(N, CurDAG->getMachineNode(Opc, SDLoc(N), N->getValueType(0),
|
|
|
|
Src));
|
|
|
|
return;
|
2014-03-24 19:17:53 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-05-14 05:12:53 +08:00
|
|
|
bool NVPTXDAGToDAGISel::tryLoad(SDNode *N) {
|
2013-05-25 10:42:55 +08:00
|
|
|
SDLoc dl(N);
|
2012-05-05 04:18:50 +08:00
|
|
|
LoadSDNode *LD = cast<LoadSDNode>(N);
|
|
|
|
EVT LoadedVT = LD->getMemoryVT();
|
2014-04-25 13:30:21 +08:00
|
|
|
SDNode *NVPTXLD = nullptr;
|
2012-05-05 04:18:50 +08:00
|
|
|
|
|
|
|
// do not support pre/post inc/dec
|
|
|
|
if (LD->isIndexed())
|
2016-05-14 05:12:53 +08:00
|
|
|
return false;
|
2012-05-05 04:18:50 +08:00
|
|
|
|
|
|
|
if (!LoadedVT.isSimple())
|
2016-05-14 05:12:53 +08:00
|
|
|
return false;
|
2012-05-05 04:18:50 +08:00
|
|
|
|
|
|
|
// Address Space Setting
|
2015-01-30 09:41:01 +08:00
|
|
|
unsigned int codeAddrSpace = getCodeAddrSpace(LD);
|
2012-05-05 04:18:50 +08:00
|
|
|
|
2015-08-06 07:11:57 +08:00
|
|
|
if (canLowerToLDG(LD, *Subtarget, codeAddrSpace, MF)) {
|
2016-05-14 05:12:53 +08:00
|
|
|
return tryLDGLDU(N);
|
2015-07-21 05:28:54 +08:00
|
|
|
}
|
|
|
|
|
2012-05-05 04:18:50 +08:00
|
|
|
// Volatile Setting
|
|
|
|
// - .volatile is only availalble for .global and .shared
|
|
|
|
bool isVolatile = LD->isVolatile();
|
|
|
|
if (codeAddrSpace != NVPTX::PTXLdStInstCode::GLOBAL &&
|
|
|
|
codeAddrSpace != NVPTX::PTXLdStInstCode::SHARED &&
|
|
|
|
codeAddrSpace != NVPTX::PTXLdStInstCode::GENERIC)
|
|
|
|
isVolatile = false;
|
|
|
|
|
|
|
|
// Vector Setting
|
|
|
|
MVT SimpleVT = LoadedVT.getSimpleVT();
|
|
|
|
unsigned vecType = NVPTX::PTXLdStInstCode::Scalar;
|
|
|
|
if (SimpleVT.isVector()) {
|
|
|
|
unsigned num = SimpleVT.getVectorNumElements();
|
|
|
|
if (num == 2)
|
|
|
|
vecType = NVPTX::PTXLdStInstCode::V2;
|
|
|
|
else if (num == 4)
|
|
|
|
vecType = NVPTX::PTXLdStInstCode::V4;
|
|
|
|
else
|
2016-05-14 05:12:53 +08:00
|
|
|
return false;
|
2012-05-05 04:18:50 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
// Type Setting: fromType + fromTypeWidth
|
|
|
|
//
|
|
|
|
// Sign : ISD::SEXTLOAD
|
|
|
|
// Unsign : ISD::ZEXTLOAD, ISD::NON_EXTLOAD or ISD::EXTLOAD and the
|
|
|
|
// type is integer
|
|
|
|
// Float : ISD::NON_EXTLOAD or ISD::EXTLOAD and the type is float
|
|
|
|
MVT ScalarVT = SimpleVT.getScalarType();
|
2013-05-30 20:22:39 +08:00
|
|
|
// Read at least 8 bits (predicates are stored as 8-bit values)
|
|
|
|
unsigned fromTypeWidth = std::max(8U, ScalarVT.getSizeInBits());
|
2012-05-05 04:18:50 +08:00
|
|
|
unsigned int fromType;
|
|
|
|
if ((LD->getExtensionType() == ISD::SEXTLOAD))
|
|
|
|
fromType = NVPTX::PTXLdStInstCode::Signed;
|
|
|
|
else if (ScalarVT.isFloatingPoint())
|
2017-01-14 04:56:17 +08:00
|
|
|
// f16 uses .b16 as its storage type.
|
|
|
|
fromType = ScalarVT.SimpleTy == MVT::f16 ? NVPTX::PTXLdStInstCode::Untyped
|
|
|
|
: NVPTX::PTXLdStInstCode::Float;
|
2012-05-05 04:18:50 +08:00
|
|
|
else
|
|
|
|
fromType = NVPTX::PTXLdStInstCode::Unsigned;
|
|
|
|
|
|
|
|
// Create the machine instruction DAG
|
|
|
|
SDValue Chain = N->getOperand(0);
|
|
|
|
SDValue N1 = N->getOperand(1);
|
|
|
|
SDValue Addr;
|
|
|
|
SDValue Offset, Base;
|
|
|
|
unsigned Opcode;
|
2013-08-15 10:44:19 +08:00
|
|
|
MVT::SimpleValueType TargetVT = LD->getSimpleValueType(0).SimpleTy;
|
2012-05-05 04:18:50 +08:00
|
|
|
|
|
|
|
if (SelectDirectAddr(N1, Addr)) {
|
|
|
|
switch (TargetVT) {
|
2013-03-30 22:29:21 +08:00
|
|
|
case MVT::i8:
|
|
|
|
Opcode = NVPTX::LD_i8_avar;
|
|
|
|
break;
|
|
|
|
case MVT::i16:
|
|
|
|
Opcode = NVPTX::LD_i16_avar;
|
|
|
|
break;
|
|
|
|
case MVT::i32:
|
|
|
|
Opcode = NVPTX::LD_i32_avar;
|
|
|
|
break;
|
|
|
|
case MVT::i64:
|
|
|
|
Opcode = NVPTX::LD_i64_avar;
|
|
|
|
break;
|
2017-01-14 04:56:17 +08:00
|
|
|
case MVT::f16:
|
|
|
|
Opcode = NVPTX::LD_f16_avar;
|
|
|
|
break;
|
2013-03-30 22:29:21 +08:00
|
|
|
case MVT::f32:
|
|
|
|
Opcode = NVPTX::LD_f32_avar;
|
|
|
|
break;
|
|
|
|
case MVT::f64:
|
|
|
|
Opcode = NVPTX::LD_f64_avar;
|
|
|
|
break;
|
|
|
|
default:
|
2016-05-14 05:12:53 +08:00
|
|
|
return false;
|
2012-05-05 04:18:50 +08:00
|
|
|
}
|
2015-04-28 22:05:47 +08:00
|
|
|
SDValue Ops[] = { getI32Imm(isVolatile, dl), getI32Imm(codeAddrSpace, dl),
|
|
|
|
getI32Imm(vecType, dl), getI32Imm(fromType, dl),
|
|
|
|
getI32Imm(fromTypeWidth, dl), Addr, Chain };
|
2013-04-20 06:22:57 +08:00
|
|
|
NVPTXLD = CurDAG->getMachineNode(Opcode, dl, TargetVT, MVT::Other, Ops);
|
2015-02-19 08:08:27 +08:00
|
|
|
} else if (TM.is64Bit() ? SelectADDRsi64(N1.getNode(), N1, Base, Offset)
|
|
|
|
: SelectADDRsi(N1.getNode(), N1, Base, Offset)) {
|
2012-05-05 04:18:50 +08:00
|
|
|
switch (TargetVT) {
|
2013-03-30 22:29:21 +08:00
|
|
|
case MVT::i8:
|
|
|
|
Opcode = NVPTX::LD_i8_asi;
|
|
|
|
break;
|
|
|
|
case MVT::i16:
|
|
|
|
Opcode = NVPTX::LD_i16_asi;
|
|
|
|
break;
|
|
|
|
case MVT::i32:
|
|
|
|
Opcode = NVPTX::LD_i32_asi;
|
|
|
|
break;
|
|
|
|
case MVT::i64:
|
|
|
|
Opcode = NVPTX::LD_i64_asi;
|
|
|
|
break;
|
2017-01-14 04:56:17 +08:00
|
|
|
case MVT::f16:
|
|
|
|
Opcode = NVPTX::LD_f16_asi;
|
|
|
|
break;
|
2013-03-30 22:29:21 +08:00
|
|
|
case MVT::f32:
|
|
|
|
Opcode = NVPTX::LD_f32_asi;
|
|
|
|
break;
|
|
|
|
case MVT::f64:
|
|
|
|
Opcode = NVPTX::LD_f64_asi;
|
|
|
|
break;
|
|
|
|
default:
|
2016-05-14 05:12:53 +08:00
|
|
|
return false;
|
2012-05-05 04:18:50 +08:00
|
|
|
}
|
2015-04-28 22:05:47 +08:00
|
|
|
SDValue Ops[] = { getI32Imm(isVolatile, dl), getI32Imm(codeAddrSpace, dl),
|
|
|
|
getI32Imm(vecType, dl), getI32Imm(fromType, dl),
|
|
|
|
getI32Imm(fromTypeWidth, dl), Base, Offset, Chain };
|
2013-04-20 06:22:57 +08:00
|
|
|
NVPTXLD = CurDAG->getMachineNode(Opcode, dl, TargetVT, MVT::Other, Ops);
|
2015-02-19 08:08:27 +08:00
|
|
|
} else if (TM.is64Bit() ? SelectADDRri64(N1.getNode(), N1, Base, Offset)
|
|
|
|
: SelectADDRri(N1.getNode(), N1, Base, Offset)) {
|
|
|
|
if (TM.is64Bit()) {
|
2013-02-12 22:18:49 +08:00
|
|
|
switch (TargetVT) {
|
2013-03-30 22:29:21 +08:00
|
|
|
case MVT::i8:
|
|
|
|
Opcode = NVPTX::LD_i8_ari_64;
|
|
|
|
break;
|
|
|
|
case MVT::i16:
|
|
|
|
Opcode = NVPTX::LD_i16_ari_64;
|
|
|
|
break;
|
|
|
|
case MVT::i32:
|
|
|
|
Opcode = NVPTX::LD_i32_ari_64;
|
|
|
|
break;
|
|
|
|
case MVT::i64:
|
|
|
|
Opcode = NVPTX::LD_i64_ari_64;
|
|
|
|
break;
|
2017-01-14 04:56:17 +08:00
|
|
|
case MVT::f16:
|
|
|
|
Opcode = NVPTX::LD_f16_ari_64;
|
|
|
|
break;
|
2013-03-30 22:29:21 +08:00
|
|
|
case MVT::f32:
|
|
|
|
Opcode = NVPTX::LD_f32_ari_64;
|
|
|
|
break;
|
|
|
|
case MVT::f64:
|
|
|
|
Opcode = NVPTX::LD_f64_ari_64;
|
|
|
|
break;
|
|
|
|
default:
|
2016-05-14 05:12:53 +08:00
|
|
|
return false;
|
2013-02-12 22:18:49 +08:00
|
|
|
}
|
|
|
|
} else {
|
|
|
|
switch (TargetVT) {
|
2013-03-30 22:29:21 +08:00
|
|
|
case MVT::i8:
|
|
|
|
Opcode = NVPTX::LD_i8_ari;
|
|
|
|
break;
|
|
|
|
case MVT::i16:
|
|
|
|
Opcode = NVPTX::LD_i16_ari;
|
|
|
|
break;
|
|
|
|
case MVT::i32:
|
|
|
|
Opcode = NVPTX::LD_i32_ari;
|
|
|
|
break;
|
|
|
|
case MVT::i64:
|
|
|
|
Opcode = NVPTX::LD_i64_ari;
|
|
|
|
break;
|
2017-01-14 04:56:17 +08:00
|
|
|
case MVT::f16:
|
|
|
|
Opcode = NVPTX::LD_f16_ari;
|
|
|
|
break;
|
2013-03-30 22:29:21 +08:00
|
|
|
case MVT::f32:
|
|
|
|
Opcode = NVPTX::LD_f32_ari;
|
|
|
|
break;
|
|
|
|
case MVT::f64:
|
|
|
|
Opcode = NVPTX::LD_f64_ari;
|
|
|
|
break;
|
|
|
|
default:
|
2016-05-14 05:12:53 +08:00
|
|
|
return false;
|
2013-02-12 22:18:49 +08:00
|
|
|
}
|
2012-05-05 04:18:50 +08:00
|
|
|
}
|
2015-04-28 22:05:47 +08:00
|
|
|
SDValue Ops[] = { getI32Imm(isVolatile, dl), getI32Imm(codeAddrSpace, dl),
|
|
|
|
getI32Imm(vecType, dl), getI32Imm(fromType, dl),
|
|
|
|
getI32Imm(fromTypeWidth, dl), Base, Offset, Chain };
|
2013-04-20 06:22:57 +08:00
|
|
|
NVPTXLD = CurDAG->getMachineNode(Opcode, dl, TargetVT, MVT::Other, Ops);
|
2013-03-30 22:29:21 +08:00
|
|
|
} else {
|
2015-02-19 08:08:27 +08:00
|
|
|
if (TM.is64Bit()) {
|
2013-02-12 22:18:49 +08:00
|
|
|
switch (TargetVT) {
|
2013-03-30 22:29:21 +08:00
|
|
|
case MVT::i8:
|
|
|
|
Opcode = NVPTX::LD_i8_areg_64;
|
|
|
|
break;
|
|
|
|
case MVT::i16:
|
|
|
|
Opcode = NVPTX::LD_i16_areg_64;
|
|
|
|
break;
|
|
|
|
case MVT::i32:
|
|
|
|
Opcode = NVPTX::LD_i32_areg_64;
|
|
|
|
break;
|
|
|
|
case MVT::i64:
|
|
|
|
Opcode = NVPTX::LD_i64_areg_64;
|
|
|
|
break;
|
2017-01-14 04:56:17 +08:00
|
|
|
case MVT::f16:
|
|
|
|
Opcode = NVPTX::LD_f16_areg_64;
|
|
|
|
break;
|
2013-03-30 22:29:21 +08:00
|
|
|
case MVT::f32:
|
|
|
|
Opcode = NVPTX::LD_f32_areg_64;
|
|
|
|
break;
|
|
|
|
case MVT::f64:
|
|
|
|
Opcode = NVPTX::LD_f64_areg_64;
|
|
|
|
break;
|
|
|
|
default:
|
2016-05-14 05:12:53 +08:00
|
|
|
return false;
|
2013-02-12 22:18:49 +08:00
|
|
|
}
|
|
|
|
} else {
|
|
|
|
switch (TargetVT) {
|
2013-03-30 22:29:21 +08:00
|
|
|
case MVT::i8:
|
|
|
|
Opcode = NVPTX::LD_i8_areg;
|
|
|
|
break;
|
|
|
|
case MVT::i16:
|
|
|
|
Opcode = NVPTX::LD_i16_areg;
|
|
|
|
break;
|
|
|
|
case MVT::i32:
|
|
|
|
Opcode = NVPTX::LD_i32_areg;
|
|
|
|
break;
|
|
|
|
case MVT::i64:
|
|
|
|
Opcode = NVPTX::LD_i64_areg;
|
|
|
|
break;
|
2017-01-14 04:56:17 +08:00
|
|
|
case MVT::f16:
|
|
|
|
Opcode = NVPTX::LD_f16_areg;
|
|
|
|
break;
|
2013-03-30 22:29:21 +08:00
|
|
|
case MVT::f32:
|
|
|
|
Opcode = NVPTX::LD_f32_areg;
|
|
|
|
break;
|
|
|
|
case MVT::f64:
|
|
|
|
Opcode = NVPTX::LD_f64_areg;
|
|
|
|
break;
|
|
|
|
default:
|
2016-05-14 05:12:53 +08:00
|
|
|
return false;
|
2013-02-12 22:18:49 +08:00
|
|
|
}
|
2012-05-05 04:18:50 +08:00
|
|
|
}
|
2015-04-28 22:05:47 +08:00
|
|
|
SDValue Ops[] = { getI32Imm(isVolatile, dl), getI32Imm(codeAddrSpace, dl),
|
|
|
|
getI32Imm(vecType, dl), getI32Imm(fromType, dl),
|
|
|
|
getI32Imm(fromTypeWidth, dl), N1, Chain };
|
2013-04-20 06:22:57 +08:00
|
|
|
NVPTXLD = CurDAG->getMachineNode(Opcode, dl, TargetVT, MVT::Other, Ops);
|
2012-05-05 04:18:50 +08:00
|
|
|
}
|
|
|
|
|
2016-05-14 05:12:53 +08:00
|
|
|
if (!NVPTXLD)
|
|
|
|
return false;
|
2012-05-05 04:18:50 +08:00
|
|
|
|
2016-05-14 05:12:53 +08:00
|
|
|
MachineSDNode::mmo_iterator MemRefs0 = MF->allocateMemRefsArray(1);
|
|
|
|
MemRefs0[0] = cast<MemSDNode>(N)->getMemOperand();
|
|
|
|
cast<MachineSDNode>(NVPTXLD)->setMemRefs(MemRefs0, MemRefs0 + 1);
|
|
|
|
|
|
|
|
ReplaceNode(N, NVPTXLD);
|
|
|
|
return true;
|
2012-05-05 04:18:50 +08:00
|
|
|
}
|
|
|
|
|
2016-05-14 05:12:53 +08:00
|
|
|
bool NVPTXDAGToDAGISel::tryLoadVector(SDNode *N) {
|
2013-02-12 22:18:49 +08:00
|
|
|
|
|
|
|
SDValue Chain = N->getOperand(0);
|
|
|
|
SDValue Op1 = N->getOperand(1);
|
|
|
|
SDValue Addr, Offset, Base;
|
|
|
|
unsigned Opcode;
|
2013-05-25 10:42:55 +08:00
|
|
|
SDLoc DL(N);
|
2013-02-12 22:18:49 +08:00
|
|
|
SDNode *LD;
|
|
|
|
MemSDNode *MemSD = cast<MemSDNode>(N);
|
|
|
|
EVT LoadedVT = MemSD->getMemoryVT();
|
|
|
|
|
|
|
|
if (!LoadedVT.isSimple())
|
2016-05-14 05:12:53 +08:00
|
|
|
return false;
|
2013-02-12 22:18:49 +08:00
|
|
|
|
|
|
|
// Address Space Setting
|
2015-01-30 09:41:01 +08:00
|
|
|
unsigned int CodeAddrSpace = getCodeAddrSpace(MemSD);
|
2013-02-12 22:18:49 +08:00
|
|
|
|
2015-08-06 07:11:57 +08:00
|
|
|
if (canLowerToLDG(MemSD, *Subtarget, CodeAddrSpace, MF)) {
|
2016-05-14 05:12:53 +08:00
|
|
|
return tryLDGLDU(N);
|
2015-07-21 05:28:54 +08:00
|
|
|
}
|
|
|
|
|
2013-02-12 22:18:49 +08:00
|
|
|
// Volatile Setting
|
|
|
|
// - .volatile is only availalble for .global and .shared
|
|
|
|
bool IsVolatile = MemSD->isVolatile();
|
|
|
|
if (CodeAddrSpace != NVPTX::PTXLdStInstCode::GLOBAL &&
|
|
|
|
CodeAddrSpace != NVPTX::PTXLdStInstCode::SHARED &&
|
|
|
|
CodeAddrSpace != NVPTX::PTXLdStInstCode::GENERIC)
|
|
|
|
IsVolatile = false;
|
|
|
|
|
|
|
|
// Vector Setting
|
|
|
|
MVT SimpleVT = LoadedVT.getSimpleVT();
|
|
|
|
|
|
|
|
// Type Setting: fromType + fromTypeWidth
|
|
|
|
//
|
|
|
|
// Sign : ISD::SEXTLOAD
|
|
|
|
// Unsign : ISD::ZEXTLOAD, ISD::NON_EXTLOAD or ISD::EXTLOAD and the
|
|
|
|
// type is integer
|
|
|
|
// Float : ISD::NON_EXTLOAD or ISD::EXTLOAD and the type is float
|
|
|
|
MVT ScalarVT = SimpleVT.getScalarType();
|
2013-05-30 20:22:39 +08:00
|
|
|
// Read at least 8 bits (predicates are stored as 8-bit values)
|
|
|
|
unsigned FromTypeWidth = std::max(8U, ScalarVT.getSizeInBits());
|
2013-02-12 22:18:49 +08:00
|
|
|
unsigned int FromType;
|
|
|
|
// The last operand holds the original LoadSDNode::getExtensionType() value
|
2013-03-30 22:29:21 +08:00
|
|
|
unsigned ExtensionType = cast<ConstantSDNode>(
|
|
|
|
N->getOperand(N->getNumOperands() - 1))->getZExtValue();
|
2013-02-12 22:18:49 +08:00
|
|
|
if (ExtensionType == ISD::SEXTLOAD)
|
|
|
|
FromType = NVPTX::PTXLdStInstCode::Signed;
|
|
|
|
else if (ScalarVT.isFloatingPoint())
|
|
|
|
FromType = NVPTX::PTXLdStInstCode::Float;
|
|
|
|
else
|
|
|
|
FromType = NVPTX::PTXLdStInstCode::Unsigned;
|
|
|
|
|
|
|
|
unsigned VecType;
|
|
|
|
|
|
|
|
switch (N->getOpcode()) {
|
2013-03-30 22:29:21 +08:00
|
|
|
case NVPTXISD::LoadV2:
|
|
|
|
VecType = NVPTX::PTXLdStInstCode::V2;
|
|
|
|
break;
|
|
|
|
case NVPTXISD::LoadV4:
|
|
|
|
VecType = NVPTX::PTXLdStInstCode::V4;
|
|
|
|
break;
|
|
|
|
default:
|
2016-05-14 05:12:53 +08:00
|
|
|
return false;
|
2013-02-12 22:18:49 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
EVT EltVT = N->getValueType(0);
|
|
|
|
|
|
|
|
if (SelectDirectAddr(Op1, Addr)) {
|
|
|
|
switch (N->getOpcode()) {
|
2013-03-30 22:29:21 +08:00
|
|
|
default:
|
2016-05-14 05:12:53 +08:00
|
|
|
return false;
|
2013-02-12 22:18:49 +08:00
|
|
|
case NVPTXISD::LoadV2:
|
|
|
|
switch (EltVT.getSimpleVT().SimpleTy) {
|
2013-03-30 22:29:21 +08:00
|
|
|
default:
|
2016-05-14 05:12:53 +08:00
|
|
|
return false;
|
2013-03-30 22:29:21 +08:00
|
|
|
case MVT::i8:
|
|
|
|
Opcode = NVPTX::LDV_i8_v2_avar;
|
|
|
|
break;
|
|
|
|
case MVT::i16:
|
|
|
|
Opcode = NVPTX::LDV_i16_v2_avar;
|
|
|
|
break;
|
|
|
|
case MVT::i32:
|
|
|
|
Opcode = NVPTX::LDV_i32_v2_avar;
|
|
|
|
break;
|
|
|
|
case MVT::i64:
|
|
|
|
Opcode = NVPTX::LDV_i64_v2_avar;
|
|
|
|
break;
|
|
|
|
case MVT::f32:
|
|
|
|
Opcode = NVPTX::LDV_f32_v2_avar;
|
|
|
|
break;
|
|
|
|
case MVT::f64:
|
|
|
|
Opcode = NVPTX::LDV_f64_v2_avar;
|
|
|
|
break;
|
2013-02-12 22:18:49 +08:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
case NVPTXISD::LoadV4:
|
|
|
|
switch (EltVT.getSimpleVT().SimpleTy) {
|
2013-03-30 22:29:21 +08:00
|
|
|
default:
|
2016-05-14 05:12:53 +08:00
|
|
|
return false;
|
2013-03-30 22:29:21 +08:00
|
|
|
case MVT::i8:
|
|
|
|
Opcode = NVPTX::LDV_i8_v4_avar;
|
|
|
|
break;
|
|
|
|
case MVT::i16:
|
|
|
|
Opcode = NVPTX::LDV_i16_v4_avar;
|
|
|
|
break;
|
|
|
|
case MVT::i32:
|
|
|
|
Opcode = NVPTX::LDV_i32_v4_avar;
|
|
|
|
break;
|
|
|
|
case MVT::f32:
|
|
|
|
Opcode = NVPTX::LDV_f32_v4_avar;
|
|
|
|
break;
|
2013-02-12 22:18:49 +08:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2015-04-28 22:05:47 +08:00
|
|
|
SDValue Ops[] = { getI32Imm(IsVolatile, DL), getI32Imm(CodeAddrSpace, DL),
|
|
|
|
getI32Imm(VecType, DL), getI32Imm(FromType, DL),
|
|
|
|
getI32Imm(FromTypeWidth, DL), Addr, Chain };
|
2013-04-20 06:22:57 +08:00
|
|
|
LD = CurDAG->getMachineNode(Opcode, DL, N->getVTList(), Ops);
|
2015-02-19 08:08:27 +08:00
|
|
|
} else if (TM.is64Bit() ? SelectADDRsi64(Op1.getNode(), Op1, Base, Offset)
|
|
|
|
: SelectADDRsi(Op1.getNode(), Op1, Base, Offset)) {
|
2013-02-12 22:18:49 +08:00
|
|
|
switch (N->getOpcode()) {
|
2013-03-30 22:29:21 +08:00
|
|
|
default:
|
2016-05-14 05:12:53 +08:00
|
|
|
return false;
|
2013-02-12 22:18:49 +08:00
|
|
|
case NVPTXISD::LoadV2:
|
|
|
|
switch (EltVT.getSimpleVT().SimpleTy) {
|
2013-03-30 22:29:21 +08:00
|
|
|
default:
|
2016-05-14 05:12:53 +08:00
|
|
|
return false;
|
2013-03-30 22:29:21 +08:00
|
|
|
case MVT::i8:
|
|
|
|
Opcode = NVPTX::LDV_i8_v2_asi;
|
|
|
|
break;
|
|
|
|
case MVT::i16:
|
|
|
|
Opcode = NVPTX::LDV_i16_v2_asi;
|
|
|
|
break;
|
|
|
|
case MVT::i32:
|
|
|
|
Opcode = NVPTX::LDV_i32_v2_asi;
|
|
|
|
break;
|
|
|
|
case MVT::i64:
|
|
|
|
Opcode = NVPTX::LDV_i64_v2_asi;
|
|
|
|
break;
|
|
|
|
case MVT::f32:
|
|
|
|
Opcode = NVPTX::LDV_f32_v2_asi;
|
|
|
|
break;
|
|
|
|
case MVT::f64:
|
|
|
|
Opcode = NVPTX::LDV_f64_v2_asi;
|
|
|
|
break;
|
2013-02-12 22:18:49 +08:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
case NVPTXISD::LoadV4:
|
|
|
|
switch (EltVT.getSimpleVT().SimpleTy) {
|
2013-03-30 22:29:21 +08:00
|
|
|
default:
|
2016-05-14 05:12:53 +08:00
|
|
|
return false;
|
2013-03-30 22:29:21 +08:00
|
|
|
case MVT::i8:
|
|
|
|
Opcode = NVPTX::LDV_i8_v4_asi;
|
|
|
|
break;
|
|
|
|
case MVT::i16:
|
|
|
|
Opcode = NVPTX::LDV_i16_v4_asi;
|
|
|
|
break;
|
|
|
|
case MVT::i32:
|
|
|
|
Opcode = NVPTX::LDV_i32_v4_asi;
|
|
|
|
break;
|
|
|
|
case MVT::f32:
|
|
|
|
Opcode = NVPTX::LDV_f32_v4_asi;
|
|
|
|
break;
|
2013-02-12 22:18:49 +08:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2015-04-28 22:05:47 +08:00
|
|
|
SDValue Ops[] = { getI32Imm(IsVolatile, DL), getI32Imm(CodeAddrSpace, DL),
|
|
|
|
getI32Imm(VecType, DL), getI32Imm(FromType, DL),
|
|
|
|
getI32Imm(FromTypeWidth, DL), Base, Offset, Chain };
|
2013-04-20 06:22:57 +08:00
|
|
|
LD = CurDAG->getMachineNode(Opcode, DL, N->getVTList(), Ops);
|
2015-02-19 08:08:27 +08:00
|
|
|
} else if (TM.is64Bit() ? SelectADDRri64(Op1.getNode(), Op1, Base, Offset)
|
|
|
|
: SelectADDRri(Op1.getNode(), Op1, Base, Offset)) {
|
|
|
|
if (TM.is64Bit()) {
|
2013-02-12 22:18:49 +08:00
|
|
|
switch (N->getOpcode()) {
|
2013-03-30 22:29:21 +08:00
|
|
|
default:
|
2016-05-14 05:12:53 +08:00
|
|
|
return false;
|
2013-02-12 22:18:49 +08:00
|
|
|
case NVPTXISD::LoadV2:
|
|
|
|
switch (EltVT.getSimpleVT().SimpleTy) {
|
2013-03-30 22:29:21 +08:00
|
|
|
default:
|
2016-05-14 05:12:53 +08:00
|
|
|
return false;
|
2013-03-30 22:29:21 +08:00
|
|
|
case MVT::i8:
|
|
|
|
Opcode = NVPTX::LDV_i8_v2_ari_64;
|
|
|
|
break;
|
|
|
|
case MVT::i16:
|
|
|
|
Opcode = NVPTX::LDV_i16_v2_ari_64;
|
|
|
|
break;
|
|
|
|
case MVT::i32:
|
|
|
|
Opcode = NVPTX::LDV_i32_v2_ari_64;
|
|
|
|
break;
|
|
|
|
case MVT::i64:
|
|
|
|
Opcode = NVPTX::LDV_i64_v2_ari_64;
|
|
|
|
break;
|
|
|
|
case MVT::f32:
|
|
|
|
Opcode = NVPTX::LDV_f32_v2_ari_64;
|
|
|
|
break;
|
|
|
|
case MVT::f64:
|
|
|
|
Opcode = NVPTX::LDV_f64_v2_ari_64;
|
|
|
|
break;
|
2013-02-12 22:18:49 +08:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
case NVPTXISD::LoadV4:
|
|
|
|
switch (EltVT.getSimpleVT().SimpleTy) {
|
2013-03-30 22:29:21 +08:00
|
|
|
default:
|
2016-05-14 05:12:53 +08:00
|
|
|
return false;
|
2013-03-30 22:29:21 +08:00
|
|
|
case MVT::i8:
|
|
|
|
Opcode = NVPTX::LDV_i8_v4_ari_64;
|
|
|
|
break;
|
|
|
|
case MVT::i16:
|
|
|
|
Opcode = NVPTX::LDV_i16_v4_ari_64;
|
|
|
|
break;
|
|
|
|
case MVT::i32:
|
|
|
|
Opcode = NVPTX::LDV_i32_v4_ari_64;
|
|
|
|
break;
|
|
|
|
case MVT::f32:
|
|
|
|
Opcode = NVPTX::LDV_f32_v4_ari_64;
|
|
|
|
break;
|
2013-02-12 22:18:49 +08:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
switch (N->getOpcode()) {
|
2013-03-30 22:29:21 +08:00
|
|
|
default:
|
2016-05-14 05:12:53 +08:00
|
|
|
return false;
|
2013-02-12 22:18:49 +08:00
|
|
|
case NVPTXISD::LoadV2:
|
|
|
|
switch (EltVT.getSimpleVT().SimpleTy) {
|
2013-03-30 22:29:21 +08:00
|
|
|
default:
|
2016-05-14 05:12:53 +08:00
|
|
|
return false;
|
2013-03-30 22:29:21 +08:00
|
|
|
case MVT::i8:
|
|
|
|
Opcode = NVPTX::LDV_i8_v2_ari;
|
|
|
|
break;
|
|
|
|
case MVT::i16:
|
|
|
|
Opcode = NVPTX::LDV_i16_v2_ari;
|
|
|
|
break;
|
|
|
|
case MVT::i32:
|
|
|
|
Opcode = NVPTX::LDV_i32_v2_ari;
|
|
|
|
break;
|
|
|
|
case MVT::i64:
|
|
|
|
Opcode = NVPTX::LDV_i64_v2_ari;
|
|
|
|
break;
|
|
|
|
case MVT::f32:
|
|
|
|
Opcode = NVPTX::LDV_f32_v2_ari;
|
|
|
|
break;
|
|
|
|
case MVT::f64:
|
|
|
|
Opcode = NVPTX::LDV_f64_v2_ari;
|
|
|
|
break;
|
2013-02-12 22:18:49 +08:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
case NVPTXISD::LoadV4:
|
|
|
|
switch (EltVT.getSimpleVT().SimpleTy) {
|
2013-03-30 22:29:21 +08:00
|
|
|
default:
|
2016-05-14 05:12:53 +08:00
|
|
|
return false;
|
2013-03-30 22:29:21 +08:00
|
|
|
case MVT::i8:
|
|
|
|
Opcode = NVPTX::LDV_i8_v4_ari;
|
|
|
|
break;
|
|
|
|
case MVT::i16:
|
|
|
|
Opcode = NVPTX::LDV_i16_v4_ari;
|
|
|
|
break;
|
|
|
|
case MVT::i32:
|
|
|
|
Opcode = NVPTX::LDV_i32_v4_ari;
|
|
|
|
break;
|
|
|
|
case MVT::f32:
|
|
|
|
Opcode = NVPTX::LDV_f32_v4_ari;
|
|
|
|
break;
|
2013-02-12 22:18:49 +08:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-04-28 22:05:47 +08:00
|
|
|
SDValue Ops[] = { getI32Imm(IsVolatile, DL), getI32Imm(CodeAddrSpace, DL),
|
|
|
|
getI32Imm(VecType, DL), getI32Imm(FromType, DL),
|
|
|
|
getI32Imm(FromTypeWidth, DL), Base, Offset, Chain };
|
2013-02-12 22:18:49 +08:00
|
|
|
|
2013-04-20 06:22:57 +08:00
|
|
|
LD = CurDAG->getMachineNode(Opcode, DL, N->getVTList(), Ops);
|
2013-02-12 22:18:49 +08:00
|
|
|
} else {
|
2015-02-19 08:08:27 +08:00
|
|
|
if (TM.is64Bit()) {
|
2013-02-12 22:18:49 +08:00
|
|
|
switch (N->getOpcode()) {
|
2013-03-30 22:29:21 +08:00
|
|
|
default:
|
2016-05-14 05:12:53 +08:00
|
|
|
return false;
|
2013-02-12 22:18:49 +08:00
|
|
|
case NVPTXISD::LoadV2:
|
|
|
|
switch (EltVT.getSimpleVT().SimpleTy) {
|
2013-03-30 22:29:21 +08:00
|
|
|
default:
|
2016-05-14 05:12:53 +08:00
|
|
|
return false;
|
2013-03-30 22:29:21 +08:00
|
|
|
case MVT::i8:
|
|
|
|
Opcode = NVPTX::LDV_i8_v2_areg_64;
|
|
|
|
break;
|
|
|
|
case MVT::i16:
|
|
|
|
Opcode = NVPTX::LDV_i16_v2_areg_64;
|
|
|
|
break;
|
|
|
|
case MVT::i32:
|
|
|
|
Opcode = NVPTX::LDV_i32_v2_areg_64;
|
|
|
|
break;
|
|
|
|
case MVT::i64:
|
|
|
|
Opcode = NVPTX::LDV_i64_v2_areg_64;
|
|
|
|
break;
|
|
|
|
case MVT::f32:
|
|
|
|
Opcode = NVPTX::LDV_f32_v2_areg_64;
|
|
|
|
break;
|
|
|
|
case MVT::f64:
|
|
|
|
Opcode = NVPTX::LDV_f64_v2_areg_64;
|
|
|
|
break;
|
2013-02-12 22:18:49 +08:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
case NVPTXISD::LoadV4:
|
|
|
|
switch (EltVT.getSimpleVT().SimpleTy) {
|
2013-03-30 22:29:21 +08:00
|
|
|
default:
|
2016-05-14 05:12:53 +08:00
|
|
|
return false;
|
2013-03-30 22:29:21 +08:00
|
|
|
case MVT::i8:
|
|
|
|
Opcode = NVPTX::LDV_i8_v4_areg_64;
|
|
|
|
break;
|
|
|
|
case MVT::i16:
|
|
|
|
Opcode = NVPTX::LDV_i16_v4_areg_64;
|
|
|
|
break;
|
|
|
|
case MVT::i32:
|
|
|
|
Opcode = NVPTX::LDV_i32_v4_areg_64;
|
|
|
|
break;
|
|
|
|
case MVT::f32:
|
|
|
|
Opcode = NVPTX::LDV_f32_v4_areg_64;
|
|
|
|
break;
|
2013-02-12 22:18:49 +08:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
switch (N->getOpcode()) {
|
2013-03-30 22:29:21 +08:00
|
|
|
default:
|
2016-05-14 05:12:53 +08:00
|
|
|
return false;
|
2013-02-12 22:18:49 +08:00
|
|
|
case NVPTXISD::LoadV2:
|
|
|
|
switch (EltVT.getSimpleVT().SimpleTy) {
|
2013-03-30 22:29:21 +08:00
|
|
|
default:
|
2016-05-14 05:12:53 +08:00
|
|
|
return false;
|
2013-03-30 22:29:21 +08:00
|
|
|
case MVT::i8:
|
|
|
|
Opcode = NVPTX::LDV_i8_v2_areg;
|
|
|
|
break;
|
|
|
|
case MVT::i16:
|
|
|
|
Opcode = NVPTX::LDV_i16_v2_areg;
|
|
|
|
break;
|
|
|
|
case MVT::i32:
|
|
|
|
Opcode = NVPTX::LDV_i32_v2_areg;
|
|
|
|
break;
|
|
|
|
case MVT::i64:
|
|
|
|
Opcode = NVPTX::LDV_i64_v2_areg;
|
|
|
|
break;
|
|
|
|
case MVT::f32:
|
|
|
|
Opcode = NVPTX::LDV_f32_v2_areg;
|
|
|
|
break;
|
|
|
|
case MVT::f64:
|
|
|
|
Opcode = NVPTX::LDV_f64_v2_areg;
|
|
|
|
break;
|
2013-02-12 22:18:49 +08:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
case NVPTXISD::LoadV4:
|
|
|
|
switch (EltVT.getSimpleVT().SimpleTy) {
|
2013-03-30 22:29:21 +08:00
|
|
|
default:
|
2016-05-14 05:12:53 +08:00
|
|
|
return false;
|
2013-03-30 22:29:21 +08:00
|
|
|
case MVT::i8:
|
|
|
|
Opcode = NVPTX::LDV_i8_v4_areg;
|
|
|
|
break;
|
|
|
|
case MVT::i16:
|
|
|
|
Opcode = NVPTX::LDV_i16_v4_areg;
|
|
|
|
break;
|
|
|
|
case MVT::i32:
|
|
|
|
Opcode = NVPTX::LDV_i32_v4_areg;
|
|
|
|
break;
|
|
|
|
case MVT::f32:
|
|
|
|
Opcode = NVPTX::LDV_f32_v4_areg;
|
|
|
|
break;
|
2013-02-12 22:18:49 +08:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-04-28 22:05:47 +08:00
|
|
|
SDValue Ops[] = { getI32Imm(IsVolatile, DL), getI32Imm(CodeAddrSpace, DL),
|
|
|
|
getI32Imm(VecType, DL), getI32Imm(FromType, DL),
|
|
|
|
getI32Imm(FromTypeWidth, DL), Op1, Chain };
|
2013-04-20 06:22:57 +08:00
|
|
|
LD = CurDAG->getMachineNode(Opcode, DL, N->getVTList(), Ops);
|
2013-02-12 22:18:49 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
MachineSDNode::mmo_iterator MemRefs0 = MF->allocateMemRefsArray(1);
|
|
|
|
MemRefs0[0] = cast<MemSDNode>(N)->getMemOperand();
|
|
|
|
cast<MachineSDNode>(LD)->setMemRefs(MemRefs0, MemRefs0 + 1);
|
|
|
|
|
2016-05-14 05:12:53 +08:00
|
|
|
ReplaceNode(N, LD);
|
|
|
|
return true;
|
2013-02-12 22:18:49 +08:00
|
|
|
}
|
|
|
|
|
2016-05-14 05:12:53 +08:00
|
|
|
bool NVPTXDAGToDAGISel::tryLDGLDU(SDNode *N) {
|
2013-02-12 22:18:49 +08:00
|
|
|
|
|
|
|
SDValue Chain = N->getOperand(0);
|
2014-06-28 02:35:51 +08:00
|
|
|
SDValue Op1;
|
|
|
|
MemSDNode *Mem;
|
|
|
|
bool IsLDG = true;
|
|
|
|
|
2016-04-05 20:38:01 +08:00
|
|
|
// If this is an LDG intrinsic, the address is the third operand. If its an
|
2014-06-28 02:35:51 +08:00
|
|
|
// LDG/LDU SD node (from custom vector handling), then its the second operand
|
|
|
|
if (N->getOpcode() == ISD::INTRINSIC_W_CHAIN) {
|
|
|
|
Op1 = N->getOperand(2);
|
|
|
|
Mem = cast<MemIntrinsicSDNode>(N);
|
|
|
|
unsigned IID = cast<ConstantSDNode>(N->getOperand(1))->getZExtValue();
|
|
|
|
switch (IID) {
|
|
|
|
default:
|
2016-05-14 05:12:53 +08:00
|
|
|
return false;
|
2014-06-28 02:35:51 +08:00
|
|
|
case Intrinsic::nvvm_ldg_global_f:
|
|
|
|
case Intrinsic::nvvm_ldg_global_i:
|
|
|
|
case Intrinsic::nvvm_ldg_global_p:
|
|
|
|
IsLDG = true;
|
|
|
|
break;
|
|
|
|
case Intrinsic::nvvm_ldu_global_f:
|
|
|
|
case Intrinsic::nvvm_ldu_global_i:
|
|
|
|
case Intrinsic::nvvm_ldu_global_p:
|
|
|
|
IsLDG = false;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
Op1 = N->getOperand(1);
|
|
|
|
Mem = cast<MemSDNode>(N);
|
|
|
|
}
|
|
|
|
|
2013-02-12 22:18:49 +08:00
|
|
|
unsigned Opcode;
|
2013-05-25 10:42:55 +08:00
|
|
|
SDLoc DL(N);
|
2013-02-12 22:18:49 +08:00
|
|
|
SDNode *LD;
|
2013-07-01 20:58:52 +08:00
|
|
|
SDValue Base, Offset, Addr;
|
2013-06-29 01:57:59 +08:00
|
|
|
|
2014-06-28 02:35:51 +08:00
|
|
|
EVT EltVT = Mem->getMemoryVT();
|
2016-04-05 20:38:01 +08:00
|
|
|
unsigned NumElts = 1;
|
2014-06-28 02:35:51 +08:00
|
|
|
if (EltVT.isVector()) {
|
2016-04-05 20:38:01 +08:00
|
|
|
NumElts = EltVT.getVectorNumElements();
|
2014-06-28 02:35:51 +08:00
|
|
|
EltVT = EltVT.getVectorElementType();
|
|
|
|
}
|
2013-02-12 22:18:49 +08:00
|
|
|
|
2016-04-05 20:38:01 +08:00
|
|
|
// Build the "promoted" result VTList for the load. If we are really loading
|
|
|
|
// i8s, then the return type will be promoted to i16 since we do not expose
|
|
|
|
// 8-bit registers in NVPTX.
|
|
|
|
EVT NodeVT = (EltVT == MVT::i8) ? MVT::i16 : EltVT;
|
|
|
|
SmallVector<EVT, 5> InstVTs;
|
|
|
|
for (unsigned i = 0; i != NumElts; ++i) {
|
|
|
|
InstVTs.push_back(NodeVT);
|
|
|
|
}
|
|
|
|
InstVTs.push_back(MVT::Other);
|
|
|
|
SDVTList InstVTList = CurDAG->getVTList(InstVTs);
|
|
|
|
|
2013-07-01 20:58:52 +08:00
|
|
|
if (SelectDirectAddr(Op1, Addr)) {
|
2013-02-12 22:18:49 +08:00
|
|
|
switch (N->getOpcode()) {
|
2013-03-30 22:29:21 +08:00
|
|
|
default:
|
2016-05-14 05:12:53 +08:00
|
|
|
return false;
|
2014-06-28 02:35:51 +08:00
|
|
|
case ISD::INTRINSIC_W_CHAIN:
|
|
|
|
if (IsLDG) {
|
|
|
|
switch (EltVT.getSimpleVT().SimpleTy) {
|
|
|
|
default:
|
2016-05-14 05:12:53 +08:00
|
|
|
return false;
|
2014-06-28 02:35:51 +08:00
|
|
|
case MVT::i8:
|
|
|
|
Opcode = NVPTX::INT_PTX_LDG_GLOBAL_i8avar;
|
|
|
|
break;
|
|
|
|
case MVT::i16:
|
|
|
|
Opcode = NVPTX::INT_PTX_LDG_GLOBAL_i16avar;
|
|
|
|
break;
|
|
|
|
case MVT::i32:
|
|
|
|
Opcode = NVPTX::INT_PTX_LDG_GLOBAL_i32avar;
|
|
|
|
break;
|
|
|
|
case MVT::i64:
|
|
|
|
Opcode = NVPTX::INT_PTX_LDG_GLOBAL_i64avar;
|
|
|
|
break;
|
|
|
|
case MVT::f32:
|
|
|
|
Opcode = NVPTX::INT_PTX_LDG_GLOBAL_f32avar;
|
|
|
|
break;
|
|
|
|
case MVT::f64:
|
|
|
|
Opcode = NVPTX::INT_PTX_LDG_GLOBAL_f64avar;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
switch (EltVT.getSimpleVT().SimpleTy) {
|
|
|
|
default:
|
2016-05-14 05:12:53 +08:00
|
|
|
return false;
|
2014-06-28 02:35:51 +08:00
|
|
|
case MVT::i8:
|
|
|
|
Opcode = NVPTX::INT_PTX_LDU_GLOBAL_i8avar;
|
|
|
|
break;
|
|
|
|
case MVT::i16:
|
|
|
|
Opcode = NVPTX::INT_PTX_LDU_GLOBAL_i16avar;
|
|
|
|
break;
|
|
|
|
case MVT::i32:
|
|
|
|
Opcode = NVPTX::INT_PTX_LDU_GLOBAL_i32avar;
|
|
|
|
break;
|
|
|
|
case MVT::i64:
|
|
|
|
Opcode = NVPTX::INT_PTX_LDU_GLOBAL_i64avar;
|
|
|
|
break;
|
|
|
|
case MVT::f32:
|
|
|
|
Opcode = NVPTX::INT_PTX_LDU_GLOBAL_f32avar;
|
|
|
|
break;
|
|
|
|
case MVT::f64:
|
|
|
|
Opcode = NVPTX::INT_PTX_LDU_GLOBAL_f64avar;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
2013-02-12 22:18:49 +08:00
|
|
|
case NVPTXISD::LDGV2:
|
2013-07-01 20:58:52 +08:00
|
|
|
switch (EltVT.getSimpleVT().SimpleTy) {
|
2013-03-30 22:29:21 +08:00
|
|
|
default:
|
2016-05-14 05:12:53 +08:00
|
|
|
return false;
|
2013-03-30 22:29:21 +08:00
|
|
|
case MVT::i8:
|
2013-07-01 20:58:52 +08:00
|
|
|
Opcode = NVPTX::INT_PTX_LDG_G_v2i8_ELE_avar;
|
2013-03-30 22:29:21 +08:00
|
|
|
break;
|
|
|
|
case MVT::i16:
|
2013-07-01 20:58:52 +08:00
|
|
|
Opcode = NVPTX::INT_PTX_LDG_G_v2i16_ELE_avar;
|
2013-03-30 22:29:21 +08:00
|
|
|
break;
|
|
|
|
case MVT::i32:
|
2013-07-01 20:58:52 +08:00
|
|
|
Opcode = NVPTX::INT_PTX_LDG_G_v2i32_ELE_avar;
|
2013-03-30 22:29:21 +08:00
|
|
|
break;
|
|
|
|
case MVT::i64:
|
2013-07-01 20:58:52 +08:00
|
|
|
Opcode = NVPTX::INT_PTX_LDG_G_v2i64_ELE_avar;
|
2013-03-30 22:29:21 +08:00
|
|
|
break;
|
|
|
|
case MVT::f32:
|
2013-07-01 20:58:52 +08:00
|
|
|
Opcode = NVPTX::INT_PTX_LDG_G_v2f32_ELE_avar;
|
2013-03-30 22:29:21 +08:00
|
|
|
break;
|
|
|
|
case MVT::f64:
|
2013-07-01 20:58:52 +08:00
|
|
|
Opcode = NVPTX::INT_PTX_LDG_G_v2f64_ELE_avar;
|
2013-03-30 22:29:21 +08:00
|
|
|
break;
|
2013-02-12 22:18:49 +08:00
|
|
|
}
|
|
|
|
break;
|
2013-07-01 20:58:52 +08:00
|
|
|
case NVPTXISD::LDUV2:
|
|
|
|
switch (EltVT.getSimpleVT().SimpleTy) {
|
2013-03-30 22:29:21 +08:00
|
|
|
default:
|
2016-05-14 05:12:53 +08:00
|
|
|
return false;
|
2013-03-30 22:29:21 +08:00
|
|
|
case MVT::i8:
|
2013-07-01 20:58:52 +08:00
|
|
|
Opcode = NVPTX::INT_PTX_LDU_G_v2i8_ELE_avar;
|
2013-03-30 22:29:21 +08:00
|
|
|
break;
|
|
|
|
case MVT::i16:
|
2013-07-01 20:58:52 +08:00
|
|
|
Opcode = NVPTX::INT_PTX_LDU_G_v2i16_ELE_avar;
|
2013-03-30 22:29:21 +08:00
|
|
|
break;
|
|
|
|
case MVT::i32:
|
2013-07-01 20:58:52 +08:00
|
|
|
Opcode = NVPTX::INT_PTX_LDU_G_v2i32_ELE_avar;
|
|
|
|
break;
|
|
|
|
case MVT::i64:
|
|
|
|
Opcode = NVPTX::INT_PTX_LDU_G_v2i64_ELE_avar;
|
2013-03-30 22:29:21 +08:00
|
|
|
break;
|
|
|
|
case MVT::f32:
|
2013-07-01 20:58:52 +08:00
|
|
|
Opcode = NVPTX::INT_PTX_LDU_G_v2f32_ELE_avar;
|
|
|
|
break;
|
|
|
|
case MVT::f64:
|
|
|
|
Opcode = NVPTX::INT_PTX_LDU_G_v2f64_ELE_avar;
|
2013-03-30 22:29:21 +08:00
|
|
|
break;
|
2013-02-12 22:18:49 +08:00
|
|
|
}
|
|
|
|
break;
|
2013-07-01 20:58:52 +08:00
|
|
|
case NVPTXISD::LDGV4:
|
|
|
|
switch (EltVT.getSimpleVT().SimpleTy) {
|
2013-03-30 22:29:21 +08:00
|
|
|
default:
|
2016-05-14 05:12:53 +08:00
|
|
|
return false;
|
2013-03-30 22:29:21 +08:00
|
|
|
case MVT::i8:
|
2013-07-01 20:58:52 +08:00
|
|
|
Opcode = NVPTX::INT_PTX_LDG_G_v4i8_ELE_avar;
|
2013-03-30 22:29:21 +08:00
|
|
|
break;
|
|
|
|
case MVT::i16:
|
2013-07-01 20:58:52 +08:00
|
|
|
Opcode = NVPTX::INT_PTX_LDG_G_v4i16_ELE_avar;
|
2013-03-30 22:29:21 +08:00
|
|
|
break;
|
|
|
|
case MVT::i32:
|
2013-07-01 20:58:52 +08:00
|
|
|
Opcode = NVPTX::INT_PTX_LDG_G_v4i32_ELE_avar;
|
2013-03-30 22:29:21 +08:00
|
|
|
break;
|
|
|
|
case MVT::f32:
|
2013-07-01 20:58:52 +08:00
|
|
|
Opcode = NVPTX::INT_PTX_LDG_G_v4f32_ELE_avar;
|
2013-03-30 22:29:21 +08:00
|
|
|
break;
|
2013-02-12 22:18:49 +08:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
case NVPTXISD::LDUV4:
|
2013-07-01 20:58:52 +08:00
|
|
|
switch (EltVT.getSimpleVT().SimpleTy) {
|
2013-03-30 22:29:21 +08:00
|
|
|
default:
|
2016-05-14 05:12:53 +08:00
|
|
|
return false;
|
2013-03-30 22:29:21 +08:00
|
|
|
case MVT::i8:
|
2013-07-01 20:58:52 +08:00
|
|
|
Opcode = NVPTX::INT_PTX_LDU_G_v4i8_ELE_avar;
|
2013-03-30 22:29:21 +08:00
|
|
|
break;
|
|
|
|
case MVT::i16:
|
2013-07-01 20:58:52 +08:00
|
|
|
Opcode = NVPTX::INT_PTX_LDU_G_v4i16_ELE_avar;
|
2013-03-30 22:29:21 +08:00
|
|
|
break;
|
|
|
|
case MVT::i32:
|
2013-07-01 20:58:52 +08:00
|
|
|
Opcode = NVPTX::INT_PTX_LDU_G_v4i32_ELE_avar;
|
2013-03-30 22:29:21 +08:00
|
|
|
break;
|
|
|
|
case MVT::f32:
|
2013-07-01 20:58:52 +08:00
|
|
|
Opcode = NVPTX::INT_PTX_LDU_G_v4f32_ELE_avar;
|
2013-03-30 22:29:21 +08:00
|
|
|
break;
|
2013-02-12 22:18:49 +08:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
2013-07-01 20:58:52 +08:00
|
|
|
|
|
|
|
SDValue Ops[] = { Addr, Chain };
|
2016-04-05 20:38:01 +08:00
|
|
|
LD = CurDAG->getMachineNode(Opcode, DL, InstVTList, Ops);
|
2015-02-19 08:08:27 +08:00
|
|
|
} else if (TM.is64Bit() ? SelectADDRri64(Op1.getNode(), Op1, Base, Offset)
|
|
|
|
: SelectADDRri(Op1.getNode(), Op1, Base, Offset)) {
|
|
|
|
if (TM.is64Bit()) {
|
2013-07-01 20:58:52 +08:00
|
|
|
switch (N->getOpcode()) {
|
2013-03-30 22:29:21 +08:00
|
|
|
default:
|
2016-05-14 05:12:53 +08:00
|
|
|
return false;
|
2015-07-21 05:28:54 +08:00
|
|
|
case ISD::LOAD:
|
2014-06-28 02:35:51 +08:00
|
|
|
case ISD::INTRINSIC_W_CHAIN:
|
|
|
|
if (IsLDG) {
|
|
|
|
switch (EltVT.getSimpleVT().SimpleTy) {
|
|
|
|
default:
|
2016-05-14 05:12:53 +08:00
|
|
|
return false;
|
2014-06-28 02:35:51 +08:00
|
|
|
case MVT::i8:
|
|
|
|
Opcode = NVPTX::INT_PTX_LDG_GLOBAL_i8ari64;
|
|
|
|
break;
|
|
|
|
case MVT::i16:
|
|
|
|
Opcode = NVPTX::INT_PTX_LDG_GLOBAL_i16ari64;
|
|
|
|
break;
|
|
|
|
case MVT::i32:
|
|
|
|
Opcode = NVPTX::INT_PTX_LDG_GLOBAL_i32ari64;
|
|
|
|
break;
|
|
|
|
case MVT::i64:
|
|
|
|
Opcode = NVPTX::INT_PTX_LDG_GLOBAL_i64ari64;
|
|
|
|
break;
|
|
|
|
case MVT::f32:
|
|
|
|
Opcode = NVPTX::INT_PTX_LDG_GLOBAL_f32ari64;
|
|
|
|
break;
|
|
|
|
case MVT::f64:
|
|
|
|
Opcode = NVPTX::INT_PTX_LDG_GLOBAL_f64ari64;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
switch (EltVT.getSimpleVT().SimpleTy) {
|
|
|
|
default:
|
2016-05-14 05:12:53 +08:00
|
|
|
return false;
|
2014-06-28 02:35:51 +08:00
|
|
|
case MVT::i8:
|
|
|
|
Opcode = NVPTX::INT_PTX_LDU_GLOBAL_i8ari64;
|
|
|
|
break;
|
|
|
|
case MVT::i16:
|
|
|
|
Opcode = NVPTX::INT_PTX_LDU_GLOBAL_i16ari64;
|
|
|
|
break;
|
|
|
|
case MVT::i32:
|
|
|
|
Opcode = NVPTX::INT_PTX_LDU_GLOBAL_i32ari64;
|
|
|
|
break;
|
|
|
|
case MVT::i64:
|
|
|
|
Opcode = NVPTX::INT_PTX_LDU_GLOBAL_i64ari64;
|
|
|
|
break;
|
|
|
|
case MVT::f32:
|
|
|
|
Opcode = NVPTX::INT_PTX_LDU_GLOBAL_f32ari64;
|
|
|
|
break;
|
|
|
|
case MVT::f64:
|
|
|
|
Opcode = NVPTX::INT_PTX_LDU_GLOBAL_f64ari64;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
2015-07-21 05:28:54 +08:00
|
|
|
case NVPTXISD::LoadV2:
|
2013-07-01 20:58:52 +08:00
|
|
|
case NVPTXISD::LDGV2:
|
|
|
|
switch (EltVT.getSimpleVT().SimpleTy) {
|
|
|
|
default:
|
2016-05-14 05:12:53 +08:00
|
|
|
return false;
|
2013-07-01 20:58:52 +08:00
|
|
|
case MVT::i8:
|
|
|
|
Opcode = NVPTX::INT_PTX_LDG_G_v2i8_ELE_ari64;
|
|
|
|
break;
|
|
|
|
case MVT::i16:
|
|
|
|
Opcode = NVPTX::INT_PTX_LDG_G_v2i16_ELE_ari64;
|
|
|
|
break;
|
|
|
|
case MVT::i32:
|
|
|
|
Opcode = NVPTX::INT_PTX_LDG_G_v2i32_ELE_ari64;
|
|
|
|
break;
|
|
|
|
case MVT::i64:
|
|
|
|
Opcode = NVPTX::INT_PTX_LDG_G_v2i64_ELE_ari64;
|
|
|
|
break;
|
|
|
|
case MVT::f32:
|
|
|
|
Opcode = NVPTX::INT_PTX_LDG_G_v2f32_ELE_ari64;
|
|
|
|
break;
|
|
|
|
case MVT::f64:
|
|
|
|
Opcode = NVPTX::INT_PTX_LDG_G_v2f64_ELE_ari64;
|
|
|
|
break;
|
|
|
|
}
|
2013-03-30 22:29:21 +08:00
|
|
|
break;
|
2013-07-01 20:58:52 +08:00
|
|
|
case NVPTXISD::LDUV2:
|
|
|
|
switch (EltVT.getSimpleVT().SimpleTy) {
|
|
|
|
default:
|
2016-05-14 05:12:53 +08:00
|
|
|
return false;
|
2013-07-01 20:58:52 +08:00
|
|
|
case MVT::i8:
|
|
|
|
Opcode = NVPTX::INT_PTX_LDU_G_v2i8_ELE_ari64;
|
|
|
|
break;
|
|
|
|
case MVT::i16:
|
|
|
|
Opcode = NVPTX::INT_PTX_LDU_G_v2i16_ELE_ari64;
|
|
|
|
break;
|
|
|
|
case MVT::i32:
|
|
|
|
Opcode = NVPTX::INT_PTX_LDU_G_v2i32_ELE_ari64;
|
|
|
|
break;
|
|
|
|
case MVT::i64:
|
|
|
|
Opcode = NVPTX::INT_PTX_LDU_G_v2i64_ELE_ari64;
|
|
|
|
break;
|
|
|
|
case MVT::f32:
|
|
|
|
Opcode = NVPTX::INT_PTX_LDU_G_v2f32_ELE_ari64;
|
|
|
|
break;
|
|
|
|
case MVT::f64:
|
|
|
|
Opcode = NVPTX::INT_PTX_LDU_G_v2f64_ELE_ari64;
|
|
|
|
break;
|
|
|
|
}
|
2013-03-30 22:29:21 +08:00
|
|
|
break;
|
2015-07-21 05:28:54 +08:00
|
|
|
case NVPTXISD::LoadV4:
|
2013-07-01 20:58:52 +08:00
|
|
|
case NVPTXISD::LDGV4:
|
|
|
|
switch (EltVT.getSimpleVT().SimpleTy) {
|
|
|
|
default:
|
2016-05-14 05:12:53 +08:00
|
|
|
return false;
|
2013-07-01 20:58:52 +08:00
|
|
|
case MVT::i8:
|
|
|
|
Opcode = NVPTX::INT_PTX_LDG_G_v4i8_ELE_ari64;
|
|
|
|
break;
|
|
|
|
case MVT::i16:
|
|
|
|
Opcode = NVPTX::INT_PTX_LDG_G_v4i16_ELE_ari64;
|
|
|
|
break;
|
|
|
|
case MVT::i32:
|
|
|
|
Opcode = NVPTX::INT_PTX_LDG_G_v4i32_ELE_ari64;
|
|
|
|
break;
|
|
|
|
case MVT::f32:
|
|
|
|
Opcode = NVPTX::INT_PTX_LDG_G_v4f32_ELE_ari64;
|
|
|
|
break;
|
|
|
|
}
|
2013-03-30 22:29:21 +08:00
|
|
|
break;
|
2013-07-01 20:58:52 +08:00
|
|
|
case NVPTXISD::LDUV4:
|
|
|
|
switch (EltVT.getSimpleVT().SimpleTy) {
|
|
|
|
default:
|
2016-05-14 05:12:53 +08:00
|
|
|
return false;
|
2013-07-01 20:58:52 +08:00
|
|
|
case MVT::i8:
|
|
|
|
Opcode = NVPTX::INT_PTX_LDU_G_v4i8_ELE_ari64;
|
|
|
|
break;
|
|
|
|
case MVT::i16:
|
|
|
|
Opcode = NVPTX::INT_PTX_LDU_G_v4i16_ELE_ari64;
|
|
|
|
break;
|
|
|
|
case MVT::i32:
|
|
|
|
Opcode = NVPTX::INT_PTX_LDU_G_v4i32_ELE_ari64;
|
|
|
|
break;
|
|
|
|
case MVT::f32:
|
|
|
|
Opcode = NVPTX::INT_PTX_LDU_G_v4f32_ELE_ari64;
|
|
|
|
break;
|
|
|
|
}
|
2013-03-30 22:29:21 +08:00
|
|
|
break;
|
2013-02-12 22:18:49 +08:00
|
|
|
}
|
2013-07-01 20:58:52 +08:00
|
|
|
} else {
|
|
|
|
switch (N->getOpcode()) {
|
2013-03-30 22:29:21 +08:00
|
|
|
default:
|
2016-05-14 05:12:53 +08:00
|
|
|
return false;
|
2015-07-21 05:28:54 +08:00
|
|
|
case ISD::LOAD:
|
2014-06-28 02:35:51 +08:00
|
|
|
case ISD::INTRINSIC_W_CHAIN:
|
|
|
|
if (IsLDG) {
|
|
|
|
switch (EltVT.getSimpleVT().SimpleTy) {
|
|
|
|
default:
|
2016-05-14 05:12:53 +08:00
|
|
|
return false;
|
2014-06-28 02:35:51 +08:00
|
|
|
case MVT::i8:
|
|
|
|
Opcode = NVPTX::INT_PTX_LDG_GLOBAL_i8ari;
|
|
|
|
break;
|
|
|
|
case MVT::i16:
|
|
|
|
Opcode = NVPTX::INT_PTX_LDG_GLOBAL_i16ari;
|
|
|
|
break;
|
|
|
|
case MVT::i32:
|
|
|
|
Opcode = NVPTX::INT_PTX_LDG_GLOBAL_i32ari;
|
|
|
|
break;
|
|
|
|
case MVT::i64:
|
|
|
|
Opcode = NVPTX::INT_PTX_LDG_GLOBAL_i64ari;
|
|
|
|
break;
|
|
|
|
case MVT::f32:
|
|
|
|
Opcode = NVPTX::INT_PTX_LDG_GLOBAL_f32ari;
|
|
|
|
break;
|
|
|
|
case MVT::f64:
|
|
|
|
Opcode = NVPTX::INT_PTX_LDG_GLOBAL_f64ari;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
switch (EltVT.getSimpleVT().SimpleTy) {
|
|
|
|
default:
|
2016-05-14 05:12:53 +08:00
|
|
|
return false;
|
2014-06-28 02:35:51 +08:00
|
|
|
case MVT::i8:
|
|
|
|
Opcode = NVPTX::INT_PTX_LDU_GLOBAL_i8ari;
|
|
|
|
break;
|
|
|
|
case MVT::i16:
|
|
|
|
Opcode = NVPTX::INT_PTX_LDU_GLOBAL_i16ari;
|
|
|
|
break;
|
|
|
|
case MVT::i32:
|
|
|
|
Opcode = NVPTX::INT_PTX_LDU_GLOBAL_i32ari;
|
|
|
|
break;
|
|
|
|
case MVT::i64:
|
|
|
|
Opcode = NVPTX::INT_PTX_LDU_GLOBAL_i64ari;
|
|
|
|
break;
|
|
|
|
case MVT::f32:
|
|
|
|
Opcode = NVPTX::INT_PTX_LDU_GLOBAL_f32ari;
|
|
|
|
break;
|
|
|
|
case MVT::f64:
|
|
|
|
Opcode = NVPTX::INT_PTX_LDU_GLOBAL_f64ari;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
2015-07-21 05:28:54 +08:00
|
|
|
case NVPTXISD::LoadV2:
|
2013-07-01 20:58:52 +08:00
|
|
|
case NVPTXISD::LDGV2:
|
|
|
|
switch (EltVT.getSimpleVT().SimpleTy) {
|
|
|
|
default:
|
2016-05-14 05:12:53 +08:00
|
|
|
return false;
|
2013-07-01 20:58:52 +08:00
|
|
|
case MVT::i8:
|
|
|
|
Opcode = NVPTX::INT_PTX_LDG_G_v2i8_ELE_ari32;
|
|
|
|
break;
|
|
|
|
case MVT::i16:
|
|
|
|
Opcode = NVPTX::INT_PTX_LDG_G_v2i16_ELE_ari32;
|
|
|
|
break;
|
|
|
|
case MVT::i32:
|
|
|
|
Opcode = NVPTX::INT_PTX_LDG_G_v2i32_ELE_ari32;
|
|
|
|
break;
|
|
|
|
case MVT::i64:
|
|
|
|
Opcode = NVPTX::INT_PTX_LDG_G_v2i64_ELE_ari32;
|
|
|
|
break;
|
|
|
|
case MVT::f32:
|
|
|
|
Opcode = NVPTX::INT_PTX_LDG_G_v2f32_ELE_ari32;
|
|
|
|
break;
|
|
|
|
case MVT::f64:
|
|
|
|
Opcode = NVPTX::INT_PTX_LDG_G_v2f64_ELE_ari32;
|
|
|
|
break;
|
|
|
|
}
|
2013-03-30 22:29:21 +08:00
|
|
|
break;
|
2013-07-01 20:58:52 +08:00
|
|
|
case NVPTXISD::LDUV2:
|
|
|
|
switch (EltVT.getSimpleVT().SimpleTy) {
|
|
|
|
default:
|
2016-05-14 05:12:53 +08:00
|
|
|
return false;
|
2013-07-01 20:58:52 +08:00
|
|
|
case MVT::i8:
|
|
|
|
Opcode = NVPTX::INT_PTX_LDU_G_v2i8_ELE_ari32;
|
|
|
|
break;
|
|
|
|
case MVT::i16:
|
|
|
|
Opcode = NVPTX::INT_PTX_LDU_G_v2i16_ELE_ari32;
|
|
|
|
break;
|
|
|
|
case MVT::i32:
|
|
|
|
Opcode = NVPTX::INT_PTX_LDU_G_v2i32_ELE_ari32;
|
|
|
|
break;
|
|
|
|
case MVT::i64:
|
|
|
|
Opcode = NVPTX::INT_PTX_LDU_G_v2i64_ELE_ari32;
|
|
|
|
break;
|
|
|
|
case MVT::f32:
|
|
|
|
Opcode = NVPTX::INT_PTX_LDU_G_v2f32_ELE_ari32;
|
|
|
|
break;
|
|
|
|
case MVT::f64:
|
|
|
|
Opcode = NVPTX::INT_PTX_LDU_G_v2f64_ELE_ari32;
|
|
|
|
break;
|
|
|
|
}
|
2013-03-30 22:29:21 +08:00
|
|
|
break;
|
2015-07-21 05:28:54 +08:00
|
|
|
case NVPTXISD::LoadV4:
|
2013-07-01 20:58:52 +08:00
|
|
|
case NVPTXISD::LDGV4:
|
|
|
|
switch (EltVT.getSimpleVT().SimpleTy) {
|
|
|
|
default:
|
2016-05-14 05:12:53 +08:00
|
|
|
return false;
|
2013-07-01 20:58:52 +08:00
|
|
|
case MVT::i8:
|
|
|
|
Opcode = NVPTX::INT_PTX_LDG_G_v4i8_ELE_ari32;
|
|
|
|
break;
|
|
|
|
case MVT::i16:
|
|
|
|
Opcode = NVPTX::INT_PTX_LDG_G_v4i16_ELE_ari32;
|
|
|
|
break;
|
|
|
|
case MVT::i32:
|
|
|
|
Opcode = NVPTX::INT_PTX_LDG_G_v4i32_ELE_ari32;
|
|
|
|
break;
|
|
|
|
case MVT::f32:
|
|
|
|
Opcode = NVPTX::INT_PTX_LDG_G_v4f32_ELE_ari32;
|
|
|
|
break;
|
|
|
|
}
|
2013-03-30 22:29:21 +08:00
|
|
|
break;
|
2013-07-01 20:58:52 +08:00
|
|
|
case NVPTXISD::LDUV4:
|
|
|
|
switch (EltVT.getSimpleVT().SimpleTy) {
|
|
|
|
default:
|
2016-05-14 05:12:53 +08:00
|
|
|
return false;
|
2013-07-01 20:58:52 +08:00
|
|
|
case MVT::i8:
|
|
|
|
Opcode = NVPTX::INT_PTX_LDU_G_v4i8_ELE_ari32;
|
|
|
|
break;
|
|
|
|
case MVT::i16:
|
|
|
|
Opcode = NVPTX::INT_PTX_LDU_G_v4i16_ELE_ari32;
|
|
|
|
break;
|
|
|
|
case MVT::i32:
|
|
|
|
Opcode = NVPTX::INT_PTX_LDU_G_v4i32_ELE_ari32;
|
|
|
|
break;
|
|
|
|
case MVT::f32:
|
|
|
|
Opcode = NVPTX::INT_PTX_LDU_G_v4f32_ELE_ari32;
|
|
|
|
break;
|
|
|
|
}
|
2013-03-30 22:29:21 +08:00
|
|
|
break;
|
2013-02-12 22:18:49 +08:00
|
|
|
}
|
2013-07-01 20:58:52 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
SDValue Ops[] = { Base, Offset, Chain };
|
|
|
|
|
2016-04-05 20:38:01 +08:00
|
|
|
LD = CurDAG->getMachineNode(Opcode, DL, InstVTList, Ops);
|
2013-07-01 20:58:52 +08:00
|
|
|
} else {
|
2015-02-19 08:08:27 +08:00
|
|
|
if (TM.is64Bit()) {
|
2013-07-01 20:58:52 +08:00
|
|
|
switch (N->getOpcode()) {
|
2013-03-30 22:29:21 +08:00
|
|
|
default:
|
2016-05-14 05:12:53 +08:00
|
|
|
return false;
|
2015-07-21 05:28:54 +08:00
|
|
|
case ISD::LOAD:
|
2014-06-28 02:35:51 +08:00
|
|
|
case ISD::INTRINSIC_W_CHAIN:
|
|
|
|
if (IsLDG) {
|
|
|
|
switch (EltVT.getSimpleVT().SimpleTy) {
|
|
|
|
default:
|
2016-05-14 05:12:53 +08:00
|
|
|
return false;
|
2014-06-28 02:35:51 +08:00
|
|
|
case MVT::i8:
|
|
|
|
Opcode = NVPTX::INT_PTX_LDG_GLOBAL_i8areg64;
|
|
|
|
break;
|
|
|
|
case MVT::i16:
|
|
|
|
Opcode = NVPTX::INT_PTX_LDG_GLOBAL_i16areg64;
|
|
|
|
break;
|
|
|
|
case MVT::i32:
|
|
|
|
Opcode = NVPTX::INT_PTX_LDG_GLOBAL_i32areg64;
|
|
|
|
break;
|
|
|
|
case MVT::i64:
|
|
|
|
Opcode = NVPTX::INT_PTX_LDG_GLOBAL_i64areg64;
|
|
|
|
break;
|
|
|
|
case MVT::f32:
|
|
|
|
Opcode = NVPTX::INT_PTX_LDG_GLOBAL_f32areg64;
|
|
|
|
break;
|
|
|
|
case MVT::f64:
|
|
|
|
Opcode = NVPTX::INT_PTX_LDG_GLOBAL_f64areg64;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
switch (EltVT.getSimpleVT().SimpleTy) {
|
|
|
|
default:
|
2016-05-14 05:12:53 +08:00
|
|
|
return false;
|
2014-06-28 02:35:51 +08:00
|
|
|
case MVT::i8:
|
|
|
|
Opcode = NVPTX::INT_PTX_LDU_GLOBAL_i8areg64;
|
|
|
|
break;
|
|
|
|
case MVT::i16:
|
|
|
|
Opcode = NVPTX::INT_PTX_LDU_GLOBAL_i16areg64;
|
|
|
|
break;
|
|
|
|
case MVT::i32:
|
|
|
|
Opcode = NVPTX::INT_PTX_LDU_GLOBAL_i32areg64;
|
|
|
|
break;
|
|
|
|
case MVT::i64:
|
|
|
|
Opcode = NVPTX::INT_PTX_LDU_GLOBAL_i64areg64;
|
|
|
|
break;
|
|
|
|
case MVT::f32:
|
|
|
|
Opcode = NVPTX::INT_PTX_LDU_GLOBAL_f32areg64;
|
|
|
|
break;
|
|
|
|
case MVT::f64:
|
|
|
|
Opcode = NVPTX::INT_PTX_LDU_GLOBAL_f64areg64;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
2015-07-21 05:28:54 +08:00
|
|
|
case NVPTXISD::LoadV2:
|
2013-07-01 20:58:52 +08:00
|
|
|
case NVPTXISD::LDGV2:
|
|
|
|
switch (EltVT.getSimpleVT().SimpleTy) {
|
|
|
|
default:
|
2016-05-14 05:12:53 +08:00
|
|
|
return false;
|
2013-07-01 20:58:52 +08:00
|
|
|
case MVT::i8:
|
|
|
|
Opcode = NVPTX::INT_PTX_LDG_G_v2i8_ELE_areg64;
|
|
|
|
break;
|
|
|
|
case MVT::i16:
|
|
|
|
Opcode = NVPTX::INT_PTX_LDG_G_v2i16_ELE_areg64;
|
|
|
|
break;
|
|
|
|
case MVT::i32:
|
|
|
|
Opcode = NVPTX::INT_PTX_LDG_G_v2i32_ELE_areg64;
|
|
|
|
break;
|
|
|
|
case MVT::i64:
|
|
|
|
Opcode = NVPTX::INT_PTX_LDG_G_v2i64_ELE_areg64;
|
|
|
|
break;
|
|
|
|
case MVT::f32:
|
|
|
|
Opcode = NVPTX::INT_PTX_LDG_G_v2f32_ELE_areg64;
|
|
|
|
break;
|
|
|
|
case MVT::f64:
|
|
|
|
Opcode = NVPTX::INT_PTX_LDG_G_v2f64_ELE_areg64;
|
|
|
|
break;
|
|
|
|
}
|
2013-03-30 22:29:21 +08:00
|
|
|
break;
|
2013-07-01 20:58:52 +08:00
|
|
|
case NVPTXISD::LDUV2:
|
|
|
|
switch (EltVT.getSimpleVT().SimpleTy) {
|
|
|
|
default:
|
2016-05-14 05:12:53 +08:00
|
|
|
return false;
|
2013-07-01 20:58:52 +08:00
|
|
|
case MVT::i8:
|
|
|
|
Opcode = NVPTX::INT_PTX_LDU_G_v2i8_ELE_areg64;
|
|
|
|
break;
|
|
|
|
case MVT::i16:
|
|
|
|
Opcode = NVPTX::INT_PTX_LDU_G_v2i16_ELE_areg64;
|
|
|
|
break;
|
|
|
|
case MVT::i32:
|
|
|
|
Opcode = NVPTX::INT_PTX_LDU_G_v2i32_ELE_areg64;
|
|
|
|
break;
|
|
|
|
case MVT::i64:
|
|
|
|
Opcode = NVPTX::INT_PTX_LDU_G_v2i64_ELE_areg64;
|
|
|
|
break;
|
|
|
|
case MVT::f32:
|
|
|
|
Opcode = NVPTX::INT_PTX_LDU_G_v2f32_ELE_areg64;
|
|
|
|
break;
|
|
|
|
case MVT::f64:
|
|
|
|
Opcode = NVPTX::INT_PTX_LDU_G_v2f64_ELE_areg64;
|
|
|
|
break;
|
|
|
|
}
|
2013-03-30 22:29:21 +08:00
|
|
|
break;
|
2015-07-21 05:28:54 +08:00
|
|
|
case NVPTXISD::LoadV4:
|
2013-07-01 20:58:52 +08:00
|
|
|
case NVPTXISD::LDGV4:
|
|
|
|
switch (EltVT.getSimpleVT().SimpleTy) {
|
|
|
|
default:
|
2016-05-14 05:12:53 +08:00
|
|
|
return false;
|
2013-07-01 20:58:52 +08:00
|
|
|
case MVT::i8:
|
|
|
|
Opcode = NVPTX::INT_PTX_LDG_G_v4i8_ELE_areg64;
|
|
|
|
break;
|
|
|
|
case MVT::i16:
|
|
|
|
Opcode = NVPTX::INT_PTX_LDG_G_v4i16_ELE_areg64;
|
|
|
|
break;
|
|
|
|
case MVT::i32:
|
|
|
|
Opcode = NVPTX::INT_PTX_LDG_G_v4i32_ELE_areg64;
|
|
|
|
break;
|
|
|
|
case MVT::f32:
|
|
|
|
Opcode = NVPTX::INT_PTX_LDG_G_v4f32_ELE_areg64;
|
|
|
|
break;
|
|
|
|
}
|
2013-03-30 22:29:21 +08:00
|
|
|
break;
|
2013-07-01 20:58:52 +08:00
|
|
|
case NVPTXISD::LDUV4:
|
|
|
|
switch (EltVT.getSimpleVT().SimpleTy) {
|
|
|
|
default:
|
2016-05-14 05:12:53 +08:00
|
|
|
return false;
|
2013-07-01 20:58:52 +08:00
|
|
|
case MVT::i8:
|
|
|
|
Opcode = NVPTX::INT_PTX_LDU_G_v4i8_ELE_areg64;
|
|
|
|
break;
|
|
|
|
case MVT::i16:
|
|
|
|
Opcode = NVPTX::INT_PTX_LDU_G_v4i16_ELE_areg64;
|
|
|
|
break;
|
|
|
|
case MVT::i32:
|
|
|
|
Opcode = NVPTX::INT_PTX_LDU_G_v4i32_ELE_areg64;
|
|
|
|
break;
|
|
|
|
case MVT::f32:
|
|
|
|
Opcode = NVPTX::INT_PTX_LDU_G_v4f32_ELE_areg64;
|
|
|
|
break;
|
|
|
|
}
|
2013-03-30 22:29:21 +08:00
|
|
|
break;
|
2013-02-12 22:18:49 +08:00
|
|
|
}
|
2013-07-01 20:58:52 +08:00
|
|
|
} else {
|
|
|
|
switch (N->getOpcode()) {
|
2013-03-30 22:29:21 +08:00
|
|
|
default:
|
2016-05-14 05:12:53 +08:00
|
|
|
return false;
|
2015-07-21 05:28:54 +08:00
|
|
|
case ISD::LOAD:
|
2014-06-28 02:35:51 +08:00
|
|
|
case ISD::INTRINSIC_W_CHAIN:
|
|
|
|
if (IsLDG) {
|
|
|
|
switch (EltVT.getSimpleVT().SimpleTy) {
|
|
|
|
default:
|
2016-05-14 05:12:53 +08:00
|
|
|
return false;
|
2014-06-28 02:35:51 +08:00
|
|
|
case MVT::i8:
|
|
|
|
Opcode = NVPTX::INT_PTX_LDG_GLOBAL_i8areg;
|
|
|
|
break;
|
|
|
|
case MVT::i16:
|
|
|
|
Opcode = NVPTX::INT_PTX_LDG_GLOBAL_i16areg;
|
|
|
|
break;
|
|
|
|
case MVT::i32:
|
|
|
|
Opcode = NVPTX::INT_PTX_LDG_GLOBAL_i32areg;
|
|
|
|
break;
|
|
|
|
case MVT::i64:
|
|
|
|
Opcode = NVPTX::INT_PTX_LDG_GLOBAL_i64areg;
|
|
|
|
break;
|
|
|
|
case MVT::f32:
|
|
|
|
Opcode = NVPTX::INT_PTX_LDG_GLOBAL_f32areg;
|
|
|
|
break;
|
|
|
|
case MVT::f64:
|
|
|
|
Opcode = NVPTX::INT_PTX_LDG_GLOBAL_f64areg;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
switch (EltVT.getSimpleVT().SimpleTy) {
|
|
|
|
default:
|
2016-05-14 05:12:53 +08:00
|
|
|
return false;
|
2014-06-28 02:35:51 +08:00
|
|
|
case MVT::i8:
|
|
|
|
Opcode = NVPTX::INT_PTX_LDU_GLOBAL_i8areg;
|
|
|
|
break;
|
|
|
|
case MVT::i16:
|
|
|
|
Opcode = NVPTX::INT_PTX_LDU_GLOBAL_i16areg;
|
|
|
|
break;
|
|
|
|
case MVT::i32:
|
|
|
|
Opcode = NVPTX::INT_PTX_LDU_GLOBAL_i32areg;
|
|
|
|
break;
|
|
|
|
case MVT::i64:
|
|
|
|
Opcode = NVPTX::INT_PTX_LDU_GLOBAL_i64areg;
|
|
|
|
break;
|
|
|
|
case MVT::f32:
|
|
|
|
Opcode = NVPTX::INT_PTX_LDU_GLOBAL_f32areg;
|
|
|
|
break;
|
|
|
|
case MVT::f64:
|
|
|
|
Opcode = NVPTX::INT_PTX_LDU_GLOBAL_f64areg;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
2015-07-21 05:28:54 +08:00
|
|
|
case NVPTXISD::LoadV2:
|
2013-07-01 20:58:52 +08:00
|
|
|
case NVPTXISD::LDGV2:
|
|
|
|
switch (EltVT.getSimpleVT().SimpleTy) {
|
|
|
|
default:
|
2016-05-14 05:12:53 +08:00
|
|
|
return false;
|
2013-07-01 20:58:52 +08:00
|
|
|
case MVT::i8:
|
|
|
|
Opcode = NVPTX::INT_PTX_LDG_G_v2i8_ELE_areg32;
|
|
|
|
break;
|
|
|
|
case MVT::i16:
|
|
|
|
Opcode = NVPTX::INT_PTX_LDG_G_v2i16_ELE_areg32;
|
|
|
|
break;
|
|
|
|
case MVT::i32:
|
|
|
|
Opcode = NVPTX::INT_PTX_LDG_G_v2i32_ELE_areg32;
|
|
|
|
break;
|
|
|
|
case MVT::i64:
|
|
|
|
Opcode = NVPTX::INT_PTX_LDG_G_v2i64_ELE_areg32;
|
|
|
|
break;
|
|
|
|
case MVT::f32:
|
|
|
|
Opcode = NVPTX::INT_PTX_LDG_G_v2f32_ELE_areg32;
|
|
|
|
break;
|
|
|
|
case MVT::f64:
|
|
|
|
Opcode = NVPTX::INT_PTX_LDG_G_v2f64_ELE_areg32;
|
|
|
|
break;
|
|
|
|
}
|
2013-03-30 22:29:21 +08:00
|
|
|
break;
|
2013-07-01 20:58:52 +08:00
|
|
|
case NVPTXISD::LDUV2:
|
|
|
|
switch (EltVT.getSimpleVT().SimpleTy) {
|
|
|
|
default:
|
2016-05-14 05:12:53 +08:00
|
|
|
return false;
|
2013-07-01 20:58:52 +08:00
|
|
|
case MVT::i8:
|
|
|
|
Opcode = NVPTX::INT_PTX_LDU_G_v2i8_ELE_areg32;
|
|
|
|
break;
|
|
|
|
case MVT::i16:
|
|
|
|
Opcode = NVPTX::INT_PTX_LDU_G_v2i16_ELE_areg32;
|
|
|
|
break;
|
|
|
|
case MVT::i32:
|
|
|
|
Opcode = NVPTX::INT_PTX_LDU_G_v2i32_ELE_areg32;
|
|
|
|
break;
|
|
|
|
case MVT::i64:
|
|
|
|
Opcode = NVPTX::INT_PTX_LDU_G_v2i64_ELE_areg32;
|
|
|
|
break;
|
|
|
|
case MVT::f32:
|
|
|
|
Opcode = NVPTX::INT_PTX_LDU_G_v2f32_ELE_areg32;
|
|
|
|
break;
|
|
|
|
case MVT::f64:
|
|
|
|
Opcode = NVPTX::INT_PTX_LDU_G_v2f64_ELE_areg32;
|
|
|
|
break;
|
|
|
|
}
|
2013-03-30 22:29:21 +08:00
|
|
|
break;
|
2015-07-21 05:28:54 +08:00
|
|
|
case NVPTXISD::LoadV4:
|
2013-07-01 20:58:52 +08:00
|
|
|
case NVPTXISD::LDGV4:
|
|
|
|
switch (EltVT.getSimpleVT().SimpleTy) {
|
|
|
|
default:
|
2016-05-14 05:12:53 +08:00
|
|
|
return false;
|
2013-07-01 20:58:52 +08:00
|
|
|
case MVT::i8:
|
|
|
|
Opcode = NVPTX::INT_PTX_LDG_G_v4i8_ELE_areg32;
|
|
|
|
break;
|
|
|
|
case MVT::i16:
|
|
|
|
Opcode = NVPTX::INT_PTX_LDG_G_v4i16_ELE_areg32;
|
|
|
|
break;
|
|
|
|
case MVT::i32:
|
|
|
|
Opcode = NVPTX::INT_PTX_LDG_G_v4i32_ELE_areg32;
|
|
|
|
break;
|
|
|
|
case MVT::f32:
|
|
|
|
Opcode = NVPTX::INT_PTX_LDG_G_v4f32_ELE_areg32;
|
|
|
|
break;
|
|
|
|
}
|
2013-03-30 22:29:21 +08:00
|
|
|
break;
|
2013-07-01 20:58:52 +08:00
|
|
|
case NVPTXISD::LDUV4:
|
|
|
|
switch (EltVT.getSimpleVT().SimpleTy) {
|
|
|
|
default:
|
2016-05-14 05:12:53 +08:00
|
|
|
return false;
|
2013-07-01 20:58:52 +08:00
|
|
|
case MVT::i8:
|
|
|
|
Opcode = NVPTX::INT_PTX_LDU_G_v4i8_ELE_areg32;
|
|
|
|
break;
|
|
|
|
case MVT::i16:
|
|
|
|
Opcode = NVPTX::INT_PTX_LDU_G_v4i16_ELE_areg32;
|
|
|
|
break;
|
|
|
|
case MVT::i32:
|
|
|
|
Opcode = NVPTX::INT_PTX_LDU_G_v4i32_ELE_areg32;
|
|
|
|
break;
|
|
|
|
case MVT::f32:
|
|
|
|
Opcode = NVPTX::INT_PTX_LDU_G_v4f32_ELE_areg32;
|
|
|
|
break;
|
|
|
|
}
|
2013-03-30 22:29:21 +08:00
|
|
|
break;
|
2013-02-12 22:18:49 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-07-01 20:58:52 +08:00
|
|
|
SDValue Ops[] = { Op1, Chain };
|
2016-04-05 20:38:01 +08:00
|
|
|
LD = CurDAG->getMachineNode(Opcode, DL, InstVTList, Ops);
|
2013-07-01 20:58:52 +08:00
|
|
|
}
|
2013-02-12 22:18:49 +08:00
|
|
|
|
|
|
|
MachineSDNode::mmo_iterator MemRefs0 = MF->allocateMemRefsArray(1);
|
2014-06-28 02:35:51 +08:00
|
|
|
MemRefs0[0] = Mem->getMemOperand();
|
2013-02-12 22:18:49 +08:00
|
|
|
cast<MachineSDNode>(LD)->setMemRefs(MemRefs0, MemRefs0 + 1);
|
|
|
|
|
2016-04-05 20:38:01 +08:00
|
|
|
// For automatic generation of LDG (through SelectLoad[Vector], not the
|
|
|
|
// intrinsics), we may have an extending load like:
|
|
|
|
//
|
|
|
|
// i32,ch = load<LD1[%data1(addrspace=1)], zext from i8> t0, t7, undef:i64
|
|
|
|
//
|
2016-05-03 02:12:02 +08:00
|
|
|
// In this case, the matching logic above will select a load for the original
|
|
|
|
// memory type (in this case, i8) and our types will not match (the node needs
|
|
|
|
// to return an i32 in this case). Our LDG/LDU nodes do not support the
|
|
|
|
// concept of sign-/zero-extension, so emulate it here by adding an explicit
|
|
|
|
// CVT instruction. Ptxas should clean up any redundancies here.
|
2016-04-05 20:38:01 +08:00
|
|
|
|
2016-05-03 02:12:02 +08:00
|
|
|
EVT OrigType = N->getValueType(0);
|
|
|
|
LoadSDNode *LdNode = dyn_cast<LoadSDNode>(N);
|
|
|
|
|
|
|
|
if (OrigType != EltVT && LdNode) {
|
|
|
|
// We have an extending-load. The instruction we selected operates on the
|
|
|
|
// smaller type, but the SDNode we are replacing has the larger type. We
|
|
|
|
// need to emit a CVT to make the types match.
|
|
|
|
bool IsSigned = LdNode->getExtensionType() == ISD::SEXTLOAD;
|
|
|
|
unsigned CvtOpc = GetConvertOpcode(OrigType.getSimpleVT(),
|
|
|
|
EltVT.getSimpleVT(), IsSigned);
|
|
|
|
|
|
|
|
// For each output value, apply the manual sign/zero-extension and make sure
|
|
|
|
// all users of the load go through that CVT.
|
2016-04-05 20:38:01 +08:00
|
|
|
for (unsigned i = 0; i != NumElts; ++i) {
|
|
|
|
SDValue Res(LD, i);
|
|
|
|
SDValue OrigVal(N, i);
|
|
|
|
|
|
|
|
SDNode *CvtNode =
|
|
|
|
CurDAG->getMachineNode(CvtOpc, DL, OrigType, Res,
|
2016-05-03 02:12:02 +08:00
|
|
|
CurDAG->getTargetConstant(NVPTX::PTXCvtMode::NONE,
|
|
|
|
DL, MVT::i32));
|
2016-04-05 20:38:01 +08:00
|
|
|
ReplaceUses(OrigVal, SDValue(CvtNode, 0));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-05-14 05:12:53 +08:00
|
|
|
ReplaceNode(N, LD);
|
|
|
|
return true;
|
2013-02-12 22:18:49 +08:00
|
|
|
}
|
|
|
|
|
2016-05-14 05:12:53 +08:00
|
|
|
bool NVPTXDAGToDAGISel::tryStore(SDNode *N) {
|
2013-05-25 10:42:55 +08:00
|
|
|
SDLoc dl(N);
|
2012-05-05 04:18:50 +08:00
|
|
|
StoreSDNode *ST = cast<StoreSDNode>(N);
|
|
|
|
EVT StoreVT = ST->getMemoryVT();
|
2014-04-25 13:30:21 +08:00
|
|
|
SDNode *NVPTXST = nullptr;
|
2012-05-05 04:18:50 +08:00
|
|
|
|
|
|
|
// do not support pre/post inc/dec
|
|
|
|
if (ST->isIndexed())
|
2016-05-14 05:12:53 +08:00
|
|
|
return false;
|
2012-05-05 04:18:50 +08:00
|
|
|
|
|
|
|
if (!StoreVT.isSimple())
|
2016-05-14 05:12:53 +08:00
|
|
|
return false;
|
2012-05-05 04:18:50 +08:00
|
|
|
|
|
|
|
// Address Space Setting
|
2015-01-30 09:41:01 +08:00
|
|
|
unsigned int codeAddrSpace = getCodeAddrSpace(ST);
|
2012-05-05 04:18:50 +08:00
|
|
|
|
|
|
|
// Volatile Setting
|
|
|
|
// - .volatile is only availalble for .global and .shared
|
|
|
|
bool isVolatile = ST->isVolatile();
|
|
|
|
if (codeAddrSpace != NVPTX::PTXLdStInstCode::GLOBAL &&
|
|
|
|
codeAddrSpace != NVPTX::PTXLdStInstCode::SHARED &&
|
|
|
|
codeAddrSpace != NVPTX::PTXLdStInstCode::GENERIC)
|
|
|
|
isVolatile = false;
|
|
|
|
|
|
|
|
// Vector Setting
|
|
|
|
MVT SimpleVT = StoreVT.getSimpleVT();
|
|
|
|
unsigned vecType = NVPTX::PTXLdStInstCode::Scalar;
|
|
|
|
if (SimpleVT.isVector()) {
|
|
|
|
unsigned num = SimpleVT.getVectorNumElements();
|
|
|
|
if (num == 2)
|
|
|
|
vecType = NVPTX::PTXLdStInstCode::V2;
|
|
|
|
else if (num == 4)
|
|
|
|
vecType = NVPTX::PTXLdStInstCode::V4;
|
|
|
|
else
|
2016-05-14 05:12:53 +08:00
|
|
|
return false;
|
2012-05-05 04:18:50 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
// Type Setting: toType + toTypeWidth
|
|
|
|
// - for integer type, always use 'u'
|
|
|
|
//
|
|
|
|
MVT ScalarVT = SimpleVT.getScalarType();
|
2013-03-30 22:29:21 +08:00
|
|
|
unsigned toTypeWidth = ScalarVT.getSizeInBits();
|
2012-05-05 04:18:50 +08:00
|
|
|
unsigned int toType;
|
|
|
|
if (ScalarVT.isFloatingPoint())
|
2017-01-14 04:56:17 +08:00
|
|
|
// f16 uses .b16 as its storage type.
|
|
|
|
toType = ScalarVT.SimpleTy == MVT::f16 ? NVPTX::PTXLdStInstCode::Untyped
|
|
|
|
: NVPTX::PTXLdStInstCode::Float;
|
2012-05-05 04:18:50 +08:00
|
|
|
else
|
|
|
|
toType = NVPTX::PTXLdStInstCode::Unsigned;
|
|
|
|
|
|
|
|
// Create the machine instruction DAG
|
|
|
|
SDValue Chain = N->getOperand(0);
|
|
|
|
SDValue N1 = N->getOperand(1);
|
|
|
|
SDValue N2 = N->getOperand(2);
|
|
|
|
SDValue Addr;
|
|
|
|
SDValue Offset, Base;
|
|
|
|
unsigned Opcode;
|
2013-08-15 10:44:19 +08:00
|
|
|
MVT::SimpleValueType SourceVT = N1.getNode()->getSimpleValueType(0).SimpleTy;
|
2012-05-05 04:18:50 +08:00
|
|
|
|
|
|
|
if (SelectDirectAddr(N2, Addr)) {
|
|
|
|
switch (SourceVT) {
|
2013-03-30 22:29:21 +08:00
|
|
|
case MVT::i8:
|
|
|
|
Opcode = NVPTX::ST_i8_avar;
|
|
|
|
break;
|
|
|
|
case MVT::i16:
|
|
|
|
Opcode = NVPTX::ST_i16_avar;
|
|
|
|
break;
|
|
|
|
case MVT::i32:
|
|
|
|
Opcode = NVPTX::ST_i32_avar;
|
|
|
|
break;
|
|
|
|
case MVT::i64:
|
|
|
|
Opcode = NVPTX::ST_i64_avar;
|
|
|
|
break;
|
2017-01-14 04:56:17 +08:00
|
|
|
case MVT::f16:
|
|
|
|
Opcode = NVPTX::ST_f16_avar;
|
|
|
|
break;
|
2013-03-30 22:29:21 +08:00
|
|
|
case MVT::f32:
|
|
|
|
Opcode = NVPTX::ST_f32_avar;
|
|
|
|
break;
|
|
|
|
case MVT::f64:
|
|
|
|
Opcode = NVPTX::ST_f64_avar;
|
|
|
|
break;
|
|
|
|
default:
|
2016-05-14 05:12:53 +08:00
|
|
|
return false;
|
2012-05-05 04:18:50 +08:00
|
|
|
}
|
2015-04-28 22:05:47 +08:00
|
|
|
SDValue Ops[] = { N1, getI32Imm(isVolatile, dl),
|
|
|
|
getI32Imm(codeAddrSpace, dl), getI32Imm(vecType, dl),
|
|
|
|
getI32Imm(toType, dl), getI32Imm(toTypeWidth, dl), Addr,
|
|
|
|
Chain };
|
2013-04-20 06:22:57 +08:00
|
|
|
NVPTXST = CurDAG->getMachineNode(Opcode, dl, MVT::Other, Ops);
|
2015-02-19 08:08:27 +08:00
|
|
|
} else if (TM.is64Bit() ? SelectADDRsi64(N2.getNode(), N2, Base, Offset)
|
|
|
|
: SelectADDRsi(N2.getNode(), N2, Base, Offset)) {
|
2012-05-05 04:18:50 +08:00
|
|
|
switch (SourceVT) {
|
2013-03-30 22:29:21 +08:00
|
|
|
case MVT::i8:
|
|
|
|
Opcode = NVPTX::ST_i8_asi;
|
|
|
|
break;
|
|
|
|
case MVT::i16:
|
|
|
|
Opcode = NVPTX::ST_i16_asi;
|
|
|
|
break;
|
|
|
|
case MVT::i32:
|
|
|
|
Opcode = NVPTX::ST_i32_asi;
|
|
|
|
break;
|
|
|
|
case MVT::i64:
|
|
|
|
Opcode = NVPTX::ST_i64_asi;
|
|
|
|
break;
|
2017-01-14 04:56:17 +08:00
|
|
|
case MVT::f16:
|
|
|
|
Opcode = NVPTX::ST_f16_asi;
|
|
|
|
break;
|
2013-03-30 22:29:21 +08:00
|
|
|
case MVT::f32:
|
|
|
|
Opcode = NVPTX::ST_f32_asi;
|
|
|
|
break;
|
|
|
|
case MVT::f64:
|
|
|
|
Opcode = NVPTX::ST_f64_asi;
|
|
|
|
break;
|
|
|
|
default:
|
2016-05-14 05:12:53 +08:00
|
|
|
return false;
|
2012-05-05 04:18:50 +08:00
|
|
|
}
|
2015-04-28 22:05:47 +08:00
|
|
|
SDValue Ops[] = { N1, getI32Imm(isVolatile, dl),
|
|
|
|
getI32Imm(codeAddrSpace, dl), getI32Imm(vecType, dl),
|
|
|
|
getI32Imm(toType, dl), getI32Imm(toTypeWidth, dl), Base,
|
|
|
|
Offset, Chain };
|
2013-04-20 06:22:57 +08:00
|
|
|
NVPTXST = CurDAG->getMachineNode(Opcode, dl, MVT::Other, Ops);
|
2015-02-19 08:08:27 +08:00
|
|
|
} else if (TM.is64Bit() ? SelectADDRri64(N2.getNode(), N2, Base, Offset)
|
|
|
|
: SelectADDRri(N2.getNode(), N2, Base, Offset)) {
|
|
|
|
if (TM.is64Bit()) {
|
2013-02-12 22:18:49 +08:00
|
|
|
switch (SourceVT) {
|
2013-03-30 22:29:21 +08:00
|
|
|
case MVT::i8:
|
|
|
|
Opcode = NVPTX::ST_i8_ari_64;
|
|
|
|
break;
|
|
|
|
case MVT::i16:
|
|
|
|
Opcode = NVPTX::ST_i16_ari_64;
|
|
|
|
break;
|
|
|
|
case MVT::i32:
|
|
|
|
Opcode = NVPTX::ST_i32_ari_64;
|
|
|
|
break;
|
|
|
|
case MVT::i64:
|
|
|
|
Opcode = NVPTX::ST_i64_ari_64;
|
|
|
|
break;
|
2017-01-14 04:56:17 +08:00
|
|
|
case MVT::f16:
|
|
|
|
Opcode = NVPTX::ST_f16_ari_64;
|
|
|
|
break;
|
2013-03-30 22:29:21 +08:00
|
|
|
case MVT::f32:
|
|
|
|
Opcode = NVPTX::ST_f32_ari_64;
|
|
|
|
break;
|
|
|
|
case MVT::f64:
|
|
|
|
Opcode = NVPTX::ST_f64_ari_64;
|
|
|
|
break;
|
|
|
|
default:
|
2016-05-14 05:12:53 +08:00
|
|
|
return false;
|
2013-02-12 22:18:49 +08:00
|
|
|
}
|
|
|
|
} else {
|
|
|
|
switch (SourceVT) {
|
2013-03-30 22:29:21 +08:00
|
|
|
case MVT::i8:
|
|
|
|
Opcode = NVPTX::ST_i8_ari;
|
|
|
|
break;
|
|
|
|
case MVT::i16:
|
|
|
|
Opcode = NVPTX::ST_i16_ari;
|
|
|
|
break;
|
|
|
|
case MVT::i32:
|
|
|
|
Opcode = NVPTX::ST_i32_ari;
|
|
|
|
break;
|
|
|
|
case MVT::i64:
|
|
|
|
Opcode = NVPTX::ST_i64_ari;
|
|
|
|
break;
|
2017-01-14 04:56:17 +08:00
|
|
|
case MVT::f16:
|
|
|
|
Opcode = NVPTX::ST_f16_ari;
|
|
|
|
break;
|
2013-03-30 22:29:21 +08:00
|
|
|
case MVT::f32:
|
|
|
|
Opcode = NVPTX::ST_f32_ari;
|
|
|
|
break;
|
|
|
|
case MVT::f64:
|
|
|
|
Opcode = NVPTX::ST_f64_ari;
|
|
|
|
break;
|
|
|
|
default:
|
2016-05-14 05:12:53 +08:00
|
|
|
return false;
|
2013-02-12 22:18:49 +08:00
|
|
|
}
|
2012-05-05 04:18:50 +08:00
|
|
|
}
|
2015-04-28 22:05:47 +08:00
|
|
|
SDValue Ops[] = { N1, getI32Imm(isVolatile, dl),
|
|
|
|
getI32Imm(codeAddrSpace, dl), getI32Imm(vecType, dl),
|
|
|
|
getI32Imm(toType, dl), getI32Imm(toTypeWidth, dl), Base,
|
|
|
|
Offset, Chain };
|
2013-04-20 06:22:57 +08:00
|
|
|
NVPTXST = CurDAG->getMachineNode(Opcode, dl, MVT::Other, Ops);
|
2012-05-05 04:18:50 +08:00
|
|
|
} else {
|
2015-02-19 08:08:27 +08:00
|
|
|
if (TM.is64Bit()) {
|
2013-02-12 22:18:49 +08:00
|
|
|
switch (SourceVT) {
|
2013-03-30 22:29:21 +08:00
|
|
|
case MVT::i8:
|
|
|
|
Opcode = NVPTX::ST_i8_areg_64;
|
|
|
|
break;
|
|
|
|
case MVT::i16:
|
|
|
|
Opcode = NVPTX::ST_i16_areg_64;
|
|
|
|
break;
|
|
|
|
case MVT::i32:
|
|
|
|
Opcode = NVPTX::ST_i32_areg_64;
|
|
|
|
break;
|
|
|
|
case MVT::i64:
|
|
|
|
Opcode = NVPTX::ST_i64_areg_64;
|
|
|
|
break;
|
2017-01-14 04:56:17 +08:00
|
|
|
case MVT::f16:
|
|
|
|
Opcode = NVPTX::ST_f16_areg_64;
|
|
|
|
break;
|
2013-03-30 22:29:21 +08:00
|
|
|
case MVT::f32:
|
|
|
|
Opcode = NVPTX::ST_f32_areg_64;
|
|
|
|
break;
|
|
|
|
case MVT::f64:
|
|
|
|
Opcode = NVPTX::ST_f64_areg_64;
|
|
|
|
break;
|
|
|
|
default:
|
2016-05-14 05:12:53 +08:00
|
|
|
return false;
|
2013-02-12 22:18:49 +08:00
|
|
|
}
|
|
|
|
} else {
|
|
|
|
switch (SourceVT) {
|
2013-03-30 22:29:21 +08:00
|
|
|
case MVT::i8:
|
|
|
|
Opcode = NVPTX::ST_i8_areg;
|
|
|
|
break;
|
|
|
|
case MVT::i16:
|
|
|
|
Opcode = NVPTX::ST_i16_areg;
|
|
|
|
break;
|
|
|
|
case MVT::i32:
|
|
|
|
Opcode = NVPTX::ST_i32_areg;
|
|
|
|
break;
|
|
|
|
case MVT::i64:
|
|
|
|
Opcode = NVPTX::ST_i64_areg;
|
|
|
|
break;
|
2017-01-14 04:56:17 +08:00
|
|
|
case MVT::f16:
|
|
|
|
Opcode = NVPTX::ST_f16_areg;
|
|
|
|
break;
|
2013-03-30 22:29:21 +08:00
|
|
|
case MVT::f32:
|
|
|
|
Opcode = NVPTX::ST_f32_areg;
|
|
|
|
break;
|
|
|
|
case MVT::f64:
|
|
|
|
Opcode = NVPTX::ST_f64_areg;
|
|
|
|
break;
|
|
|
|
default:
|
2016-05-14 05:12:53 +08:00
|
|
|
return false;
|
2013-02-12 22:18:49 +08:00
|
|
|
}
|
2012-05-05 04:18:50 +08:00
|
|
|
}
|
2015-04-28 22:05:47 +08:00
|
|
|
SDValue Ops[] = { N1, getI32Imm(isVolatile, dl),
|
|
|
|
getI32Imm(codeAddrSpace, dl), getI32Imm(vecType, dl),
|
|
|
|
getI32Imm(toType, dl), getI32Imm(toTypeWidth, dl), N2,
|
|
|
|
Chain };
|
2013-04-20 06:22:57 +08:00
|
|
|
NVPTXST = CurDAG->getMachineNode(Opcode, dl, MVT::Other, Ops);
|
2012-05-05 04:18:50 +08:00
|
|
|
}
|
|
|
|
|
2016-05-14 05:12:53 +08:00
|
|
|
if (!NVPTXST)
|
|
|
|
return false;
|
2012-05-05 04:18:50 +08:00
|
|
|
|
2016-05-14 05:12:53 +08:00
|
|
|
MachineSDNode::mmo_iterator MemRefs0 = MF->allocateMemRefsArray(1);
|
|
|
|
MemRefs0[0] = cast<MemSDNode>(N)->getMemOperand();
|
|
|
|
cast<MachineSDNode>(NVPTXST)->setMemRefs(MemRefs0, MemRefs0 + 1);
|
|
|
|
ReplaceNode(N, NVPTXST);
|
|
|
|
return true;
|
2012-05-05 04:18:50 +08:00
|
|
|
}
|
|
|
|
|
2016-05-14 05:12:53 +08:00
|
|
|
bool NVPTXDAGToDAGISel::tryStoreVector(SDNode *N) {
|
2013-02-12 22:18:49 +08:00
|
|
|
SDValue Chain = N->getOperand(0);
|
|
|
|
SDValue Op1 = N->getOperand(1);
|
|
|
|
SDValue Addr, Offset, Base;
|
|
|
|
unsigned Opcode;
|
2013-05-25 10:42:55 +08:00
|
|
|
SDLoc DL(N);
|
2013-02-12 22:18:49 +08:00
|
|
|
SDNode *ST;
|
|
|
|
EVT EltVT = Op1.getValueType();
|
|
|
|
MemSDNode *MemSD = cast<MemSDNode>(N);
|
|
|
|
EVT StoreVT = MemSD->getMemoryVT();
|
|
|
|
|
|
|
|
// Address Space Setting
|
2015-01-30 09:41:01 +08:00
|
|
|
unsigned CodeAddrSpace = getCodeAddrSpace(MemSD);
|
2013-02-12 22:18:49 +08:00
|
|
|
|
|
|
|
if (CodeAddrSpace == NVPTX::PTXLdStInstCode::CONSTANT) {
|
|
|
|
report_fatal_error("Cannot store to pointer that points to constant "
|
|
|
|
"memory space");
|
|
|
|
}
|
|
|
|
|
|
|
|
// Volatile Setting
|
|
|
|
// - .volatile is only availalble for .global and .shared
|
|
|
|
bool IsVolatile = MemSD->isVolatile();
|
|
|
|
if (CodeAddrSpace != NVPTX::PTXLdStInstCode::GLOBAL &&
|
|
|
|
CodeAddrSpace != NVPTX::PTXLdStInstCode::SHARED &&
|
|
|
|
CodeAddrSpace != NVPTX::PTXLdStInstCode::GENERIC)
|
|
|
|
IsVolatile = false;
|
|
|
|
|
|
|
|
// Type Setting: toType + toTypeWidth
|
|
|
|
// - for integer type, always use 'u'
|
|
|
|
assert(StoreVT.isSimple() && "Store value is not simple");
|
|
|
|
MVT ScalarVT = StoreVT.getSimpleVT().getScalarType();
|
2013-03-30 22:29:21 +08:00
|
|
|
unsigned ToTypeWidth = ScalarVT.getSizeInBits();
|
2013-02-12 22:18:49 +08:00
|
|
|
unsigned ToType;
|
|
|
|
if (ScalarVT.isFloatingPoint())
|
|
|
|
ToType = NVPTX::PTXLdStInstCode::Float;
|
|
|
|
else
|
|
|
|
ToType = NVPTX::PTXLdStInstCode::Unsigned;
|
|
|
|
|
|
|
|
SmallVector<SDValue, 12> StOps;
|
|
|
|
SDValue N2;
|
|
|
|
unsigned VecType;
|
|
|
|
|
|
|
|
switch (N->getOpcode()) {
|
|
|
|
case NVPTXISD::StoreV2:
|
|
|
|
VecType = NVPTX::PTXLdStInstCode::V2;
|
|
|
|
StOps.push_back(N->getOperand(1));
|
|
|
|
StOps.push_back(N->getOperand(2));
|
|
|
|
N2 = N->getOperand(3);
|
|
|
|
break;
|
|
|
|
case NVPTXISD::StoreV4:
|
|
|
|
VecType = NVPTX::PTXLdStInstCode::V4;
|
|
|
|
StOps.push_back(N->getOperand(1));
|
|
|
|
StOps.push_back(N->getOperand(2));
|
|
|
|
StOps.push_back(N->getOperand(3));
|
|
|
|
StOps.push_back(N->getOperand(4));
|
|
|
|
N2 = N->getOperand(5);
|
|
|
|
break;
|
2013-03-30 22:29:21 +08:00
|
|
|
default:
|
2016-05-14 05:12:53 +08:00
|
|
|
return false;
|
2013-02-12 22:18:49 +08:00
|
|
|
}
|
|
|
|
|
2015-04-28 22:05:47 +08:00
|
|
|
StOps.push_back(getI32Imm(IsVolatile, DL));
|
|
|
|
StOps.push_back(getI32Imm(CodeAddrSpace, DL));
|
|
|
|
StOps.push_back(getI32Imm(VecType, DL));
|
|
|
|
StOps.push_back(getI32Imm(ToType, DL));
|
|
|
|
StOps.push_back(getI32Imm(ToTypeWidth, DL));
|
2013-02-12 22:18:49 +08:00
|
|
|
|
|
|
|
if (SelectDirectAddr(N2, Addr)) {
|
|
|
|
switch (N->getOpcode()) {
|
2013-03-30 22:29:21 +08:00
|
|
|
default:
|
2016-05-14 05:12:53 +08:00
|
|
|
return false;
|
2013-02-12 22:18:49 +08:00
|
|
|
case NVPTXISD::StoreV2:
|
|
|
|
switch (EltVT.getSimpleVT().SimpleTy) {
|
2013-03-30 22:29:21 +08:00
|
|
|
default:
|
2016-05-14 05:12:53 +08:00
|
|
|
return false;
|
2013-03-30 22:29:21 +08:00
|
|
|
case MVT::i8:
|
|
|
|
Opcode = NVPTX::STV_i8_v2_avar;
|
|
|
|
break;
|
|
|
|
case MVT::i16:
|
|
|
|
Opcode = NVPTX::STV_i16_v2_avar;
|
|
|
|
break;
|
|
|
|
case MVT::i32:
|
|
|
|
Opcode = NVPTX::STV_i32_v2_avar;
|
|
|
|
break;
|
|
|
|
case MVT::i64:
|
|
|
|
Opcode = NVPTX::STV_i64_v2_avar;
|
|
|
|
break;
|
|
|
|
case MVT::f32:
|
|
|
|
Opcode = NVPTX::STV_f32_v2_avar;
|
|
|
|
break;
|
|
|
|
case MVT::f64:
|
|
|
|
Opcode = NVPTX::STV_f64_v2_avar;
|
|
|
|
break;
|
2013-02-12 22:18:49 +08:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
case NVPTXISD::StoreV4:
|
|
|
|
switch (EltVT.getSimpleVT().SimpleTy) {
|
2013-03-30 22:29:21 +08:00
|
|
|
default:
|
2016-05-14 05:12:53 +08:00
|
|
|
return false;
|
2013-03-30 22:29:21 +08:00
|
|
|
case MVT::i8:
|
|
|
|
Opcode = NVPTX::STV_i8_v4_avar;
|
|
|
|
break;
|
|
|
|
case MVT::i16:
|
|
|
|
Opcode = NVPTX::STV_i16_v4_avar;
|
|
|
|
break;
|
|
|
|
case MVT::i32:
|
|
|
|
Opcode = NVPTX::STV_i32_v4_avar;
|
|
|
|
break;
|
|
|
|
case MVT::f32:
|
|
|
|
Opcode = NVPTX::STV_f32_v4_avar;
|
|
|
|
break;
|
2013-02-12 22:18:49 +08:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
StOps.push_back(Addr);
|
2015-02-19 08:08:27 +08:00
|
|
|
} else if (TM.is64Bit() ? SelectADDRsi64(N2.getNode(), N2, Base, Offset)
|
|
|
|
: SelectADDRsi(N2.getNode(), N2, Base, Offset)) {
|
2013-02-12 22:18:49 +08:00
|
|
|
switch (N->getOpcode()) {
|
2013-03-30 22:29:21 +08:00
|
|
|
default:
|
2016-05-14 05:12:53 +08:00
|
|
|
return false;
|
2013-02-12 22:18:49 +08:00
|
|
|
case NVPTXISD::StoreV2:
|
|
|
|
switch (EltVT.getSimpleVT().SimpleTy) {
|
2013-03-30 22:29:21 +08:00
|
|
|
default:
|
2016-05-14 05:12:53 +08:00
|
|
|
return false;
|
2013-03-30 22:29:21 +08:00
|
|
|
case MVT::i8:
|
|
|
|
Opcode = NVPTX::STV_i8_v2_asi;
|
|
|
|
break;
|
|
|
|
case MVT::i16:
|
|
|
|
Opcode = NVPTX::STV_i16_v2_asi;
|
|
|
|
break;
|
|
|
|
case MVT::i32:
|
|
|
|
Opcode = NVPTX::STV_i32_v2_asi;
|
|
|
|
break;
|
|
|
|
case MVT::i64:
|
|
|
|
Opcode = NVPTX::STV_i64_v2_asi;
|
|
|
|
break;
|
|
|
|
case MVT::f32:
|
|
|
|
Opcode = NVPTX::STV_f32_v2_asi;
|
|
|
|
break;
|
|
|
|
case MVT::f64:
|
|
|
|
Opcode = NVPTX::STV_f64_v2_asi;
|
|
|
|
break;
|
2013-02-12 22:18:49 +08:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
case NVPTXISD::StoreV4:
|
|
|
|
switch (EltVT.getSimpleVT().SimpleTy) {
|
2013-03-30 22:29:21 +08:00
|
|
|
default:
|
2016-05-14 05:12:53 +08:00
|
|
|
return false;
|
2013-03-30 22:29:21 +08:00
|
|
|
case MVT::i8:
|
|
|
|
Opcode = NVPTX::STV_i8_v4_asi;
|
|
|
|
break;
|
|
|
|
case MVT::i16:
|
|
|
|
Opcode = NVPTX::STV_i16_v4_asi;
|
|
|
|
break;
|
|
|
|
case MVT::i32:
|
|
|
|
Opcode = NVPTX::STV_i32_v4_asi;
|
|
|
|
break;
|
|
|
|
case MVT::f32:
|
|
|
|
Opcode = NVPTX::STV_f32_v4_asi;
|
|
|
|
break;
|
2013-02-12 22:18:49 +08:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
StOps.push_back(Base);
|
|
|
|
StOps.push_back(Offset);
|
2015-02-19 08:08:27 +08:00
|
|
|
} else if (TM.is64Bit() ? SelectADDRri64(N2.getNode(), N2, Base, Offset)
|
|
|
|
: SelectADDRri(N2.getNode(), N2, Base, Offset)) {
|
|
|
|
if (TM.is64Bit()) {
|
2013-02-12 22:18:49 +08:00
|
|
|
switch (N->getOpcode()) {
|
2013-03-30 22:29:21 +08:00
|
|
|
default:
|
2016-05-14 05:12:53 +08:00
|
|
|
return false;
|
2013-02-12 22:18:49 +08:00
|
|
|
case NVPTXISD::StoreV2:
|
|
|
|
switch (EltVT.getSimpleVT().SimpleTy) {
|
2013-03-30 22:29:21 +08:00
|
|
|
default:
|
2016-05-14 05:12:53 +08:00
|
|
|
return false;
|
2013-03-30 22:29:21 +08:00
|
|
|
case MVT::i8:
|
|
|
|
Opcode = NVPTX::STV_i8_v2_ari_64;
|
|
|
|
break;
|
|
|
|
case MVT::i16:
|
|
|
|
Opcode = NVPTX::STV_i16_v2_ari_64;
|
|
|
|
break;
|
|
|
|
case MVT::i32:
|
|
|
|
Opcode = NVPTX::STV_i32_v2_ari_64;
|
|
|
|
break;
|
|
|
|
case MVT::i64:
|
|
|
|
Opcode = NVPTX::STV_i64_v2_ari_64;
|
|
|
|
break;
|
|
|
|
case MVT::f32:
|
|
|
|
Opcode = NVPTX::STV_f32_v2_ari_64;
|
|
|
|
break;
|
|
|
|
case MVT::f64:
|
|
|
|
Opcode = NVPTX::STV_f64_v2_ari_64;
|
|
|
|
break;
|
2013-02-12 22:18:49 +08:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
case NVPTXISD::StoreV4:
|
|
|
|
switch (EltVT.getSimpleVT().SimpleTy) {
|
2013-03-30 22:29:21 +08:00
|
|
|
default:
|
2016-05-14 05:12:53 +08:00
|
|
|
return false;
|
2013-03-30 22:29:21 +08:00
|
|
|
case MVT::i8:
|
|
|
|
Opcode = NVPTX::STV_i8_v4_ari_64;
|
|
|
|
break;
|
|
|
|
case MVT::i16:
|
|
|
|
Opcode = NVPTX::STV_i16_v4_ari_64;
|
|
|
|
break;
|
|
|
|
case MVT::i32:
|
|
|
|
Opcode = NVPTX::STV_i32_v4_ari_64;
|
|
|
|
break;
|
|
|
|
case MVT::f32:
|
|
|
|
Opcode = NVPTX::STV_f32_v4_ari_64;
|
|
|
|
break;
|
2013-02-12 22:18:49 +08:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
switch (N->getOpcode()) {
|
2013-03-30 22:29:21 +08:00
|
|
|
default:
|
2016-05-14 05:12:53 +08:00
|
|
|
return false;
|
2013-02-12 22:18:49 +08:00
|
|
|
case NVPTXISD::StoreV2:
|
|
|
|
switch (EltVT.getSimpleVT().SimpleTy) {
|
2013-03-30 22:29:21 +08:00
|
|
|
default:
|
2016-05-14 05:12:53 +08:00
|
|
|
return false;
|
2013-03-30 22:29:21 +08:00
|
|
|
case MVT::i8:
|
|
|
|
Opcode = NVPTX::STV_i8_v2_ari;
|
|
|
|
break;
|
|
|
|
case MVT::i16:
|
|
|
|
Opcode = NVPTX::STV_i16_v2_ari;
|
|
|
|
break;
|
|
|
|
case MVT::i32:
|
|
|
|
Opcode = NVPTX::STV_i32_v2_ari;
|
|
|
|
break;
|
|
|
|
case MVT::i64:
|
|
|
|
Opcode = NVPTX::STV_i64_v2_ari;
|
|
|
|
break;
|
|
|
|
case MVT::f32:
|
|
|
|
Opcode = NVPTX::STV_f32_v2_ari;
|
|
|
|
break;
|
|
|
|
case MVT::f64:
|
|
|
|
Opcode = NVPTX::STV_f64_v2_ari;
|
|
|
|
break;
|
2013-02-12 22:18:49 +08:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
case NVPTXISD::StoreV4:
|
|
|
|
switch (EltVT.getSimpleVT().SimpleTy) {
|
2013-03-30 22:29:21 +08:00
|
|
|
default:
|
2016-05-14 05:12:53 +08:00
|
|
|
return false;
|
2013-03-30 22:29:21 +08:00
|
|
|
case MVT::i8:
|
|
|
|
Opcode = NVPTX::STV_i8_v4_ari;
|
|
|
|
break;
|
|
|
|
case MVT::i16:
|
|
|
|
Opcode = NVPTX::STV_i16_v4_ari;
|
|
|
|
break;
|
|
|
|
case MVT::i32:
|
|
|
|
Opcode = NVPTX::STV_i32_v4_ari;
|
|
|
|
break;
|
|
|
|
case MVT::f32:
|
|
|
|
Opcode = NVPTX::STV_f32_v4_ari;
|
|
|
|
break;
|
2013-02-12 22:18:49 +08:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
StOps.push_back(Base);
|
|
|
|
StOps.push_back(Offset);
|
|
|
|
} else {
|
2015-02-19 08:08:27 +08:00
|
|
|
if (TM.is64Bit()) {
|
2013-02-12 22:18:49 +08:00
|
|
|
switch (N->getOpcode()) {
|
2013-03-30 22:29:21 +08:00
|
|
|
default:
|
2016-05-14 05:12:53 +08:00
|
|
|
return false;
|
2013-02-12 22:18:49 +08:00
|
|
|
case NVPTXISD::StoreV2:
|
|
|
|
switch (EltVT.getSimpleVT().SimpleTy) {
|
2013-03-30 22:29:21 +08:00
|
|
|
default:
|
2016-05-14 05:12:53 +08:00
|
|
|
return false;
|
2013-03-30 22:29:21 +08:00
|
|
|
case MVT::i8:
|
|
|
|
Opcode = NVPTX::STV_i8_v2_areg_64;
|
|
|
|
break;
|
|
|
|
case MVT::i16:
|
|
|
|
Opcode = NVPTX::STV_i16_v2_areg_64;
|
|
|
|
break;
|
|
|
|
case MVT::i32:
|
|
|
|
Opcode = NVPTX::STV_i32_v2_areg_64;
|
|
|
|
break;
|
|
|
|
case MVT::i64:
|
|
|
|
Opcode = NVPTX::STV_i64_v2_areg_64;
|
|
|
|
break;
|
|
|
|
case MVT::f32:
|
|
|
|
Opcode = NVPTX::STV_f32_v2_areg_64;
|
|
|
|
break;
|
|
|
|
case MVT::f64:
|
|
|
|
Opcode = NVPTX::STV_f64_v2_areg_64;
|
|
|
|
break;
|
2013-02-12 22:18:49 +08:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
case NVPTXISD::StoreV4:
|
|
|
|
switch (EltVT.getSimpleVT().SimpleTy) {
|
2013-03-30 22:29:21 +08:00
|
|
|
default:
|
2016-05-14 05:12:53 +08:00
|
|
|
return false;
|
2013-03-30 22:29:21 +08:00
|
|
|
case MVT::i8:
|
|
|
|
Opcode = NVPTX::STV_i8_v4_areg_64;
|
|
|
|
break;
|
|
|
|
case MVT::i16:
|
|
|
|
Opcode = NVPTX::STV_i16_v4_areg_64;
|
|
|
|
break;
|
|
|
|
case MVT::i32:
|
|
|
|
Opcode = NVPTX::STV_i32_v4_areg_64;
|
|
|
|
break;
|
|
|
|
case MVT::f32:
|
|
|
|
Opcode = NVPTX::STV_f32_v4_areg_64;
|
|
|
|
break;
|
2013-02-12 22:18:49 +08:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
switch (N->getOpcode()) {
|
2013-03-30 22:29:21 +08:00
|
|
|
default:
|
2016-05-14 05:12:53 +08:00
|
|
|
return false;
|
2013-02-12 22:18:49 +08:00
|
|
|
case NVPTXISD::StoreV2:
|
|
|
|
switch (EltVT.getSimpleVT().SimpleTy) {
|
2013-03-30 22:29:21 +08:00
|
|
|
default:
|
2016-05-14 05:12:53 +08:00
|
|
|
return false;
|
2013-03-30 22:29:21 +08:00
|
|
|
case MVT::i8:
|
|
|
|
Opcode = NVPTX::STV_i8_v2_areg;
|
|
|
|
break;
|
|
|
|
case MVT::i16:
|
|
|
|
Opcode = NVPTX::STV_i16_v2_areg;
|
|
|
|
break;
|
|
|
|
case MVT::i32:
|
|
|
|
Opcode = NVPTX::STV_i32_v2_areg;
|
|
|
|
break;
|
|
|
|
case MVT::i64:
|
|
|
|
Opcode = NVPTX::STV_i64_v2_areg;
|
|
|
|
break;
|
|
|
|
case MVT::f32:
|
|
|
|
Opcode = NVPTX::STV_f32_v2_areg;
|
|
|
|
break;
|
|
|
|
case MVT::f64:
|
|
|
|
Opcode = NVPTX::STV_f64_v2_areg;
|
|
|
|
break;
|
2013-02-12 22:18:49 +08:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
case NVPTXISD::StoreV4:
|
|
|
|
switch (EltVT.getSimpleVT().SimpleTy) {
|
2013-03-30 22:29:21 +08:00
|
|
|
default:
|
2016-05-14 05:12:53 +08:00
|
|
|
return false;
|
2013-03-30 22:29:21 +08:00
|
|
|
case MVT::i8:
|
|
|
|
Opcode = NVPTX::STV_i8_v4_areg;
|
|
|
|
break;
|
|
|
|
case MVT::i16:
|
|
|
|
Opcode = NVPTX::STV_i16_v4_areg;
|
|
|
|
break;
|
|
|
|
case MVT::i32:
|
|
|
|
Opcode = NVPTX::STV_i32_v4_areg;
|
|
|
|
break;
|
|
|
|
case MVT::f32:
|
|
|
|
Opcode = NVPTX::STV_f32_v4_areg;
|
|
|
|
break;
|
2013-02-12 22:18:49 +08:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
StOps.push_back(N2);
|
|
|
|
}
|
|
|
|
|
|
|
|
StOps.push_back(Chain);
|
|
|
|
|
2013-04-20 06:22:57 +08:00
|
|
|
ST = CurDAG->getMachineNode(Opcode, DL, MVT::Other, StOps);
|
2013-02-12 22:18:49 +08:00
|
|
|
|
|
|
|
MachineSDNode::mmo_iterator MemRefs0 = MF->allocateMemRefsArray(1);
|
|
|
|
MemRefs0[0] = cast<MemSDNode>(N)->getMemOperand();
|
|
|
|
cast<MachineSDNode>(ST)->setMemRefs(MemRefs0, MemRefs0 + 1);
|
|
|
|
|
2016-05-14 05:12:53 +08:00
|
|
|
ReplaceNode(N, ST);
|
|
|
|
return true;
|
2013-02-12 22:18:49 +08:00
|
|
|
}
|
|
|
|
|
2016-05-14 05:12:53 +08:00
|
|
|
bool NVPTXDAGToDAGISel::tryLoadParam(SDNode *Node) {
|
2013-06-29 01:57:59 +08:00
|
|
|
SDValue Chain = Node->getOperand(0);
|
|
|
|
SDValue Offset = Node->getOperand(2);
|
|
|
|
SDValue Flag = Node->getOperand(3);
|
|
|
|
SDLoc DL(Node);
|
|
|
|
MemSDNode *Mem = cast<MemSDNode>(Node);
|
|
|
|
|
|
|
|
unsigned VecSize;
|
|
|
|
switch (Node->getOpcode()) {
|
|
|
|
default:
|
2016-05-14 05:12:53 +08:00
|
|
|
return false;
|
2013-06-29 01:57:59 +08:00
|
|
|
case NVPTXISD::LoadParam:
|
|
|
|
VecSize = 1;
|
|
|
|
break;
|
|
|
|
case NVPTXISD::LoadParamV2:
|
|
|
|
VecSize = 2;
|
|
|
|
break;
|
|
|
|
case NVPTXISD::LoadParamV4:
|
|
|
|
VecSize = 4;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
EVT EltVT = Node->getValueType(0);
|
|
|
|
EVT MemVT = Mem->getMemoryVT();
|
|
|
|
|
|
|
|
unsigned Opc = 0;
|
|
|
|
|
|
|
|
switch (VecSize) {
|
|
|
|
default:
|
2016-05-14 05:12:53 +08:00
|
|
|
return false;
|
2013-06-29 01:57:59 +08:00
|
|
|
case 1:
|
|
|
|
switch (MemVT.getSimpleVT().SimpleTy) {
|
|
|
|
default:
|
2016-05-14 05:12:53 +08:00
|
|
|
return false;
|
2013-06-29 01:57:59 +08:00
|
|
|
case MVT::i1:
|
|
|
|
Opc = NVPTX::LoadParamMemI8;
|
|
|
|
break;
|
|
|
|
case MVT::i8:
|
|
|
|
Opc = NVPTX::LoadParamMemI8;
|
|
|
|
break;
|
|
|
|
case MVT::i16:
|
|
|
|
Opc = NVPTX::LoadParamMemI16;
|
|
|
|
break;
|
|
|
|
case MVT::i32:
|
|
|
|
Opc = NVPTX::LoadParamMemI32;
|
|
|
|
break;
|
|
|
|
case MVT::i64:
|
|
|
|
Opc = NVPTX::LoadParamMemI64;
|
|
|
|
break;
|
2017-01-14 04:56:17 +08:00
|
|
|
case MVT::f16:
|
|
|
|
Opc = NVPTX::LoadParamMemF16;
|
|
|
|
break;
|
2013-06-29 01:57:59 +08:00
|
|
|
case MVT::f32:
|
|
|
|
Opc = NVPTX::LoadParamMemF32;
|
|
|
|
break;
|
|
|
|
case MVT::f64:
|
|
|
|
Opc = NVPTX::LoadParamMemF64;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case 2:
|
|
|
|
switch (MemVT.getSimpleVT().SimpleTy) {
|
|
|
|
default:
|
2016-05-14 05:12:53 +08:00
|
|
|
return false;
|
2013-06-29 01:57:59 +08:00
|
|
|
case MVT::i1:
|
|
|
|
Opc = NVPTX::LoadParamMemV2I8;
|
|
|
|
break;
|
|
|
|
case MVT::i8:
|
|
|
|
Opc = NVPTX::LoadParamMemV2I8;
|
|
|
|
break;
|
|
|
|
case MVT::i16:
|
|
|
|
Opc = NVPTX::LoadParamMemV2I16;
|
|
|
|
break;
|
|
|
|
case MVT::i32:
|
|
|
|
Opc = NVPTX::LoadParamMemV2I32;
|
|
|
|
break;
|
|
|
|
case MVT::i64:
|
|
|
|
Opc = NVPTX::LoadParamMemV2I64;
|
|
|
|
break;
|
|
|
|
case MVT::f32:
|
|
|
|
Opc = NVPTX::LoadParamMemV2F32;
|
|
|
|
break;
|
|
|
|
case MVT::f64:
|
|
|
|
Opc = NVPTX::LoadParamMemV2F64;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case 4:
|
|
|
|
switch (MemVT.getSimpleVT().SimpleTy) {
|
|
|
|
default:
|
2016-05-14 05:12:53 +08:00
|
|
|
return false;
|
2013-06-29 01:57:59 +08:00
|
|
|
case MVT::i1:
|
|
|
|
Opc = NVPTX::LoadParamMemV4I8;
|
|
|
|
break;
|
|
|
|
case MVT::i8:
|
|
|
|
Opc = NVPTX::LoadParamMemV4I8;
|
|
|
|
break;
|
|
|
|
case MVT::i16:
|
|
|
|
Opc = NVPTX::LoadParamMemV4I16;
|
|
|
|
break;
|
|
|
|
case MVT::i32:
|
|
|
|
Opc = NVPTX::LoadParamMemV4I32;
|
|
|
|
break;
|
|
|
|
case MVT::f32:
|
|
|
|
Opc = NVPTX::LoadParamMemV4F32;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
SDVTList VTs;
|
|
|
|
if (VecSize == 1) {
|
|
|
|
VTs = CurDAG->getVTList(EltVT, MVT::Other, MVT::Glue);
|
|
|
|
} else if (VecSize == 2) {
|
|
|
|
VTs = CurDAG->getVTList(EltVT, EltVT, MVT::Other, MVT::Glue);
|
|
|
|
} else {
|
|
|
|
EVT EVTs[] = { EltVT, EltVT, EltVT, EltVT, MVT::Other, MVT::Glue };
|
2014-04-16 14:10:51 +08:00
|
|
|
VTs = CurDAG->getVTList(EVTs);
|
2013-06-29 01:57:59 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
unsigned OffsetVal = cast<ConstantSDNode>(Offset)->getZExtValue();
|
|
|
|
|
|
|
|
SmallVector<SDValue, 2> Ops;
|
2015-04-28 22:05:47 +08:00
|
|
|
Ops.push_back(CurDAG->getTargetConstant(OffsetVal, DL, MVT::i32));
|
2013-06-29 01:57:59 +08:00
|
|
|
Ops.push_back(Chain);
|
|
|
|
Ops.push_back(Flag);
|
|
|
|
|
2016-05-14 05:12:53 +08:00
|
|
|
ReplaceNode(Node, CurDAG->getMachineNode(Opc, DL, VTs, Ops));
|
|
|
|
return true;
|
2013-06-29 01:57:59 +08:00
|
|
|
}
|
|
|
|
|
2016-05-14 05:12:53 +08:00
|
|
|
bool NVPTXDAGToDAGISel::tryStoreRetval(SDNode *N) {
|
2013-06-29 01:57:59 +08:00
|
|
|
SDLoc DL(N);
|
|
|
|
SDValue Chain = N->getOperand(0);
|
|
|
|
SDValue Offset = N->getOperand(1);
|
|
|
|
unsigned OffsetVal = cast<ConstantSDNode>(Offset)->getZExtValue();
|
|
|
|
MemSDNode *Mem = cast<MemSDNode>(N);
|
|
|
|
|
|
|
|
// How many elements do we have?
|
|
|
|
unsigned NumElts = 1;
|
|
|
|
switch (N->getOpcode()) {
|
|
|
|
default:
|
2016-05-14 05:12:53 +08:00
|
|
|
return false;
|
2013-06-29 01:57:59 +08:00
|
|
|
case NVPTXISD::StoreRetval:
|
|
|
|
NumElts = 1;
|
|
|
|
break;
|
|
|
|
case NVPTXISD::StoreRetvalV2:
|
|
|
|
NumElts = 2;
|
|
|
|
break;
|
|
|
|
case NVPTXISD::StoreRetvalV4:
|
|
|
|
NumElts = 4;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Build vector of operands
|
|
|
|
SmallVector<SDValue, 6> Ops;
|
|
|
|
for (unsigned i = 0; i < NumElts; ++i)
|
|
|
|
Ops.push_back(N->getOperand(i + 2));
|
2015-04-28 22:05:47 +08:00
|
|
|
Ops.push_back(CurDAG->getTargetConstant(OffsetVal, DL, MVT::i32));
|
2013-06-29 01:57:59 +08:00
|
|
|
Ops.push_back(Chain);
|
|
|
|
|
|
|
|
// Determine target opcode
|
|
|
|
// If we have an i1, use an 8-bit store. The lowering code in
|
|
|
|
// NVPTXISelLowering will have already emitted an upcast.
|
|
|
|
unsigned Opcode = 0;
|
|
|
|
switch (NumElts) {
|
|
|
|
default:
|
2016-05-14 05:12:53 +08:00
|
|
|
return false;
|
2013-06-29 01:57:59 +08:00
|
|
|
case 1:
|
|
|
|
switch (Mem->getMemoryVT().getSimpleVT().SimpleTy) {
|
|
|
|
default:
|
2016-05-14 05:12:53 +08:00
|
|
|
return false;
|
2013-06-29 01:57:59 +08:00
|
|
|
case MVT::i1:
|
|
|
|
Opcode = NVPTX::StoreRetvalI8;
|
|
|
|
break;
|
|
|
|
case MVT::i8:
|
|
|
|
Opcode = NVPTX::StoreRetvalI8;
|
|
|
|
break;
|
|
|
|
case MVT::i16:
|
|
|
|
Opcode = NVPTX::StoreRetvalI16;
|
|
|
|
break;
|
|
|
|
case MVT::i32:
|
|
|
|
Opcode = NVPTX::StoreRetvalI32;
|
|
|
|
break;
|
|
|
|
case MVT::i64:
|
|
|
|
Opcode = NVPTX::StoreRetvalI64;
|
|
|
|
break;
|
2017-01-14 04:56:17 +08:00
|
|
|
case MVT::f16:
|
|
|
|
Opcode = NVPTX::StoreRetvalF16;
|
|
|
|
break;
|
2013-06-29 01:57:59 +08:00
|
|
|
case MVT::f32:
|
|
|
|
Opcode = NVPTX::StoreRetvalF32;
|
|
|
|
break;
|
|
|
|
case MVT::f64:
|
|
|
|
Opcode = NVPTX::StoreRetvalF64;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case 2:
|
|
|
|
switch (Mem->getMemoryVT().getSimpleVT().SimpleTy) {
|
|
|
|
default:
|
2016-05-14 05:12:53 +08:00
|
|
|
return false;
|
2013-06-29 01:57:59 +08:00
|
|
|
case MVT::i1:
|
|
|
|
Opcode = NVPTX::StoreRetvalV2I8;
|
|
|
|
break;
|
|
|
|
case MVT::i8:
|
|
|
|
Opcode = NVPTX::StoreRetvalV2I8;
|
|
|
|
break;
|
|
|
|
case MVT::i16:
|
|
|
|
Opcode = NVPTX::StoreRetvalV2I16;
|
|
|
|
break;
|
|
|
|
case MVT::i32:
|
|
|
|
Opcode = NVPTX::StoreRetvalV2I32;
|
|
|
|
break;
|
|
|
|
case MVT::i64:
|
|
|
|
Opcode = NVPTX::StoreRetvalV2I64;
|
|
|
|
break;
|
|
|
|
case MVT::f32:
|
|
|
|
Opcode = NVPTX::StoreRetvalV2F32;
|
|
|
|
break;
|
|
|
|
case MVT::f64:
|
|
|
|
Opcode = NVPTX::StoreRetvalV2F64;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case 4:
|
|
|
|
switch (Mem->getMemoryVT().getSimpleVT().SimpleTy) {
|
|
|
|
default:
|
2016-05-14 05:12:53 +08:00
|
|
|
return false;
|
2013-06-29 01:57:59 +08:00
|
|
|
case MVT::i1:
|
|
|
|
Opcode = NVPTX::StoreRetvalV4I8;
|
|
|
|
break;
|
|
|
|
case MVT::i8:
|
|
|
|
Opcode = NVPTX::StoreRetvalV4I8;
|
|
|
|
break;
|
|
|
|
case MVT::i16:
|
|
|
|
Opcode = NVPTX::StoreRetvalV4I16;
|
|
|
|
break;
|
|
|
|
case MVT::i32:
|
|
|
|
Opcode = NVPTX::StoreRetvalV4I32;
|
|
|
|
break;
|
|
|
|
case MVT::f32:
|
|
|
|
Opcode = NVPTX::StoreRetvalV4F32;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
SDNode *Ret =
|
|
|
|
CurDAG->getMachineNode(Opcode, DL, MVT::Other, Ops);
|
|
|
|
MachineSDNode::mmo_iterator MemRefs0 = MF->allocateMemRefsArray(1);
|
|
|
|
MemRefs0[0] = cast<MemSDNode>(N)->getMemOperand();
|
|
|
|
cast<MachineSDNode>(Ret)->setMemRefs(MemRefs0, MemRefs0 + 1);
|
|
|
|
|
2016-05-14 05:12:53 +08:00
|
|
|
ReplaceNode(N, Ret);
|
|
|
|
return true;
|
2013-06-29 01:57:59 +08:00
|
|
|
}
|
|
|
|
|
2016-05-14 05:12:53 +08:00
|
|
|
bool NVPTXDAGToDAGISel::tryStoreParam(SDNode *N) {
|
2013-06-29 01:57:59 +08:00
|
|
|
SDLoc DL(N);
|
|
|
|
SDValue Chain = N->getOperand(0);
|
|
|
|
SDValue Param = N->getOperand(1);
|
|
|
|
unsigned ParamVal = cast<ConstantSDNode>(Param)->getZExtValue();
|
|
|
|
SDValue Offset = N->getOperand(2);
|
|
|
|
unsigned OffsetVal = cast<ConstantSDNode>(Offset)->getZExtValue();
|
|
|
|
MemSDNode *Mem = cast<MemSDNode>(N);
|
|
|
|
SDValue Flag = N->getOperand(N->getNumOperands() - 1);
|
|
|
|
|
|
|
|
// How many elements do we have?
|
|
|
|
unsigned NumElts = 1;
|
|
|
|
switch (N->getOpcode()) {
|
|
|
|
default:
|
2016-05-14 05:12:53 +08:00
|
|
|
return false;
|
2013-06-29 01:57:59 +08:00
|
|
|
case NVPTXISD::StoreParamU32:
|
|
|
|
case NVPTXISD::StoreParamS32:
|
|
|
|
case NVPTXISD::StoreParam:
|
|
|
|
NumElts = 1;
|
|
|
|
break;
|
|
|
|
case NVPTXISD::StoreParamV2:
|
|
|
|
NumElts = 2;
|
|
|
|
break;
|
|
|
|
case NVPTXISD::StoreParamV4:
|
|
|
|
NumElts = 4;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Build vector of operands
|
|
|
|
SmallVector<SDValue, 8> Ops;
|
|
|
|
for (unsigned i = 0; i < NumElts; ++i)
|
|
|
|
Ops.push_back(N->getOperand(i + 3));
|
2015-04-28 22:05:47 +08:00
|
|
|
Ops.push_back(CurDAG->getTargetConstant(ParamVal, DL, MVT::i32));
|
|
|
|
Ops.push_back(CurDAG->getTargetConstant(OffsetVal, DL, MVT::i32));
|
2013-06-29 01:57:59 +08:00
|
|
|
Ops.push_back(Chain);
|
|
|
|
Ops.push_back(Flag);
|
|
|
|
|
|
|
|
// Determine target opcode
|
|
|
|
// If we have an i1, use an 8-bit store. The lowering code in
|
|
|
|
// NVPTXISelLowering will have already emitted an upcast.
|
|
|
|
unsigned Opcode = 0;
|
|
|
|
switch (N->getOpcode()) {
|
|
|
|
default:
|
|
|
|
switch (NumElts) {
|
|
|
|
default:
|
2016-05-14 05:12:53 +08:00
|
|
|
return false;
|
2013-06-29 01:57:59 +08:00
|
|
|
case 1:
|
|
|
|
switch (Mem->getMemoryVT().getSimpleVT().SimpleTy) {
|
|
|
|
default:
|
2016-05-14 05:12:53 +08:00
|
|
|
return false;
|
2013-06-29 01:57:59 +08:00
|
|
|
case MVT::i1:
|
|
|
|
Opcode = NVPTX::StoreParamI8;
|
|
|
|
break;
|
|
|
|
case MVT::i8:
|
|
|
|
Opcode = NVPTX::StoreParamI8;
|
|
|
|
break;
|
|
|
|
case MVT::i16:
|
|
|
|
Opcode = NVPTX::StoreParamI16;
|
|
|
|
break;
|
|
|
|
case MVT::i32:
|
|
|
|
Opcode = NVPTX::StoreParamI32;
|
|
|
|
break;
|
|
|
|
case MVT::i64:
|
|
|
|
Opcode = NVPTX::StoreParamI64;
|
|
|
|
break;
|
2017-01-14 04:56:17 +08:00
|
|
|
case MVT::f16:
|
|
|
|
Opcode = NVPTX::StoreParamF16;
|
|
|
|
break;
|
2013-06-29 01:57:59 +08:00
|
|
|
case MVT::f32:
|
|
|
|
Opcode = NVPTX::StoreParamF32;
|
|
|
|
break;
|
|
|
|
case MVT::f64:
|
|
|
|
Opcode = NVPTX::StoreParamF64;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case 2:
|
|
|
|
switch (Mem->getMemoryVT().getSimpleVT().SimpleTy) {
|
|
|
|
default:
|
2016-05-14 05:12:53 +08:00
|
|
|
return false;
|
2013-06-29 01:57:59 +08:00
|
|
|
case MVT::i1:
|
|
|
|
Opcode = NVPTX::StoreParamV2I8;
|
|
|
|
break;
|
|
|
|
case MVT::i8:
|
|
|
|
Opcode = NVPTX::StoreParamV2I8;
|
|
|
|
break;
|
|
|
|
case MVT::i16:
|
|
|
|
Opcode = NVPTX::StoreParamV2I16;
|
|
|
|
break;
|
|
|
|
case MVT::i32:
|
|
|
|
Opcode = NVPTX::StoreParamV2I32;
|
|
|
|
break;
|
|
|
|
case MVT::i64:
|
|
|
|
Opcode = NVPTX::StoreParamV2I64;
|
|
|
|
break;
|
|
|
|
case MVT::f32:
|
|
|
|
Opcode = NVPTX::StoreParamV2F32;
|
|
|
|
break;
|
|
|
|
case MVT::f64:
|
|
|
|
Opcode = NVPTX::StoreParamV2F64;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case 4:
|
|
|
|
switch (Mem->getMemoryVT().getSimpleVT().SimpleTy) {
|
|
|
|
default:
|
2016-05-14 05:12:53 +08:00
|
|
|
return false;
|
2013-06-29 01:57:59 +08:00
|
|
|
case MVT::i1:
|
|
|
|
Opcode = NVPTX::StoreParamV4I8;
|
|
|
|
break;
|
|
|
|
case MVT::i8:
|
|
|
|
Opcode = NVPTX::StoreParamV4I8;
|
|
|
|
break;
|
|
|
|
case MVT::i16:
|
|
|
|
Opcode = NVPTX::StoreParamV4I16;
|
|
|
|
break;
|
|
|
|
case MVT::i32:
|
|
|
|
Opcode = NVPTX::StoreParamV4I32;
|
|
|
|
break;
|
|
|
|
case MVT::f32:
|
|
|
|
Opcode = NVPTX::StoreParamV4F32;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
break;
|
2013-06-29 01:58:04 +08:00
|
|
|
// Special case: if we have a sign-extend/zero-extend node, insert the
|
|
|
|
// conversion instruction first, and use that as the value operand to
|
|
|
|
// the selected StoreParam node.
|
|
|
|
case NVPTXISD::StoreParamU32: {
|
|
|
|
Opcode = NVPTX::StoreParamI32;
|
2015-04-28 22:05:47 +08:00
|
|
|
SDValue CvtNone = CurDAG->getTargetConstant(NVPTX::PTXCvtMode::NONE, DL,
|
2013-06-29 01:58:04 +08:00
|
|
|
MVT::i32);
|
|
|
|
SDNode *Cvt = CurDAG->getMachineNode(NVPTX::CVT_u32_u16, DL,
|
|
|
|
MVT::i32, Ops[0], CvtNone);
|
|
|
|
Ops[0] = SDValue(Cvt, 0);
|
2013-06-29 01:57:59 +08:00
|
|
|
break;
|
2013-06-29 01:58:04 +08:00
|
|
|
}
|
|
|
|
case NVPTXISD::StoreParamS32: {
|
|
|
|
Opcode = NVPTX::StoreParamI32;
|
2015-04-28 22:05:47 +08:00
|
|
|
SDValue CvtNone = CurDAG->getTargetConstant(NVPTX::PTXCvtMode::NONE, DL,
|
2013-06-29 01:58:04 +08:00
|
|
|
MVT::i32);
|
|
|
|
SDNode *Cvt = CurDAG->getMachineNode(NVPTX::CVT_s32_s16, DL,
|
|
|
|
MVT::i32, Ops[0], CvtNone);
|
|
|
|
Ops[0] = SDValue(Cvt, 0);
|
2013-06-29 01:57:59 +08:00
|
|
|
break;
|
|
|
|
}
|
2013-06-29 01:58:04 +08:00
|
|
|
}
|
2013-06-29 01:57:59 +08:00
|
|
|
|
2013-07-01 20:59:01 +08:00
|
|
|
SDVTList RetVTs = CurDAG->getVTList(MVT::Other, MVT::Glue);
|
2013-06-29 01:57:59 +08:00
|
|
|
SDNode *Ret =
|
2013-07-01 20:59:01 +08:00
|
|
|
CurDAG->getMachineNode(Opcode, DL, RetVTs, Ops);
|
2013-06-29 01:57:59 +08:00
|
|
|
MachineSDNode::mmo_iterator MemRefs0 = MF->allocateMemRefsArray(1);
|
|
|
|
MemRefs0[0] = cast<MemSDNode>(N)->getMemOperand();
|
|
|
|
cast<MachineSDNode>(Ret)->setMemRefs(MemRefs0, MemRefs0 + 1);
|
|
|
|
|
2016-05-14 05:12:53 +08:00
|
|
|
ReplaceNode(N, Ret);
|
|
|
|
return true;
|
2013-06-29 01:57:59 +08:00
|
|
|
}
|
|
|
|
|
2016-05-14 05:12:53 +08:00
|
|
|
bool NVPTXDAGToDAGISel::tryTextureIntrinsic(SDNode *N) {
|
2014-04-09 23:39:15 +08:00
|
|
|
SDValue Chain = N->getOperand(0);
|
|
|
|
unsigned Opc = 0;
|
|
|
|
SmallVector<SDValue, 8> Ops;
|
|
|
|
|
|
|
|
switch (N->getOpcode()) {
|
2016-05-14 05:12:53 +08:00
|
|
|
default: return false;
|
2014-07-17 19:59:04 +08:00
|
|
|
case NVPTXISD::Tex1DFloatS32:
|
|
|
|
Opc = NVPTX::TEX_1D_F32_S32;
|
2014-04-09 23:39:15 +08:00
|
|
|
break;
|
|
|
|
case NVPTXISD::Tex1DFloatFloat:
|
|
|
|
Opc = NVPTX::TEX_1D_F32_F32;
|
|
|
|
break;
|
|
|
|
case NVPTXISD::Tex1DFloatFloatLevel:
|
|
|
|
Opc = NVPTX::TEX_1D_F32_F32_LEVEL;
|
|
|
|
break;
|
|
|
|
case NVPTXISD::Tex1DFloatFloatGrad:
|
|
|
|
Opc = NVPTX::TEX_1D_F32_F32_GRAD;
|
|
|
|
break;
|
2014-07-17 19:59:04 +08:00
|
|
|
case NVPTXISD::Tex1DS32S32:
|
|
|
|
Opc = NVPTX::TEX_1D_S32_S32;
|
2014-04-09 23:39:15 +08:00
|
|
|
break;
|
2014-07-17 19:59:04 +08:00
|
|
|
case NVPTXISD::Tex1DS32Float:
|
|
|
|
Opc = NVPTX::TEX_1D_S32_F32;
|
2014-04-09 23:39:15 +08:00
|
|
|
break;
|
2014-07-17 19:59:04 +08:00
|
|
|
case NVPTXISD::Tex1DS32FloatLevel:
|
|
|
|
Opc = NVPTX::TEX_1D_S32_F32_LEVEL;
|
2014-04-09 23:39:15 +08:00
|
|
|
break;
|
2014-07-17 19:59:04 +08:00
|
|
|
case NVPTXISD::Tex1DS32FloatGrad:
|
|
|
|
Opc = NVPTX::TEX_1D_S32_F32_GRAD;
|
2014-04-09 23:39:15 +08:00
|
|
|
break;
|
2014-07-17 19:59:04 +08:00
|
|
|
case NVPTXISD::Tex1DU32S32:
|
|
|
|
Opc = NVPTX::TEX_1D_U32_S32;
|
|
|
|
break;
|
|
|
|
case NVPTXISD::Tex1DU32Float:
|
|
|
|
Opc = NVPTX::TEX_1D_U32_F32;
|
|
|
|
break;
|
|
|
|
case NVPTXISD::Tex1DU32FloatLevel:
|
|
|
|
Opc = NVPTX::TEX_1D_U32_F32_LEVEL;
|
|
|
|
break;
|
|
|
|
case NVPTXISD::Tex1DU32FloatGrad:
|
|
|
|
Opc = NVPTX::TEX_1D_U32_F32_GRAD;
|
|
|
|
break;
|
|
|
|
case NVPTXISD::Tex1DArrayFloatS32:
|
|
|
|
Opc = NVPTX::TEX_1D_ARRAY_F32_S32;
|
2014-04-09 23:39:15 +08:00
|
|
|
break;
|
|
|
|
case NVPTXISD::Tex1DArrayFloatFloat:
|
|
|
|
Opc = NVPTX::TEX_1D_ARRAY_F32_F32;
|
|
|
|
break;
|
|
|
|
case NVPTXISD::Tex1DArrayFloatFloatLevel:
|
|
|
|
Opc = NVPTX::TEX_1D_ARRAY_F32_F32_LEVEL;
|
|
|
|
break;
|
|
|
|
case NVPTXISD::Tex1DArrayFloatFloatGrad:
|
|
|
|
Opc = NVPTX::TEX_1D_ARRAY_F32_F32_GRAD;
|
|
|
|
break;
|
2014-07-17 19:59:04 +08:00
|
|
|
case NVPTXISD::Tex1DArrayS32S32:
|
|
|
|
Opc = NVPTX::TEX_1D_ARRAY_S32_S32;
|
|
|
|
break;
|
|
|
|
case NVPTXISD::Tex1DArrayS32Float:
|
|
|
|
Opc = NVPTX::TEX_1D_ARRAY_S32_F32;
|
|
|
|
break;
|
|
|
|
case NVPTXISD::Tex1DArrayS32FloatLevel:
|
|
|
|
Opc = NVPTX::TEX_1D_ARRAY_S32_F32_LEVEL;
|
|
|
|
break;
|
|
|
|
case NVPTXISD::Tex1DArrayS32FloatGrad:
|
|
|
|
Opc = NVPTX::TEX_1D_ARRAY_S32_F32_GRAD;
|
|
|
|
break;
|
|
|
|
case NVPTXISD::Tex1DArrayU32S32:
|
|
|
|
Opc = NVPTX::TEX_1D_ARRAY_U32_S32;
|
2014-04-09 23:39:15 +08:00
|
|
|
break;
|
2014-07-17 19:59:04 +08:00
|
|
|
case NVPTXISD::Tex1DArrayU32Float:
|
|
|
|
Opc = NVPTX::TEX_1D_ARRAY_U32_F32;
|
2014-04-09 23:39:15 +08:00
|
|
|
break;
|
2014-07-17 19:59:04 +08:00
|
|
|
case NVPTXISD::Tex1DArrayU32FloatLevel:
|
|
|
|
Opc = NVPTX::TEX_1D_ARRAY_U32_F32_LEVEL;
|
2014-04-09 23:39:15 +08:00
|
|
|
break;
|
2014-07-17 19:59:04 +08:00
|
|
|
case NVPTXISD::Tex1DArrayU32FloatGrad:
|
|
|
|
Opc = NVPTX::TEX_1D_ARRAY_U32_F32_GRAD;
|
2014-04-09 23:39:15 +08:00
|
|
|
break;
|
2014-07-17 19:59:04 +08:00
|
|
|
case NVPTXISD::Tex2DFloatS32:
|
|
|
|
Opc = NVPTX::TEX_2D_F32_S32;
|
2014-04-09 23:39:15 +08:00
|
|
|
break;
|
|
|
|
case NVPTXISD::Tex2DFloatFloat:
|
|
|
|
Opc = NVPTX::TEX_2D_F32_F32;
|
|
|
|
break;
|
|
|
|
case NVPTXISD::Tex2DFloatFloatLevel:
|
|
|
|
Opc = NVPTX::TEX_2D_F32_F32_LEVEL;
|
|
|
|
break;
|
|
|
|
case NVPTXISD::Tex2DFloatFloatGrad:
|
|
|
|
Opc = NVPTX::TEX_2D_F32_F32_GRAD;
|
|
|
|
break;
|
2014-07-17 19:59:04 +08:00
|
|
|
case NVPTXISD::Tex2DS32S32:
|
|
|
|
Opc = NVPTX::TEX_2D_S32_S32;
|
2014-04-09 23:39:15 +08:00
|
|
|
break;
|
2014-07-17 19:59:04 +08:00
|
|
|
case NVPTXISD::Tex2DS32Float:
|
|
|
|
Opc = NVPTX::TEX_2D_S32_F32;
|
2014-04-09 23:39:15 +08:00
|
|
|
break;
|
2014-07-17 19:59:04 +08:00
|
|
|
case NVPTXISD::Tex2DS32FloatLevel:
|
|
|
|
Opc = NVPTX::TEX_2D_S32_F32_LEVEL;
|
2014-04-09 23:39:15 +08:00
|
|
|
break;
|
2014-07-17 19:59:04 +08:00
|
|
|
case NVPTXISD::Tex2DS32FloatGrad:
|
|
|
|
Opc = NVPTX::TEX_2D_S32_F32_GRAD;
|
2014-04-09 23:39:15 +08:00
|
|
|
break;
|
2014-07-17 19:59:04 +08:00
|
|
|
case NVPTXISD::Tex2DU32S32:
|
|
|
|
Opc = NVPTX::TEX_2D_U32_S32;
|
|
|
|
break;
|
|
|
|
case NVPTXISD::Tex2DU32Float:
|
|
|
|
Opc = NVPTX::TEX_2D_U32_F32;
|
|
|
|
break;
|
|
|
|
case NVPTXISD::Tex2DU32FloatLevel:
|
|
|
|
Opc = NVPTX::TEX_2D_U32_F32_LEVEL;
|
|
|
|
break;
|
|
|
|
case NVPTXISD::Tex2DU32FloatGrad:
|
|
|
|
Opc = NVPTX::TEX_2D_U32_F32_GRAD;
|
|
|
|
break;
|
|
|
|
case NVPTXISD::Tex2DArrayFloatS32:
|
|
|
|
Opc = NVPTX::TEX_2D_ARRAY_F32_S32;
|
2014-04-09 23:39:15 +08:00
|
|
|
break;
|
|
|
|
case NVPTXISD::Tex2DArrayFloatFloat:
|
|
|
|
Opc = NVPTX::TEX_2D_ARRAY_F32_F32;
|
|
|
|
break;
|
|
|
|
case NVPTXISD::Tex2DArrayFloatFloatLevel:
|
|
|
|
Opc = NVPTX::TEX_2D_ARRAY_F32_F32_LEVEL;
|
|
|
|
break;
|
|
|
|
case NVPTXISD::Tex2DArrayFloatFloatGrad:
|
|
|
|
Opc = NVPTX::TEX_2D_ARRAY_F32_F32_GRAD;
|
|
|
|
break;
|
2014-07-17 19:59:04 +08:00
|
|
|
case NVPTXISD::Tex2DArrayS32S32:
|
|
|
|
Opc = NVPTX::TEX_2D_ARRAY_S32_S32;
|
|
|
|
break;
|
|
|
|
case NVPTXISD::Tex2DArrayS32Float:
|
|
|
|
Opc = NVPTX::TEX_2D_ARRAY_S32_F32;
|
|
|
|
break;
|
|
|
|
case NVPTXISD::Tex2DArrayS32FloatLevel:
|
|
|
|
Opc = NVPTX::TEX_2D_ARRAY_S32_F32_LEVEL;
|
|
|
|
break;
|
|
|
|
case NVPTXISD::Tex2DArrayS32FloatGrad:
|
|
|
|
Opc = NVPTX::TEX_2D_ARRAY_S32_F32_GRAD;
|
|
|
|
break;
|
|
|
|
case NVPTXISD::Tex2DArrayU32S32:
|
|
|
|
Opc = NVPTX::TEX_2D_ARRAY_U32_S32;
|
2014-04-09 23:39:15 +08:00
|
|
|
break;
|
2014-07-17 19:59:04 +08:00
|
|
|
case NVPTXISD::Tex2DArrayU32Float:
|
|
|
|
Opc = NVPTX::TEX_2D_ARRAY_U32_F32;
|
2014-04-09 23:39:15 +08:00
|
|
|
break;
|
2014-07-17 19:59:04 +08:00
|
|
|
case NVPTXISD::Tex2DArrayU32FloatLevel:
|
|
|
|
Opc = NVPTX::TEX_2D_ARRAY_U32_F32_LEVEL;
|
2014-04-09 23:39:15 +08:00
|
|
|
break;
|
2014-07-17 19:59:04 +08:00
|
|
|
case NVPTXISD::Tex2DArrayU32FloatGrad:
|
|
|
|
Opc = NVPTX::TEX_2D_ARRAY_U32_F32_GRAD;
|
2014-04-09 23:39:15 +08:00
|
|
|
break;
|
2014-07-17 19:59:04 +08:00
|
|
|
case NVPTXISD::Tex3DFloatS32:
|
|
|
|
Opc = NVPTX::TEX_3D_F32_S32;
|
2014-04-09 23:39:15 +08:00
|
|
|
break;
|
|
|
|
case NVPTXISD::Tex3DFloatFloat:
|
|
|
|
Opc = NVPTX::TEX_3D_F32_F32;
|
|
|
|
break;
|
|
|
|
case NVPTXISD::Tex3DFloatFloatLevel:
|
|
|
|
Opc = NVPTX::TEX_3D_F32_F32_LEVEL;
|
|
|
|
break;
|
|
|
|
case NVPTXISD::Tex3DFloatFloatGrad:
|
|
|
|
Opc = NVPTX::TEX_3D_F32_F32_GRAD;
|
|
|
|
break;
|
2014-07-17 19:59:04 +08:00
|
|
|
case NVPTXISD::Tex3DS32S32:
|
|
|
|
Opc = NVPTX::TEX_3D_S32_S32;
|
|
|
|
break;
|
|
|
|
case NVPTXISD::Tex3DS32Float:
|
|
|
|
Opc = NVPTX::TEX_3D_S32_F32;
|
|
|
|
break;
|
|
|
|
case NVPTXISD::Tex3DS32FloatLevel:
|
|
|
|
Opc = NVPTX::TEX_3D_S32_F32_LEVEL;
|
|
|
|
break;
|
|
|
|
case NVPTXISD::Tex3DS32FloatGrad:
|
|
|
|
Opc = NVPTX::TEX_3D_S32_F32_GRAD;
|
|
|
|
break;
|
|
|
|
case NVPTXISD::Tex3DU32S32:
|
|
|
|
Opc = NVPTX::TEX_3D_U32_S32;
|
|
|
|
break;
|
|
|
|
case NVPTXISD::Tex3DU32Float:
|
|
|
|
Opc = NVPTX::TEX_3D_U32_F32;
|
|
|
|
break;
|
|
|
|
case NVPTXISD::Tex3DU32FloatLevel:
|
|
|
|
Opc = NVPTX::TEX_3D_U32_F32_LEVEL;
|
|
|
|
break;
|
|
|
|
case NVPTXISD::Tex3DU32FloatGrad:
|
|
|
|
Opc = NVPTX::TEX_3D_U32_F32_GRAD;
|
|
|
|
break;
|
|
|
|
case NVPTXISD::TexCubeFloatFloat:
|
|
|
|
Opc = NVPTX::TEX_CUBE_F32_F32;
|
|
|
|
break;
|
|
|
|
case NVPTXISD::TexCubeFloatFloatLevel:
|
|
|
|
Opc = NVPTX::TEX_CUBE_F32_F32_LEVEL;
|
|
|
|
break;
|
|
|
|
case NVPTXISD::TexCubeS32Float:
|
|
|
|
Opc = NVPTX::TEX_CUBE_S32_F32;
|
|
|
|
break;
|
|
|
|
case NVPTXISD::TexCubeS32FloatLevel:
|
|
|
|
Opc = NVPTX::TEX_CUBE_S32_F32_LEVEL;
|
|
|
|
break;
|
|
|
|
case NVPTXISD::TexCubeU32Float:
|
|
|
|
Opc = NVPTX::TEX_CUBE_U32_F32;
|
|
|
|
break;
|
|
|
|
case NVPTXISD::TexCubeU32FloatLevel:
|
|
|
|
Opc = NVPTX::TEX_CUBE_U32_F32_LEVEL;
|
|
|
|
break;
|
|
|
|
case NVPTXISD::TexCubeArrayFloatFloat:
|
|
|
|
Opc = NVPTX::TEX_CUBE_ARRAY_F32_F32;
|
|
|
|
break;
|
|
|
|
case NVPTXISD::TexCubeArrayFloatFloatLevel:
|
|
|
|
Opc = NVPTX::TEX_CUBE_ARRAY_F32_F32_LEVEL;
|
|
|
|
break;
|
|
|
|
case NVPTXISD::TexCubeArrayS32Float:
|
|
|
|
Opc = NVPTX::TEX_CUBE_ARRAY_S32_F32;
|
|
|
|
break;
|
|
|
|
case NVPTXISD::TexCubeArrayS32FloatLevel:
|
|
|
|
Opc = NVPTX::TEX_CUBE_ARRAY_S32_F32_LEVEL;
|
|
|
|
break;
|
|
|
|
case NVPTXISD::TexCubeArrayU32Float:
|
|
|
|
Opc = NVPTX::TEX_CUBE_ARRAY_U32_F32;
|
|
|
|
break;
|
|
|
|
case NVPTXISD::TexCubeArrayU32FloatLevel:
|
|
|
|
Opc = NVPTX::TEX_CUBE_ARRAY_U32_F32_LEVEL;
|
|
|
|
break;
|
|
|
|
case NVPTXISD::Tld4R2DFloatFloat:
|
|
|
|
Opc = NVPTX::TLD4_R_2D_F32_F32;
|
|
|
|
break;
|
|
|
|
case NVPTXISD::Tld4G2DFloatFloat:
|
|
|
|
Opc = NVPTX::TLD4_G_2D_F32_F32;
|
|
|
|
break;
|
|
|
|
case NVPTXISD::Tld4B2DFloatFloat:
|
|
|
|
Opc = NVPTX::TLD4_B_2D_F32_F32;
|
|
|
|
break;
|
|
|
|
case NVPTXISD::Tld4A2DFloatFloat:
|
|
|
|
Opc = NVPTX::TLD4_A_2D_F32_F32;
|
|
|
|
break;
|
|
|
|
case NVPTXISD::Tld4R2DS64Float:
|
|
|
|
Opc = NVPTX::TLD4_R_2D_S32_F32;
|
|
|
|
break;
|
|
|
|
case NVPTXISD::Tld4G2DS64Float:
|
|
|
|
Opc = NVPTX::TLD4_G_2D_S32_F32;
|
|
|
|
break;
|
|
|
|
case NVPTXISD::Tld4B2DS64Float:
|
|
|
|
Opc = NVPTX::TLD4_B_2D_S32_F32;
|
|
|
|
break;
|
|
|
|
case NVPTXISD::Tld4A2DS64Float:
|
|
|
|
Opc = NVPTX::TLD4_A_2D_S32_F32;
|
|
|
|
break;
|
|
|
|
case NVPTXISD::Tld4R2DU64Float:
|
|
|
|
Opc = NVPTX::TLD4_R_2D_U32_F32;
|
|
|
|
break;
|
|
|
|
case NVPTXISD::Tld4G2DU64Float:
|
|
|
|
Opc = NVPTX::TLD4_G_2D_U32_F32;
|
|
|
|
break;
|
|
|
|
case NVPTXISD::Tld4B2DU64Float:
|
|
|
|
Opc = NVPTX::TLD4_B_2D_U32_F32;
|
|
|
|
break;
|
|
|
|
case NVPTXISD::Tld4A2DU64Float:
|
|
|
|
Opc = NVPTX::TLD4_A_2D_U32_F32;
|
|
|
|
break;
|
|
|
|
case NVPTXISD::TexUnified1DFloatS32:
|
|
|
|
Opc = NVPTX::TEX_UNIFIED_1D_F32_S32;
|
|
|
|
break;
|
|
|
|
case NVPTXISD::TexUnified1DFloatFloat:
|
|
|
|
Opc = NVPTX::TEX_UNIFIED_1D_F32_F32;
|
|
|
|
break;
|
|
|
|
case NVPTXISD::TexUnified1DFloatFloatLevel:
|
|
|
|
Opc = NVPTX::TEX_UNIFIED_1D_F32_F32_LEVEL;
|
|
|
|
break;
|
|
|
|
case NVPTXISD::TexUnified1DFloatFloatGrad:
|
|
|
|
Opc = NVPTX::TEX_UNIFIED_1D_F32_F32_GRAD;
|
|
|
|
break;
|
|
|
|
case NVPTXISD::TexUnified1DS32S32:
|
|
|
|
Opc = NVPTX::TEX_UNIFIED_1D_S32_S32;
|
|
|
|
break;
|
|
|
|
case NVPTXISD::TexUnified1DS32Float:
|
|
|
|
Opc = NVPTX::TEX_UNIFIED_1D_S32_F32;
|
|
|
|
break;
|
|
|
|
case NVPTXISD::TexUnified1DS32FloatLevel:
|
|
|
|
Opc = NVPTX::TEX_UNIFIED_1D_S32_F32_LEVEL;
|
|
|
|
break;
|
|
|
|
case NVPTXISD::TexUnified1DS32FloatGrad:
|
|
|
|
Opc = NVPTX::TEX_UNIFIED_1D_S32_F32_GRAD;
|
|
|
|
break;
|
|
|
|
case NVPTXISD::TexUnified1DU32S32:
|
|
|
|
Opc = NVPTX::TEX_UNIFIED_1D_U32_S32;
|
|
|
|
break;
|
|
|
|
case NVPTXISD::TexUnified1DU32Float:
|
|
|
|
Opc = NVPTX::TEX_UNIFIED_1D_U32_F32;
|
|
|
|
break;
|
|
|
|
case NVPTXISD::TexUnified1DU32FloatLevel:
|
|
|
|
Opc = NVPTX::TEX_UNIFIED_1D_U32_F32_LEVEL;
|
|
|
|
break;
|
|
|
|
case NVPTXISD::TexUnified1DU32FloatGrad:
|
|
|
|
Opc = NVPTX::TEX_UNIFIED_1D_U32_F32_GRAD;
|
|
|
|
break;
|
|
|
|
case NVPTXISD::TexUnified1DArrayFloatS32:
|
|
|
|
Opc = NVPTX::TEX_UNIFIED_1D_ARRAY_F32_S32;
|
|
|
|
break;
|
|
|
|
case NVPTXISD::TexUnified1DArrayFloatFloat:
|
|
|
|
Opc = NVPTX::TEX_UNIFIED_1D_ARRAY_F32_F32;
|
|
|
|
break;
|
|
|
|
case NVPTXISD::TexUnified1DArrayFloatFloatLevel:
|
|
|
|
Opc = NVPTX::TEX_UNIFIED_1D_ARRAY_F32_F32_LEVEL;
|
|
|
|
break;
|
|
|
|
case NVPTXISD::TexUnified1DArrayFloatFloatGrad:
|
|
|
|
Opc = NVPTX::TEX_UNIFIED_1D_ARRAY_F32_F32_GRAD;
|
|
|
|
break;
|
|
|
|
case NVPTXISD::TexUnified1DArrayS32S32:
|
|
|
|
Opc = NVPTX::TEX_UNIFIED_1D_ARRAY_S32_S32;
|
|
|
|
break;
|
|
|
|
case NVPTXISD::TexUnified1DArrayS32Float:
|
|
|
|
Opc = NVPTX::TEX_UNIFIED_1D_ARRAY_S32_F32;
|
|
|
|
break;
|
|
|
|
case NVPTXISD::TexUnified1DArrayS32FloatLevel:
|
|
|
|
Opc = NVPTX::TEX_UNIFIED_1D_ARRAY_S32_F32_LEVEL;
|
|
|
|
break;
|
|
|
|
case NVPTXISD::TexUnified1DArrayS32FloatGrad:
|
|
|
|
Opc = NVPTX::TEX_UNIFIED_1D_ARRAY_S32_F32_GRAD;
|
|
|
|
break;
|
|
|
|
case NVPTXISD::TexUnified1DArrayU32S32:
|
|
|
|
Opc = NVPTX::TEX_UNIFIED_1D_ARRAY_U32_S32;
|
|
|
|
break;
|
|
|
|
case NVPTXISD::TexUnified1DArrayU32Float:
|
|
|
|
Opc = NVPTX::TEX_UNIFIED_1D_ARRAY_U32_F32;
|
|
|
|
break;
|
|
|
|
case NVPTXISD::TexUnified1DArrayU32FloatLevel:
|
|
|
|
Opc = NVPTX::TEX_UNIFIED_1D_ARRAY_U32_F32_LEVEL;
|
|
|
|
break;
|
|
|
|
case NVPTXISD::TexUnified1DArrayU32FloatGrad:
|
|
|
|
Opc = NVPTX::TEX_UNIFIED_1D_ARRAY_U32_F32_GRAD;
|
|
|
|
break;
|
|
|
|
case NVPTXISD::TexUnified2DFloatS32:
|
|
|
|
Opc = NVPTX::TEX_UNIFIED_2D_F32_S32;
|
|
|
|
break;
|
|
|
|
case NVPTXISD::TexUnified2DFloatFloat:
|
|
|
|
Opc = NVPTX::TEX_UNIFIED_2D_F32_F32;
|
|
|
|
break;
|
|
|
|
case NVPTXISD::TexUnified2DFloatFloatLevel:
|
|
|
|
Opc = NVPTX::TEX_UNIFIED_2D_F32_F32_LEVEL;
|
|
|
|
break;
|
|
|
|
case NVPTXISD::TexUnified2DFloatFloatGrad:
|
|
|
|
Opc = NVPTX::TEX_UNIFIED_2D_F32_F32_GRAD;
|
|
|
|
break;
|
|
|
|
case NVPTXISD::TexUnified2DS32S32:
|
|
|
|
Opc = NVPTX::TEX_UNIFIED_2D_S32_S32;
|
|
|
|
break;
|
|
|
|
case NVPTXISD::TexUnified2DS32Float:
|
|
|
|
Opc = NVPTX::TEX_UNIFIED_2D_S32_F32;
|
|
|
|
break;
|
|
|
|
case NVPTXISD::TexUnified2DS32FloatLevel:
|
|
|
|
Opc = NVPTX::TEX_UNIFIED_2D_S32_F32_LEVEL;
|
|
|
|
break;
|
|
|
|
case NVPTXISD::TexUnified2DS32FloatGrad:
|
|
|
|
Opc = NVPTX::TEX_UNIFIED_2D_S32_F32_GRAD;
|
|
|
|
break;
|
|
|
|
case NVPTXISD::TexUnified2DU32S32:
|
|
|
|
Opc = NVPTX::TEX_UNIFIED_2D_U32_S32;
|
|
|
|
break;
|
|
|
|
case NVPTXISD::TexUnified2DU32Float:
|
|
|
|
Opc = NVPTX::TEX_UNIFIED_2D_U32_F32;
|
|
|
|
break;
|
|
|
|
case NVPTXISD::TexUnified2DU32FloatLevel:
|
|
|
|
Opc = NVPTX::TEX_UNIFIED_2D_U32_F32_LEVEL;
|
|
|
|
break;
|
|
|
|
case NVPTXISD::TexUnified2DU32FloatGrad:
|
|
|
|
Opc = NVPTX::TEX_UNIFIED_2D_U32_F32_GRAD;
|
|
|
|
break;
|
|
|
|
case NVPTXISD::TexUnified2DArrayFloatS32:
|
|
|
|
Opc = NVPTX::TEX_UNIFIED_2D_ARRAY_F32_S32;
|
|
|
|
break;
|
|
|
|
case NVPTXISD::TexUnified2DArrayFloatFloat:
|
|
|
|
Opc = NVPTX::TEX_UNIFIED_2D_ARRAY_F32_F32;
|
|
|
|
break;
|
|
|
|
case NVPTXISD::TexUnified2DArrayFloatFloatLevel:
|
|
|
|
Opc = NVPTX::TEX_UNIFIED_2D_ARRAY_F32_F32_LEVEL;
|
|
|
|
break;
|
|
|
|
case NVPTXISD::TexUnified2DArrayFloatFloatGrad:
|
|
|
|
Opc = NVPTX::TEX_UNIFIED_2D_ARRAY_F32_F32_GRAD;
|
|
|
|
break;
|
|
|
|
case NVPTXISD::TexUnified2DArrayS32S32:
|
|
|
|
Opc = NVPTX::TEX_UNIFIED_2D_ARRAY_S32_S32;
|
|
|
|
break;
|
|
|
|
case NVPTXISD::TexUnified2DArrayS32Float:
|
|
|
|
Opc = NVPTX::TEX_UNIFIED_2D_ARRAY_S32_F32;
|
|
|
|
break;
|
|
|
|
case NVPTXISD::TexUnified2DArrayS32FloatLevel:
|
|
|
|
Opc = NVPTX::TEX_UNIFIED_2D_ARRAY_S32_F32_LEVEL;
|
|
|
|
break;
|
|
|
|
case NVPTXISD::TexUnified2DArrayS32FloatGrad:
|
|
|
|
Opc = NVPTX::TEX_UNIFIED_2D_ARRAY_S32_F32_GRAD;
|
|
|
|
break;
|
|
|
|
case NVPTXISD::TexUnified2DArrayU32S32:
|
|
|
|
Opc = NVPTX::TEX_UNIFIED_2D_ARRAY_U32_S32;
|
|
|
|
break;
|
|
|
|
case NVPTXISD::TexUnified2DArrayU32Float:
|
|
|
|
Opc = NVPTX::TEX_UNIFIED_2D_ARRAY_U32_F32;
|
|
|
|
break;
|
|
|
|
case NVPTXISD::TexUnified2DArrayU32FloatLevel:
|
|
|
|
Opc = NVPTX::TEX_UNIFIED_2D_ARRAY_U32_F32_LEVEL;
|
|
|
|
break;
|
|
|
|
case NVPTXISD::TexUnified2DArrayU32FloatGrad:
|
|
|
|
Opc = NVPTX::TEX_UNIFIED_2D_ARRAY_U32_F32_GRAD;
|
|
|
|
break;
|
|
|
|
case NVPTXISD::TexUnified3DFloatS32:
|
|
|
|
Opc = NVPTX::TEX_UNIFIED_3D_F32_S32;
|
|
|
|
break;
|
|
|
|
case NVPTXISD::TexUnified3DFloatFloat:
|
|
|
|
Opc = NVPTX::TEX_UNIFIED_3D_F32_F32;
|
|
|
|
break;
|
|
|
|
case NVPTXISD::TexUnified3DFloatFloatLevel:
|
|
|
|
Opc = NVPTX::TEX_UNIFIED_3D_F32_F32_LEVEL;
|
|
|
|
break;
|
|
|
|
case NVPTXISD::TexUnified3DFloatFloatGrad:
|
|
|
|
Opc = NVPTX::TEX_UNIFIED_3D_F32_F32_GRAD;
|
|
|
|
break;
|
|
|
|
case NVPTXISD::TexUnified3DS32S32:
|
|
|
|
Opc = NVPTX::TEX_UNIFIED_3D_S32_S32;
|
|
|
|
break;
|
|
|
|
case NVPTXISD::TexUnified3DS32Float:
|
|
|
|
Opc = NVPTX::TEX_UNIFIED_3D_S32_F32;
|
|
|
|
break;
|
|
|
|
case NVPTXISD::TexUnified3DS32FloatLevel:
|
|
|
|
Opc = NVPTX::TEX_UNIFIED_3D_S32_F32_LEVEL;
|
|
|
|
break;
|
|
|
|
case NVPTXISD::TexUnified3DS32FloatGrad:
|
|
|
|
Opc = NVPTX::TEX_UNIFIED_3D_S32_F32_GRAD;
|
|
|
|
break;
|
|
|
|
case NVPTXISD::TexUnified3DU32S32:
|
|
|
|
Opc = NVPTX::TEX_UNIFIED_3D_U32_S32;
|
|
|
|
break;
|
|
|
|
case NVPTXISD::TexUnified3DU32Float:
|
|
|
|
Opc = NVPTX::TEX_UNIFIED_3D_U32_F32;
|
|
|
|
break;
|
|
|
|
case NVPTXISD::TexUnified3DU32FloatLevel:
|
|
|
|
Opc = NVPTX::TEX_UNIFIED_3D_U32_F32_LEVEL;
|
|
|
|
break;
|
|
|
|
case NVPTXISD::TexUnified3DU32FloatGrad:
|
|
|
|
Opc = NVPTX::TEX_UNIFIED_3D_U32_F32_GRAD;
|
|
|
|
break;
|
|
|
|
case NVPTXISD::TexUnifiedCubeFloatFloat:
|
|
|
|
Opc = NVPTX::TEX_UNIFIED_CUBE_F32_F32;
|
|
|
|
break;
|
|
|
|
case NVPTXISD::TexUnifiedCubeFloatFloatLevel:
|
|
|
|
Opc = NVPTX::TEX_UNIFIED_CUBE_F32_F32_LEVEL;
|
|
|
|
break;
|
|
|
|
case NVPTXISD::TexUnifiedCubeS32Float:
|
|
|
|
Opc = NVPTX::TEX_UNIFIED_CUBE_S32_F32;
|
|
|
|
break;
|
|
|
|
case NVPTXISD::TexUnifiedCubeS32FloatLevel:
|
|
|
|
Opc = NVPTX::TEX_UNIFIED_CUBE_S32_F32_LEVEL;
|
|
|
|
break;
|
|
|
|
case NVPTXISD::TexUnifiedCubeU32Float:
|
|
|
|
Opc = NVPTX::TEX_UNIFIED_CUBE_U32_F32;
|
|
|
|
break;
|
|
|
|
case NVPTXISD::TexUnifiedCubeU32FloatLevel:
|
|
|
|
Opc = NVPTX::TEX_UNIFIED_CUBE_U32_F32_LEVEL;
|
|
|
|
break;
|
|
|
|
case NVPTXISD::TexUnifiedCubeArrayFloatFloat:
|
|
|
|
Opc = NVPTX::TEX_UNIFIED_CUBE_ARRAY_F32_F32;
|
|
|
|
break;
|
|
|
|
case NVPTXISD::TexUnifiedCubeArrayFloatFloatLevel:
|
|
|
|
Opc = NVPTX::TEX_UNIFIED_CUBE_ARRAY_F32_F32_LEVEL;
|
|
|
|
break;
|
|
|
|
case NVPTXISD::TexUnifiedCubeArrayS32Float:
|
|
|
|
Opc = NVPTX::TEX_UNIFIED_CUBE_ARRAY_S32_F32;
|
|
|
|
break;
|
|
|
|
case NVPTXISD::TexUnifiedCubeArrayS32FloatLevel:
|
|
|
|
Opc = NVPTX::TEX_UNIFIED_CUBE_ARRAY_S32_F32_LEVEL;
|
|
|
|
break;
|
|
|
|
case NVPTXISD::TexUnifiedCubeArrayU32Float:
|
|
|
|
Opc = NVPTX::TEX_UNIFIED_CUBE_ARRAY_U32_F32;
|
|
|
|
break;
|
|
|
|
case NVPTXISD::TexUnifiedCubeArrayU32FloatLevel:
|
|
|
|
Opc = NVPTX::TEX_UNIFIED_CUBE_ARRAY_U32_F32_LEVEL;
|
|
|
|
break;
|
|
|
|
case NVPTXISD::Tld4UnifiedR2DFloatFloat:
|
|
|
|
Opc = NVPTX::TLD4_UNIFIED_R_2D_F32_F32;
|
|
|
|
break;
|
|
|
|
case NVPTXISD::Tld4UnifiedG2DFloatFloat:
|
|
|
|
Opc = NVPTX::TLD4_UNIFIED_G_2D_F32_F32;
|
|
|
|
break;
|
|
|
|
case NVPTXISD::Tld4UnifiedB2DFloatFloat:
|
|
|
|
Opc = NVPTX::TLD4_UNIFIED_B_2D_F32_F32;
|
|
|
|
break;
|
|
|
|
case NVPTXISD::Tld4UnifiedA2DFloatFloat:
|
|
|
|
Opc = NVPTX::TLD4_UNIFIED_A_2D_F32_F32;
|
|
|
|
break;
|
|
|
|
case NVPTXISD::Tld4UnifiedR2DS64Float:
|
|
|
|
Opc = NVPTX::TLD4_UNIFIED_R_2D_S32_F32;
|
|
|
|
break;
|
|
|
|
case NVPTXISD::Tld4UnifiedG2DS64Float:
|
|
|
|
Opc = NVPTX::TLD4_UNIFIED_G_2D_S32_F32;
|
|
|
|
break;
|
|
|
|
case NVPTXISD::Tld4UnifiedB2DS64Float:
|
|
|
|
Opc = NVPTX::TLD4_UNIFIED_B_2D_S32_F32;
|
|
|
|
break;
|
|
|
|
case NVPTXISD::Tld4UnifiedA2DS64Float:
|
|
|
|
Opc = NVPTX::TLD4_UNIFIED_A_2D_S32_F32;
|
|
|
|
break;
|
|
|
|
case NVPTXISD::Tld4UnifiedR2DU64Float:
|
|
|
|
Opc = NVPTX::TLD4_UNIFIED_R_2D_U32_F32;
|
2014-04-09 23:39:15 +08:00
|
|
|
break;
|
2014-07-17 19:59:04 +08:00
|
|
|
case NVPTXISD::Tld4UnifiedG2DU64Float:
|
|
|
|
Opc = NVPTX::TLD4_UNIFIED_G_2D_U32_F32;
|
2014-04-09 23:39:15 +08:00
|
|
|
break;
|
2014-07-17 19:59:04 +08:00
|
|
|
case NVPTXISD::Tld4UnifiedB2DU64Float:
|
|
|
|
Opc = NVPTX::TLD4_UNIFIED_B_2D_U32_F32;
|
2014-04-09 23:39:15 +08:00
|
|
|
break;
|
2014-07-17 19:59:04 +08:00
|
|
|
case NVPTXISD::Tld4UnifiedA2DU64Float:
|
|
|
|
Opc = NVPTX::TLD4_UNIFIED_A_2D_U32_F32;
|
2014-04-09 23:39:15 +08:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2014-07-17 19:59:04 +08:00
|
|
|
// Copy over operands
|
|
|
|
for (unsigned i = 1; i < N->getNumOperands(); ++i) {
|
2014-04-09 23:39:15 +08:00
|
|
|
Ops.push_back(N->getOperand(i));
|
|
|
|
}
|
|
|
|
|
|
|
|
Ops.push_back(Chain);
|
2016-05-14 05:12:53 +08:00
|
|
|
ReplaceNode(N, CurDAG->getMachineNode(Opc, SDLoc(N), N->getVTList(), Ops));
|
|
|
|
return true;
|
2014-04-09 23:39:15 +08:00
|
|
|
}
|
|
|
|
|
2016-05-14 05:12:53 +08:00
|
|
|
bool NVPTXDAGToDAGISel::trySurfaceIntrinsic(SDNode *N) {
|
2014-04-09 23:39:15 +08:00
|
|
|
SDValue Chain = N->getOperand(0);
|
|
|
|
SDValue TexHandle = N->getOperand(1);
|
|
|
|
unsigned Opc = 0;
|
|
|
|
SmallVector<SDValue, 8> Ops;
|
|
|
|
switch (N->getOpcode()) {
|
2016-05-14 05:12:53 +08:00
|
|
|
default: return false;
|
2014-07-17 19:59:04 +08:00
|
|
|
case NVPTXISD::Suld1DI8Clamp:
|
|
|
|
Opc = NVPTX::SULD_1D_I8_CLAMP;
|
2014-04-09 23:39:15 +08:00
|
|
|
Ops.push_back(TexHandle);
|
|
|
|
Ops.push_back(N->getOperand(2));
|
|
|
|
Ops.push_back(Chain);
|
|
|
|
break;
|
2014-07-17 19:59:04 +08:00
|
|
|
case NVPTXISD::Suld1DI16Clamp:
|
|
|
|
Opc = NVPTX::SULD_1D_I16_CLAMP;
|
2014-04-09 23:39:15 +08:00
|
|
|
Ops.push_back(TexHandle);
|
|
|
|
Ops.push_back(N->getOperand(2));
|
|
|
|
Ops.push_back(Chain);
|
|
|
|
break;
|
2014-07-17 19:59:04 +08:00
|
|
|
case NVPTXISD::Suld1DI32Clamp:
|
|
|
|
Opc = NVPTX::SULD_1D_I32_CLAMP;
|
2014-04-09 23:39:15 +08:00
|
|
|
Ops.push_back(TexHandle);
|
|
|
|
Ops.push_back(N->getOperand(2));
|
|
|
|
Ops.push_back(Chain);
|
|
|
|
break;
|
2014-07-17 19:59:04 +08:00
|
|
|
case NVPTXISD::Suld1DI64Clamp:
|
|
|
|
Opc = NVPTX::SULD_1D_I64_CLAMP;
|
2014-04-09 23:39:15 +08:00
|
|
|
Ops.push_back(TexHandle);
|
|
|
|
Ops.push_back(N->getOperand(2));
|
|
|
|
Ops.push_back(Chain);
|
|
|
|
break;
|
2014-07-17 19:59:04 +08:00
|
|
|
case NVPTXISD::Suld1DV2I8Clamp:
|
|
|
|
Opc = NVPTX::SULD_1D_V2I8_CLAMP;
|
2014-04-09 23:39:15 +08:00
|
|
|
Ops.push_back(TexHandle);
|
|
|
|
Ops.push_back(N->getOperand(2));
|
|
|
|
Ops.push_back(Chain);
|
|
|
|
break;
|
2014-07-17 19:59:04 +08:00
|
|
|
case NVPTXISD::Suld1DV2I16Clamp:
|
|
|
|
Opc = NVPTX::SULD_1D_V2I16_CLAMP;
|
2014-04-09 23:39:15 +08:00
|
|
|
Ops.push_back(TexHandle);
|
|
|
|
Ops.push_back(N->getOperand(2));
|
|
|
|
Ops.push_back(Chain);
|
|
|
|
break;
|
2014-07-17 19:59:04 +08:00
|
|
|
case NVPTXISD::Suld1DV2I32Clamp:
|
|
|
|
Opc = NVPTX::SULD_1D_V2I32_CLAMP;
|
2014-04-09 23:39:15 +08:00
|
|
|
Ops.push_back(TexHandle);
|
|
|
|
Ops.push_back(N->getOperand(2));
|
|
|
|
Ops.push_back(Chain);
|
|
|
|
break;
|
2014-07-17 19:59:04 +08:00
|
|
|
case NVPTXISD::Suld1DV2I64Clamp:
|
|
|
|
Opc = NVPTX::SULD_1D_V2I64_CLAMP;
|
2014-04-09 23:39:15 +08:00
|
|
|
Ops.push_back(TexHandle);
|
|
|
|
Ops.push_back(N->getOperand(2));
|
|
|
|
Ops.push_back(Chain);
|
|
|
|
break;
|
2014-07-17 19:59:04 +08:00
|
|
|
case NVPTXISD::Suld1DV4I8Clamp:
|
|
|
|
Opc = NVPTX::SULD_1D_V4I8_CLAMP;
|
2014-04-09 23:39:15 +08:00
|
|
|
Ops.push_back(TexHandle);
|
|
|
|
Ops.push_back(N->getOperand(2));
|
|
|
|
Ops.push_back(Chain);
|
|
|
|
break;
|
2014-07-17 19:59:04 +08:00
|
|
|
case NVPTXISD::Suld1DV4I16Clamp:
|
|
|
|
Opc = NVPTX::SULD_1D_V4I16_CLAMP;
|
|
|
|
Ops.push_back(TexHandle);
|
|
|
|
Ops.push_back(N->getOperand(2));
|
|
|
|
Ops.push_back(Chain);
|
|
|
|
break;
|
|
|
|
case NVPTXISD::Suld1DV4I32Clamp:
|
|
|
|
Opc = NVPTX::SULD_1D_V4I32_CLAMP;
|
|
|
|
Ops.push_back(TexHandle);
|
|
|
|
Ops.push_back(N->getOperand(2));
|
|
|
|
Ops.push_back(Chain);
|
|
|
|
break;
|
|
|
|
case NVPTXISD::Suld1DArrayI8Clamp:
|
|
|
|
Opc = NVPTX::SULD_1D_ARRAY_I8_CLAMP;
|
2014-04-09 23:39:15 +08:00
|
|
|
Ops.push_back(TexHandle);
|
|
|
|
Ops.push_back(N->getOperand(2));
|
|
|
|
Ops.push_back(N->getOperand(3));
|
|
|
|
Ops.push_back(Chain);
|
|
|
|
break;
|
2014-07-17 19:59:04 +08:00
|
|
|
case NVPTXISD::Suld1DArrayI16Clamp:
|
|
|
|
Opc = NVPTX::SULD_1D_ARRAY_I16_CLAMP;
|
2014-04-09 23:39:15 +08:00
|
|
|
Ops.push_back(TexHandle);
|
|
|
|
Ops.push_back(N->getOperand(2));
|
|
|
|
Ops.push_back(N->getOperand(3));
|
|
|
|
Ops.push_back(Chain);
|
|
|
|
break;
|
2014-07-17 19:59:04 +08:00
|
|
|
case NVPTXISD::Suld1DArrayI32Clamp:
|
|
|
|
Opc = NVPTX::SULD_1D_ARRAY_I32_CLAMP;
|
2014-04-09 23:39:15 +08:00
|
|
|
Ops.push_back(TexHandle);
|
|
|
|
Ops.push_back(N->getOperand(2));
|
|
|
|
Ops.push_back(N->getOperand(3));
|
|
|
|
Ops.push_back(Chain);
|
|
|
|
break;
|
2014-07-17 19:59:04 +08:00
|
|
|
case NVPTXISD::Suld1DArrayI64Clamp:
|
|
|
|
Opc = NVPTX::SULD_1D_ARRAY_I64_CLAMP;
|
2014-04-09 23:39:15 +08:00
|
|
|
Ops.push_back(TexHandle);
|
|
|
|
Ops.push_back(N->getOperand(2));
|
|
|
|
Ops.push_back(N->getOperand(3));
|
|
|
|
Ops.push_back(Chain);
|
|
|
|
break;
|
2014-07-17 19:59:04 +08:00
|
|
|
case NVPTXISD::Suld1DArrayV2I8Clamp:
|
|
|
|
Opc = NVPTX::SULD_1D_ARRAY_V2I8_CLAMP;
|
2014-04-09 23:39:15 +08:00
|
|
|
Ops.push_back(TexHandle);
|
|
|
|
Ops.push_back(N->getOperand(2));
|
|
|
|
Ops.push_back(N->getOperand(3));
|
|
|
|
Ops.push_back(Chain);
|
|
|
|
break;
|
2014-07-17 19:59:04 +08:00
|
|
|
case NVPTXISD::Suld1DArrayV2I16Clamp:
|
|
|
|
Opc = NVPTX::SULD_1D_ARRAY_V2I16_CLAMP;
|
2014-04-09 23:39:15 +08:00
|
|
|
Ops.push_back(TexHandle);
|
|
|
|
Ops.push_back(N->getOperand(2));
|
|
|
|
Ops.push_back(N->getOperand(3));
|
|
|
|
Ops.push_back(Chain);
|
|
|
|
break;
|
2014-07-17 19:59:04 +08:00
|
|
|
case NVPTXISD::Suld1DArrayV2I32Clamp:
|
|
|
|
Opc = NVPTX::SULD_1D_ARRAY_V2I32_CLAMP;
|
2014-04-09 23:39:15 +08:00
|
|
|
Ops.push_back(TexHandle);
|
|
|
|
Ops.push_back(N->getOperand(2));
|
|
|
|
Ops.push_back(N->getOperand(3));
|
|
|
|
Ops.push_back(Chain);
|
|
|
|
break;
|
2014-07-17 19:59:04 +08:00
|
|
|
case NVPTXISD::Suld1DArrayV2I64Clamp:
|
|
|
|
Opc = NVPTX::SULD_1D_ARRAY_V2I64_CLAMP;
|
2014-04-09 23:39:15 +08:00
|
|
|
Ops.push_back(TexHandle);
|
|
|
|
Ops.push_back(N->getOperand(2));
|
|
|
|
Ops.push_back(N->getOperand(3));
|
|
|
|
Ops.push_back(Chain);
|
|
|
|
break;
|
2014-07-17 19:59:04 +08:00
|
|
|
case NVPTXISD::Suld1DArrayV4I8Clamp:
|
|
|
|
Opc = NVPTX::SULD_1D_ARRAY_V4I8_CLAMP;
|
2014-04-09 23:39:15 +08:00
|
|
|
Ops.push_back(TexHandle);
|
|
|
|
Ops.push_back(N->getOperand(2));
|
|
|
|
Ops.push_back(N->getOperand(3));
|
|
|
|
Ops.push_back(Chain);
|
|
|
|
break;
|
2014-07-17 19:59:04 +08:00
|
|
|
case NVPTXISD::Suld1DArrayV4I16Clamp:
|
|
|
|
Opc = NVPTX::SULD_1D_ARRAY_V4I16_CLAMP;
|
2014-04-09 23:39:15 +08:00
|
|
|
Ops.push_back(TexHandle);
|
|
|
|
Ops.push_back(N->getOperand(2));
|
|
|
|
Ops.push_back(N->getOperand(3));
|
|
|
|
Ops.push_back(Chain);
|
|
|
|
break;
|
2014-07-17 19:59:04 +08:00
|
|
|
case NVPTXISD::Suld1DArrayV4I32Clamp:
|
|
|
|
Opc = NVPTX::SULD_1D_ARRAY_V4I32_CLAMP;
|
2014-04-09 23:39:15 +08:00
|
|
|
Ops.push_back(TexHandle);
|
|
|
|
Ops.push_back(N->getOperand(2));
|
|
|
|
Ops.push_back(N->getOperand(3));
|
|
|
|
Ops.push_back(Chain);
|
|
|
|
break;
|
2014-07-17 19:59:04 +08:00
|
|
|
case NVPTXISD::Suld2DI8Clamp:
|
|
|
|
Opc = NVPTX::SULD_2D_I8_CLAMP;
|
2014-04-09 23:39:15 +08:00
|
|
|
Ops.push_back(TexHandle);
|
|
|
|
Ops.push_back(N->getOperand(2));
|
|
|
|
Ops.push_back(N->getOperand(3));
|
|
|
|
Ops.push_back(Chain);
|
|
|
|
break;
|
2014-07-17 19:59:04 +08:00
|
|
|
case NVPTXISD::Suld2DI16Clamp:
|
|
|
|
Opc = NVPTX::SULD_2D_I16_CLAMP;
|
2014-04-09 23:39:15 +08:00
|
|
|
Ops.push_back(TexHandle);
|
|
|
|
Ops.push_back(N->getOperand(2));
|
|
|
|
Ops.push_back(N->getOperand(3));
|
|
|
|
Ops.push_back(Chain);
|
|
|
|
break;
|
2014-07-17 19:59:04 +08:00
|
|
|
case NVPTXISD::Suld2DI32Clamp:
|
|
|
|
Opc = NVPTX::SULD_2D_I32_CLAMP;
|
2014-04-09 23:39:15 +08:00
|
|
|
Ops.push_back(TexHandle);
|
|
|
|
Ops.push_back(N->getOperand(2));
|
|
|
|
Ops.push_back(N->getOperand(3));
|
|
|
|
Ops.push_back(Chain);
|
|
|
|
break;
|
2014-07-17 19:59:04 +08:00
|
|
|
case NVPTXISD::Suld2DI64Clamp:
|
|
|
|
Opc = NVPTX::SULD_2D_I64_CLAMP;
|
2014-04-09 23:39:15 +08:00
|
|
|
Ops.push_back(TexHandle);
|
|
|
|
Ops.push_back(N->getOperand(2));
|
|
|
|
Ops.push_back(N->getOperand(3));
|
|
|
|
Ops.push_back(Chain);
|
|
|
|
break;
|
2014-07-17 19:59:04 +08:00
|
|
|
case NVPTXISD::Suld2DV2I8Clamp:
|
|
|
|
Opc = NVPTX::SULD_2D_V2I8_CLAMP;
|
2014-04-09 23:39:15 +08:00
|
|
|
Ops.push_back(TexHandle);
|
|
|
|
Ops.push_back(N->getOperand(2));
|
|
|
|
Ops.push_back(N->getOperand(3));
|
|
|
|
Ops.push_back(Chain);
|
|
|
|
break;
|
2014-07-17 19:59:04 +08:00
|
|
|
case NVPTXISD::Suld2DV2I16Clamp:
|
|
|
|
Opc = NVPTX::SULD_2D_V2I16_CLAMP;
|
2014-04-09 23:39:15 +08:00
|
|
|
Ops.push_back(TexHandle);
|
|
|
|
Ops.push_back(N->getOperand(2));
|
|
|
|
Ops.push_back(N->getOperand(3));
|
|
|
|
Ops.push_back(Chain);
|
|
|
|
break;
|
2014-07-17 19:59:04 +08:00
|
|
|
case NVPTXISD::Suld2DV2I32Clamp:
|
|
|
|
Opc = NVPTX::SULD_2D_V2I32_CLAMP;
|
2014-04-09 23:39:15 +08:00
|
|
|
Ops.push_back(TexHandle);
|
|
|
|
Ops.push_back(N->getOperand(2));
|
|
|
|
Ops.push_back(N->getOperand(3));
|
|
|
|
Ops.push_back(Chain);
|
|
|
|
break;
|
2014-07-17 19:59:04 +08:00
|
|
|
case NVPTXISD::Suld2DV2I64Clamp:
|
|
|
|
Opc = NVPTX::SULD_2D_V2I64_CLAMP;
|
|
|
|
Ops.push_back(TexHandle);
|
|
|
|
Ops.push_back(N->getOperand(2));
|
|
|
|
Ops.push_back(N->getOperand(3));
|
|
|
|
Ops.push_back(Chain);
|
|
|
|
break;
|
|
|
|
case NVPTXISD::Suld2DV4I8Clamp:
|
|
|
|
Opc = NVPTX::SULD_2D_V4I8_CLAMP;
|
|
|
|
Ops.push_back(TexHandle);
|
|
|
|
Ops.push_back(N->getOperand(2));
|
|
|
|
Ops.push_back(N->getOperand(3));
|
|
|
|
Ops.push_back(Chain);
|
|
|
|
break;
|
|
|
|
case NVPTXISD::Suld2DV4I16Clamp:
|
|
|
|
Opc = NVPTX::SULD_2D_V4I16_CLAMP;
|
|
|
|
Ops.push_back(TexHandle);
|
|
|
|
Ops.push_back(N->getOperand(2));
|
|
|
|
Ops.push_back(N->getOperand(3));
|
|
|
|
Ops.push_back(Chain);
|
|
|
|
break;
|
|
|
|
case NVPTXISD::Suld2DV4I32Clamp:
|
|
|
|
Opc = NVPTX::SULD_2D_V4I32_CLAMP;
|
|
|
|
Ops.push_back(TexHandle);
|
|
|
|
Ops.push_back(N->getOperand(2));
|
|
|
|
Ops.push_back(N->getOperand(3));
|
|
|
|
Ops.push_back(Chain);
|
|
|
|
break;
|
|
|
|
case NVPTXISD::Suld2DArrayI8Clamp:
|
|
|
|
Opc = NVPTX::SULD_2D_ARRAY_I8_CLAMP;
|
2014-04-09 23:39:15 +08:00
|
|
|
Ops.push_back(TexHandle);
|
|
|
|
Ops.push_back(N->getOperand(2));
|
|
|
|
Ops.push_back(N->getOperand(3));
|
|
|
|
Ops.push_back(N->getOperand(4));
|
|
|
|
Ops.push_back(Chain);
|
|
|
|
break;
|
2014-07-17 19:59:04 +08:00
|
|
|
case NVPTXISD::Suld2DArrayI16Clamp:
|
|
|
|
Opc = NVPTX::SULD_2D_ARRAY_I16_CLAMP;
|
2014-04-09 23:39:15 +08:00
|
|
|
Ops.push_back(TexHandle);
|
|
|
|
Ops.push_back(N->getOperand(2));
|
|
|
|
Ops.push_back(N->getOperand(3));
|
|
|
|
Ops.push_back(N->getOperand(4));
|
|
|
|
Ops.push_back(Chain);
|
|
|
|
break;
|
2014-07-17 19:59:04 +08:00
|
|
|
case NVPTXISD::Suld2DArrayI32Clamp:
|
|
|
|
Opc = NVPTX::SULD_2D_ARRAY_I32_CLAMP;
|
2014-04-09 23:39:15 +08:00
|
|
|
Ops.push_back(TexHandle);
|
|
|
|
Ops.push_back(N->getOperand(2));
|
|
|
|
Ops.push_back(N->getOperand(3));
|
|
|
|
Ops.push_back(N->getOperand(4));
|
|
|
|
Ops.push_back(Chain);
|
|
|
|
break;
|
2014-07-17 19:59:04 +08:00
|
|
|
case NVPTXISD::Suld2DArrayI64Clamp:
|
|
|
|
Opc = NVPTX::SULD_2D_ARRAY_I64_CLAMP;
|
2014-04-09 23:39:15 +08:00
|
|
|
Ops.push_back(TexHandle);
|
|
|
|
Ops.push_back(N->getOperand(2));
|
|
|
|
Ops.push_back(N->getOperand(3));
|
|
|
|
Ops.push_back(N->getOperand(4));
|
|
|
|
Ops.push_back(Chain);
|
|
|
|
break;
|
2014-07-17 19:59:04 +08:00
|
|
|
case NVPTXISD::Suld2DArrayV2I8Clamp:
|
|
|
|
Opc = NVPTX::SULD_2D_ARRAY_V2I8_CLAMP;
|
2014-04-09 23:39:15 +08:00
|
|
|
Ops.push_back(TexHandle);
|
|
|
|
Ops.push_back(N->getOperand(2));
|
|
|
|
Ops.push_back(N->getOperand(3));
|
|
|
|
Ops.push_back(N->getOperand(4));
|
|
|
|
Ops.push_back(Chain);
|
|
|
|
break;
|
2014-07-17 19:59:04 +08:00
|
|
|
case NVPTXISD::Suld2DArrayV2I16Clamp:
|
|
|
|
Opc = NVPTX::SULD_2D_ARRAY_V2I16_CLAMP;
|
2014-04-09 23:39:15 +08:00
|
|
|
Ops.push_back(TexHandle);
|
|
|
|
Ops.push_back(N->getOperand(2));
|
|
|
|
Ops.push_back(N->getOperand(3));
|
|
|
|
Ops.push_back(N->getOperand(4));
|
|
|
|
Ops.push_back(Chain);
|
|
|
|
break;
|
2014-07-17 19:59:04 +08:00
|
|
|
case NVPTXISD::Suld2DArrayV2I32Clamp:
|
|
|
|
Opc = NVPTX::SULD_2D_ARRAY_V2I32_CLAMP;
|
2014-04-09 23:39:15 +08:00
|
|
|
Ops.push_back(TexHandle);
|
|
|
|
Ops.push_back(N->getOperand(2));
|
|
|
|
Ops.push_back(N->getOperand(3));
|
|
|
|
Ops.push_back(N->getOperand(4));
|
|
|
|
Ops.push_back(Chain);
|
|
|
|
break;
|
2014-07-17 19:59:04 +08:00
|
|
|
case NVPTXISD::Suld2DArrayV2I64Clamp:
|
|
|
|
Opc = NVPTX::SULD_2D_ARRAY_V2I64_CLAMP;
|
2014-04-09 23:39:15 +08:00
|
|
|
Ops.push_back(TexHandle);
|
|
|
|
Ops.push_back(N->getOperand(2));
|
|
|
|
Ops.push_back(N->getOperand(3));
|
|
|
|
Ops.push_back(N->getOperand(4));
|
|
|
|
Ops.push_back(Chain);
|
|
|
|
break;
|
2014-07-17 19:59:04 +08:00
|
|
|
case NVPTXISD::Suld2DArrayV4I8Clamp:
|
|
|
|
Opc = NVPTX::SULD_2D_ARRAY_V4I8_CLAMP;
|
2014-04-09 23:39:15 +08:00
|
|
|
Ops.push_back(TexHandle);
|
|
|
|
Ops.push_back(N->getOperand(2));
|
|
|
|
Ops.push_back(N->getOperand(3));
|
|
|
|
Ops.push_back(N->getOperand(4));
|
|
|
|
Ops.push_back(Chain);
|
|
|
|
break;
|
2014-07-17 19:59:04 +08:00
|
|
|
case NVPTXISD::Suld2DArrayV4I16Clamp:
|
|
|
|
Opc = NVPTX::SULD_2D_ARRAY_V4I16_CLAMP;
|
2014-04-09 23:39:15 +08:00
|
|
|
Ops.push_back(TexHandle);
|
|
|
|
Ops.push_back(N->getOperand(2));
|
|
|
|
Ops.push_back(N->getOperand(3));
|
|
|
|
Ops.push_back(N->getOperand(4));
|
|
|
|
Ops.push_back(Chain);
|
|
|
|
break;
|
2014-07-17 19:59:04 +08:00
|
|
|
case NVPTXISD::Suld2DArrayV4I32Clamp:
|
|
|
|
Opc = NVPTX::SULD_2D_ARRAY_V4I32_CLAMP;
|
2014-04-09 23:39:15 +08:00
|
|
|
Ops.push_back(TexHandle);
|
|
|
|
Ops.push_back(N->getOperand(2));
|
|
|
|
Ops.push_back(N->getOperand(3));
|
|
|
|
Ops.push_back(N->getOperand(4));
|
|
|
|
Ops.push_back(Chain);
|
|
|
|
break;
|
2014-07-17 19:59:04 +08:00
|
|
|
case NVPTXISD::Suld3DI8Clamp:
|
|
|
|
Opc = NVPTX::SULD_3D_I8_CLAMP;
|
2014-04-09 23:39:15 +08:00
|
|
|
Ops.push_back(TexHandle);
|
|
|
|
Ops.push_back(N->getOperand(2));
|
|
|
|
Ops.push_back(N->getOperand(3));
|
|
|
|
Ops.push_back(N->getOperand(4));
|
|
|
|
Ops.push_back(Chain);
|
|
|
|
break;
|
2014-07-17 19:59:04 +08:00
|
|
|
case NVPTXISD::Suld3DI16Clamp:
|
|
|
|
Opc = NVPTX::SULD_3D_I16_CLAMP;
|
2014-04-09 23:39:15 +08:00
|
|
|
Ops.push_back(TexHandle);
|
|
|
|
Ops.push_back(N->getOperand(2));
|
|
|
|
Ops.push_back(N->getOperand(3));
|
|
|
|
Ops.push_back(N->getOperand(4));
|
|
|
|
Ops.push_back(Chain);
|
|
|
|
break;
|
2014-07-17 19:59:04 +08:00
|
|
|
case NVPTXISD::Suld3DI32Clamp:
|
|
|
|
Opc = NVPTX::SULD_3D_I32_CLAMP;
|
2014-04-09 23:39:15 +08:00
|
|
|
Ops.push_back(TexHandle);
|
|
|
|
Ops.push_back(N->getOperand(2));
|
|
|
|
Ops.push_back(N->getOperand(3));
|
|
|
|
Ops.push_back(N->getOperand(4));
|
|
|
|
Ops.push_back(Chain);
|
|
|
|
break;
|
2014-07-17 19:59:04 +08:00
|
|
|
case NVPTXISD::Suld3DI64Clamp:
|
|
|
|
Opc = NVPTX::SULD_3D_I64_CLAMP;
|
2014-04-09 23:39:15 +08:00
|
|
|
Ops.push_back(TexHandle);
|
|
|
|
Ops.push_back(N->getOperand(2));
|
|
|
|
Ops.push_back(N->getOperand(3));
|
|
|
|
Ops.push_back(N->getOperand(4));
|
|
|
|
Ops.push_back(Chain);
|
|
|
|
break;
|
2014-07-17 19:59:04 +08:00
|
|
|
case NVPTXISD::Suld3DV2I8Clamp:
|
|
|
|
Opc = NVPTX::SULD_3D_V2I8_CLAMP;
|
2014-04-09 23:39:15 +08:00
|
|
|
Ops.push_back(TexHandle);
|
|
|
|
Ops.push_back(N->getOperand(2));
|
|
|
|
Ops.push_back(N->getOperand(3));
|
|
|
|
Ops.push_back(N->getOperand(4));
|
|
|
|
Ops.push_back(Chain);
|
|
|
|
break;
|
2014-07-17 19:59:04 +08:00
|
|
|
case NVPTXISD::Suld3DV2I16Clamp:
|
|
|
|
Opc = NVPTX::SULD_3D_V2I16_CLAMP;
|
2014-04-09 23:39:15 +08:00
|
|
|
Ops.push_back(TexHandle);
|
|
|
|
Ops.push_back(N->getOperand(2));
|
|
|
|
Ops.push_back(N->getOperand(3));
|
|
|
|
Ops.push_back(N->getOperand(4));
|
|
|
|
Ops.push_back(Chain);
|
|
|
|
break;
|
2014-07-17 19:59:04 +08:00
|
|
|
case NVPTXISD::Suld3DV2I32Clamp:
|
|
|
|
Opc = NVPTX::SULD_3D_V2I32_CLAMP;
|
2014-04-09 23:39:15 +08:00
|
|
|
Ops.push_back(TexHandle);
|
|
|
|
Ops.push_back(N->getOperand(2));
|
|
|
|
Ops.push_back(N->getOperand(3));
|
|
|
|
Ops.push_back(N->getOperand(4));
|
|
|
|
Ops.push_back(Chain);
|
|
|
|
break;
|
2014-07-17 19:59:04 +08:00
|
|
|
case NVPTXISD::Suld3DV2I64Clamp:
|
|
|
|
Opc = NVPTX::SULD_3D_V2I64_CLAMP;
|
|
|
|
Ops.push_back(TexHandle);
|
|
|
|
Ops.push_back(N->getOperand(2));
|
|
|
|
Ops.push_back(N->getOperand(3));
|
|
|
|
Ops.push_back(N->getOperand(4));
|
|
|
|
Ops.push_back(Chain);
|
|
|
|
break;
|
|
|
|
case NVPTXISD::Suld3DV4I8Clamp:
|
|
|
|
Opc = NVPTX::SULD_3D_V4I8_CLAMP;
|
|
|
|
Ops.push_back(TexHandle);
|
|
|
|
Ops.push_back(N->getOperand(2));
|
|
|
|
Ops.push_back(N->getOperand(3));
|
|
|
|
Ops.push_back(N->getOperand(4));
|
|
|
|
Ops.push_back(Chain);
|
|
|
|
break;
|
|
|
|
case NVPTXISD::Suld3DV4I16Clamp:
|
|
|
|
Opc = NVPTX::SULD_3D_V4I16_CLAMP;
|
|
|
|
Ops.push_back(TexHandle);
|
|
|
|
Ops.push_back(N->getOperand(2));
|
|
|
|
Ops.push_back(N->getOperand(3));
|
|
|
|
Ops.push_back(N->getOperand(4));
|
|
|
|
Ops.push_back(Chain);
|
|
|
|
break;
|
|
|
|
case NVPTXISD::Suld3DV4I32Clamp:
|
|
|
|
Opc = NVPTX::SULD_3D_V4I32_CLAMP;
|
|
|
|
Ops.push_back(TexHandle);
|
|
|
|
Ops.push_back(N->getOperand(2));
|
|
|
|
Ops.push_back(N->getOperand(3));
|
|
|
|
Ops.push_back(N->getOperand(4));
|
|
|
|
Ops.push_back(Chain);
|
|
|
|
break;
|
|
|
|
case NVPTXISD::Suld1DI8Trap:
|
|
|
|
Opc = NVPTX::SULD_1D_I8_TRAP;
|
|
|
|
Ops.push_back(TexHandle);
|
|
|
|
Ops.push_back(N->getOperand(2));
|
|
|
|
Ops.push_back(Chain);
|
|
|
|
break;
|
|
|
|
case NVPTXISD::Suld1DI16Trap:
|
|
|
|
Opc = NVPTX::SULD_1D_I16_TRAP;
|
|
|
|
Ops.push_back(TexHandle);
|
|
|
|
Ops.push_back(N->getOperand(2));
|
|
|
|
Ops.push_back(Chain);
|
|
|
|
break;
|
|
|
|
case NVPTXISD::Suld1DI32Trap:
|
|
|
|
Opc = NVPTX::SULD_1D_I32_TRAP;
|
|
|
|
Ops.push_back(TexHandle);
|
|
|
|
Ops.push_back(N->getOperand(2));
|
|
|
|
Ops.push_back(Chain);
|
|
|
|
break;
|
|
|
|
case NVPTXISD::Suld1DI64Trap:
|
|
|
|
Opc = NVPTX::SULD_1D_I64_TRAP;
|
|
|
|
Ops.push_back(TexHandle);
|
|
|
|
Ops.push_back(N->getOperand(2));
|
|
|
|
Ops.push_back(Chain);
|
|
|
|
break;
|
|
|
|
case NVPTXISD::Suld1DV2I8Trap:
|
|
|
|
Opc = NVPTX::SULD_1D_V2I8_TRAP;
|
|
|
|
Ops.push_back(TexHandle);
|
|
|
|
Ops.push_back(N->getOperand(2));
|
|
|
|
Ops.push_back(Chain);
|
|
|
|
break;
|
|
|
|
case NVPTXISD::Suld1DV2I16Trap:
|
|
|
|
Opc = NVPTX::SULD_1D_V2I16_TRAP;
|
|
|
|
Ops.push_back(TexHandle);
|
|
|
|
Ops.push_back(N->getOperand(2));
|
|
|
|
Ops.push_back(Chain);
|
|
|
|
break;
|
|
|
|
case NVPTXISD::Suld1DV2I32Trap:
|
|
|
|
Opc = NVPTX::SULD_1D_V2I32_TRAP;
|
|
|
|
Ops.push_back(TexHandle);
|
|
|
|
Ops.push_back(N->getOperand(2));
|
|
|
|
Ops.push_back(Chain);
|
|
|
|
break;
|
|
|
|
case NVPTXISD::Suld1DV2I64Trap:
|
|
|
|
Opc = NVPTX::SULD_1D_V2I64_TRAP;
|
|
|
|
Ops.push_back(TexHandle);
|
|
|
|
Ops.push_back(N->getOperand(2));
|
|
|
|
Ops.push_back(Chain);
|
|
|
|
break;
|
|
|
|
case NVPTXISD::Suld1DV4I8Trap:
|
|
|
|
Opc = NVPTX::SULD_1D_V4I8_TRAP;
|
|
|
|
Ops.push_back(TexHandle);
|
|
|
|
Ops.push_back(N->getOperand(2));
|
|
|
|
Ops.push_back(Chain);
|
|
|
|
break;
|
|
|
|
case NVPTXISD::Suld1DV4I16Trap:
|
|
|
|
Opc = NVPTX::SULD_1D_V4I16_TRAP;
|
|
|
|
Ops.push_back(TexHandle);
|
|
|
|
Ops.push_back(N->getOperand(2));
|
|
|
|
Ops.push_back(Chain);
|
|
|
|
break;
|
|
|
|
case NVPTXISD::Suld1DV4I32Trap:
|
|
|
|
Opc = NVPTX::SULD_1D_V4I32_TRAP;
|
|
|
|
Ops.push_back(TexHandle);
|
|
|
|
Ops.push_back(N->getOperand(2));
|
|
|
|
Ops.push_back(Chain);
|
|
|
|
break;
|
|
|
|
case NVPTXISD::Suld1DArrayI8Trap:
|
|
|
|
Opc = NVPTX::SULD_1D_ARRAY_I8_TRAP;
|
|
|
|
Ops.push_back(TexHandle);
|
|
|
|
Ops.push_back(N->getOperand(2));
|
|
|
|
Ops.push_back(N->getOperand(3));
|
|
|
|
Ops.push_back(Chain);
|
|
|
|
break;
|
|
|
|
case NVPTXISD::Suld1DArrayI16Trap:
|
|
|
|
Opc = NVPTX::SULD_1D_ARRAY_I16_TRAP;
|
|
|
|
Ops.push_back(TexHandle);
|
|
|
|
Ops.push_back(N->getOperand(2));
|
|
|
|
Ops.push_back(N->getOperand(3));
|
|
|
|
Ops.push_back(Chain);
|
|
|
|
break;
|
|
|
|
case NVPTXISD::Suld1DArrayI32Trap:
|
|
|
|
Opc = NVPTX::SULD_1D_ARRAY_I32_TRAP;
|
|
|
|
Ops.push_back(TexHandle);
|
|
|
|
Ops.push_back(N->getOperand(2));
|
|
|
|
Ops.push_back(N->getOperand(3));
|
|
|
|
Ops.push_back(Chain);
|
|
|
|
break;
|
|
|
|
case NVPTXISD::Suld1DArrayI64Trap:
|
|
|
|
Opc = NVPTX::SULD_1D_ARRAY_I64_TRAP;
|
|
|
|
Ops.push_back(TexHandle);
|
|
|
|
Ops.push_back(N->getOperand(2));
|
|
|
|
Ops.push_back(N->getOperand(3));
|
|
|
|
Ops.push_back(Chain);
|
|
|
|
break;
|
|
|
|
case NVPTXISD::Suld1DArrayV2I8Trap:
|
|
|
|
Opc = NVPTX::SULD_1D_ARRAY_V2I8_TRAP;
|
|
|
|
Ops.push_back(TexHandle);
|
|
|
|
Ops.push_back(N->getOperand(2));
|
|
|
|
Ops.push_back(N->getOperand(3));
|
|
|
|
Ops.push_back(Chain);
|
|
|
|
break;
|
|
|
|
case NVPTXISD::Suld1DArrayV2I16Trap:
|
|
|
|
Opc = NVPTX::SULD_1D_ARRAY_V2I16_TRAP;
|
|
|
|
Ops.push_back(TexHandle);
|
|
|
|
Ops.push_back(N->getOperand(2));
|
|
|
|
Ops.push_back(N->getOperand(3));
|
|
|
|
Ops.push_back(Chain);
|
|
|
|
break;
|
|
|
|
case NVPTXISD::Suld1DArrayV2I32Trap:
|
|
|
|
Opc = NVPTX::SULD_1D_ARRAY_V2I32_TRAP;
|
|
|
|
Ops.push_back(TexHandle);
|
|
|
|
Ops.push_back(N->getOperand(2));
|
|
|
|
Ops.push_back(N->getOperand(3));
|
|
|
|
Ops.push_back(Chain);
|
|
|
|
break;
|
|
|
|
case NVPTXISD::Suld1DArrayV2I64Trap:
|
|
|
|
Opc = NVPTX::SULD_1D_ARRAY_V2I64_TRAP;
|
|
|
|
Ops.push_back(TexHandle);
|
|
|
|
Ops.push_back(N->getOperand(2));
|
|
|
|
Ops.push_back(N->getOperand(3));
|
|
|
|
Ops.push_back(Chain);
|
|
|
|
break;
|
|
|
|
case NVPTXISD::Suld1DArrayV4I8Trap:
|
|
|
|
Opc = NVPTX::SULD_1D_ARRAY_V4I8_TRAP;
|
|
|
|
Ops.push_back(TexHandle);
|
|
|
|
Ops.push_back(N->getOperand(2));
|
|
|
|
Ops.push_back(N->getOperand(3));
|
|
|
|
Ops.push_back(Chain);
|
|
|
|
break;
|
|
|
|
case NVPTXISD::Suld1DArrayV4I16Trap:
|
|
|
|
Opc = NVPTX::SULD_1D_ARRAY_V4I16_TRAP;
|
|
|
|
Ops.push_back(TexHandle);
|
|
|
|
Ops.push_back(N->getOperand(2));
|
|
|
|
Ops.push_back(N->getOperand(3));
|
|
|
|
Ops.push_back(Chain);
|
|
|
|
break;
|
|
|
|
case NVPTXISD::Suld1DArrayV4I32Trap:
|
|
|
|
Opc = NVPTX::SULD_1D_ARRAY_V4I32_TRAP;
|
|
|
|
Ops.push_back(TexHandle);
|
|
|
|
Ops.push_back(N->getOperand(2));
|
|
|
|
Ops.push_back(N->getOperand(3));
|
|
|
|
Ops.push_back(Chain);
|
|
|
|
break;
|
|
|
|
case NVPTXISD::Suld2DI8Trap:
|
|
|
|
Opc = NVPTX::SULD_2D_I8_TRAP;
|
|
|
|
Ops.push_back(TexHandle);
|
|
|
|
Ops.push_back(N->getOperand(2));
|
|
|
|
Ops.push_back(N->getOperand(3));
|
|
|
|
Ops.push_back(Chain);
|
|
|
|
break;
|
|
|
|
case NVPTXISD::Suld2DI16Trap:
|
|
|
|
Opc = NVPTX::SULD_2D_I16_TRAP;
|
|
|
|
Ops.push_back(TexHandle);
|
|
|
|
Ops.push_back(N->getOperand(2));
|
|
|
|
Ops.push_back(N->getOperand(3));
|
|
|
|
Ops.push_back(Chain);
|
|
|
|
break;
|
|
|
|
case NVPTXISD::Suld2DI32Trap:
|
|
|
|
Opc = NVPTX::SULD_2D_I32_TRAP;
|
|
|
|
Ops.push_back(TexHandle);
|
|
|
|
Ops.push_back(N->getOperand(2));
|
|
|
|
Ops.push_back(N->getOperand(3));
|
|
|
|
Ops.push_back(Chain);
|
|
|
|
break;
|
|
|
|
case NVPTXISD::Suld2DI64Trap:
|
|
|
|
Opc = NVPTX::SULD_2D_I64_TRAP;
|
|
|
|
Ops.push_back(TexHandle);
|
|
|
|
Ops.push_back(N->getOperand(2));
|
|
|
|
Ops.push_back(N->getOperand(3));
|
|
|
|
Ops.push_back(Chain);
|
|
|
|
break;
|
|
|
|
case NVPTXISD::Suld2DV2I8Trap:
|
|
|
|
Opc = NVPTX::SULD_2D_V2I8_TRAP;
|
|
|
|
Ops.push_back(TexHandle);
|
|
|
|
Ops.push_back(N->getOperand(2));
|
|
|
|
Ops.push_back(N->getOperand(3));
|
|
|
|
Ops.push_back(Chain);
|
|
|
|
break;
|
|
|
|
case NVPTXISD::Suld2DV2I16Trap:
|
|
|
|
Opc = NVPTX::SULD_2D_V2I16_TRAP;
|
|
|
|
Ops.push_back(TexHandle);
|
|
|
|
Ops.push_back(N->getOperand(2));
|
|
|
|
Ops.push_back(N->getOperand(3));
|
|
|
|
Ops.push_back(Chain);
|
|
|
|
break;
|
|
|
|
case NVPTXISD::Suld2DV2I32Trap:
|
|
|
|
Opc = NVPTX::SULD_2D_V2I32_TRAP;
|
|
|
|
Ops.push_back(TexHandle);
|
|
|
|
Ops.push_back(N->getOperand(2));
|
|
|
|
Ops.push_back(N->getOperand(3));
|
|
|
|
Ops.push_back(Chain);
|
|
|
|
break;
|
|
|
|
case NVPTXISD::Suld2DV2I64Trap:
|
|
|
|
Opc = NVPTX::SULD_2D_V2I64_TRAP;
|
|
|
|
Ops.push_back(TexHandle);
|
|
|
|
Ops.push_back(N->getOperand(2));
|
|
|
|
Ops.push_back(N->getOperand(3));
|
|
|
|
Ops.push_back(Chain);
|
|
|
|
break;
|
|
|
|
case NVPTXISD::Suld2DV4I8Trap:
|
|
|
|
Opc = NVPTX::SULD_2D_V4I8_TRAP;
|
|
|
|
Ops.push_back(TexHandle);
|
|
|
|
Ops.push_back(N->getOperand(2));
|
|
|
|
Ops.push_back(N->getOperand(3));
|
|
|
|
Ops.push_back(Chain);
|
|
|
|
break;
|
|
|
|
case NVPTXISD::Suld2DV4I16Trap:
|
|
|
|
Opc = NVPTX::SULD_2D_V4I16_TRAP;
|
|
|
|
Ops.push_back(TexHandle);
|
|
|
|
Ops.push_back(N->getOperand(2));
|
|
|
|
Ops.push_back(N->getOperand(3));
|
|
|
|
Ops.push_back(Chain);
|
|
|
|
break;
|
|
|
|
case NVPTXISD::Suld2DV4I32Trap:
|
|
|
|
Opc = NVPTX::SULD_2D_V4I32_TRAP;
|
|
|
|
Ops.push_back(TexHandle);
|
|
|
|
Ops.push_back(N->getOperand(2));
|
|
|
|
Ops.push_back(N->getOperand(3));
|
|
|
|
Ops.push_back(Chain);
|
|
|
|
break;
|
|
|
|
case NVPTXISD::Suld2DArrayI8Trap:
|
|
|
|
Opc = NVPTX::SULD_2D_ARRAY_I8_TRAP;
|
|
|
|
Ops.push_back(TexHandle);
|
|
|
|
Ops.push_back(N->getOperand(2));
|
|
|
|
Ops.push_back(N->getOperand(3));
|
|
|
|
Ops.push_back(N->getOperand(4));
|
|
|
|
Ops.push_back(Chain);
|
|
|
|
break;
|
|
|
|
case NVPTXISD::Suld2DArrayI16Trap:
|
|
|
|
Opc = NVPTX::SULD_2D_ARRAY_I16_TRAP;
|
|
|
|
Ops.push_back(TexHandle);
|
|
|
|
Ops.push_back(N->getOperand(2));
|
|
|
|
Ops.push_back(N->getOperand(3));
|
|
|
|
Ops.push_back(N->getOperand(4));
|
|
|
|
Ops.push_back(Chain);
|
|
|
|
break;
|
|
|
|
case NVPTXISD::Suld2DArrayI32Trap:
|
|
|
|
Opc = NVPTX::SULD_2D_ARRAY_I32_TRAP;
|
|
|
|
Ops.push_back(TexHandle);
|
|
|
|
Ops.push_back(N->getOperand(2));
|
|
|
|
Ops.push_back(N->getOperand(3));
|
|
|
|
Ops.push_back(N->getOperand(4));
|
|
|
|
Ops.push_back(Chain);
|
|
|
|
break;
|
|
|
|
case NVPTXISD::Suld2DArrayI64Trap:
|
|
|
|
Opc = NVPTX::SULD_2D_ARRAY_I64_TRAP;
|
|
|
|
Ops.push_back(TexHandle);
|
|
|
|
Ops.push_back(N->getOperand(2));
|
|
|
|
Ops.push_back(N->getOperand(3));
|
|
|
|
Ops.push_back(N->getOperand(4));
|
|
|
|
Ops.push_back(Chain);
|
|
|
|
break;
|
|
|
|
case NVPTXISD::Suld2DArrayV2I8Trap:
|
|
|
|
Opc = NVPTX::SULD_2D_ARRAY_V2I8_TRAP;
|
|
|
|
Ops.push_back(TexHandle);
|
|
|
|
Ops.push_back(N->getOperand(2));
|
|
|
|
Ops.push_back(N->getOperand(3));
|
|
|
|
Ops.push_back(N->getOperand(4));
|
|
|
|
Ops.push_back(Chain);
|
|
|
|
break;
|
|
|
|
case NVPTXISD::Suld2DArrayV2I16Trap:
|
|
|
|
Opc = NVPTX::SULD_2D_ARRAY_V2I16_TRAP;
|
|
|
|
Ops.push_back(TexHandle);
|
|
|
|
Ops.push_back(N->getOperand(2));
|
|
|
|
Ops.push_back(N->getOperand(3));
|
|
|
|
Ops.push_back(N->getOperand(4));
|
|
|
|
Ops.push_back(Chain);
|
|
|
|
break;
|
|
|
|
case NVPTXISD::Suld2DArrayV2I32Trap:
|
|
|
|
Opc = NVPTX::SULD_2D_ARRAY_V2I32_TRAP;
|
|
|
|
Ops.push_back(TexHandle);
|
|
|
|
Ops.push_back(N->getOperand(2));
|
|
|
|
Ops.push_back(N->getOperand(3));
|
|
|
|
Ops.push_back(N->getOperand(4));
|
|
|
|
Ops.push_back(Chain);
|
|
|
|
break;
|
|
|
|
case NVPTXISD::Suld2DArrayV2I64Trap:
|
|
|
|
Opc = NVPTX::SULD_2D_ARRAY_V2I64_TRAP;
|
|
|
|
Ops.push_back(TexHandle);
|
|
|
|
Ops.push_back(N->getOperand(2));
|
|
|
|
Ops.push_back(N->getOperand(3));
|
|
|
|
Ops.push_back(N->getOperand(4));
|
|
|
|
Ops.push_back(Chain);
|
|
|
|
break;
|
|
|
|
case NVPTXISD::Suld2DArrayV4I8Trap:
|
|
|
|
Opc = NVPTX::SULD_2D_ARRAY_V4I8_TRAP;
|
|
|
|
Ops.push_back(TexHandle);
|
|
|
|
Ops.push_back(N->getOperand(2));
|
|
|
|
Ops.push_back(N->getOperand(3));
|
|
|
|
Ops.push_back(N->getOperand(4));
|
|
|
|
Ops.push_back(Chain);
|
|
|
|
break;
|
|
|
|
case NVPTXISD::Suld2DArrayV4I16Trap:
|
|
|
|
Opc = NVPTX::SULD_2D_ARRAY_V4I16_TRAP;
|
|
|
|
Ops.push_back(TexHandle);
|
|
|
|
Ops.push_back(N->getOperand(2));
|
|
|
|
Ops.push_back(N->getOperand(3));
|
|
|
|
Ops.push_back(N->getOperand(4));
|
|
|
|
Ops.push_back(Chain);
|
|
|
|
break;
|
|
|
|
case NVPTXISD::Suld2DArrayV4I32Trap:
|
|
|
|
Opc = NVPTX::SULD_2D_ARRAY_V4I32_TRAP;
|
|
|
|
Ops.push_back(TexHandle);
|
|
|
|
Ops.push_back(N->getOperand(2));
|
|
|
|
Ops.push_back(N->getOperand(3));
|
|
|
|
Ops.push_back(N->getOperand(4));
|
|
|
|
Ops.push_back(Chain);
|
|
|
|
break;
|
|
|
|
case NVPTXISD::Suld3DI8Trap:
|
|
|
|
Opc = NVPTX::SULD_3D_I8_TRAP;
|
|
|
|
Ops.push_back(TexHandle);
|
|
|
|
Ops.push_back(N->getOperand(2));
|
|
|
|
Ops.push_back(N->getOperand(3));
|
|
|
|
Ops.push_back(N->getOperand(4));
|
|
|
|
Ops.push_back(Chain);
|
|
|
|
break;
|
|
|
|
case NVPTXISD::Suld3DI16Trap:
|
|
|
|
Opc = NVPTX::SULD_3D_I16_TRAP;
|
|
|
|
Ops.push_back(TexHandle);
|
|
|
|
Ops.push_back(N->getOperand(2));
|
|
|
|
Ops.push_back(N->getOperand(3));
|
|
|
|
Ops.push_back(N->getOperand(4));
|
|
|
|
Ops.push_back(Chain);
|
|
|
|
break;
|
|
|
|
case NVPTXISD::Suld3DI32Trap:
|
|
|
|
Opc = NVPTX::SULD_3D_I32_TRAP;
|
|
|
|
Ops.push_back(TexHandle);
|
|
|
|
Ops.push_back(N->getOperand(2));
|
|
|
|
Ops.push_back(N->getOperand(3));
|
|
|
|
Ops.push_back(N->getOperand(4));
|
|
|
|
Ops.push_back(Chain);
|
|
|
|
break;
|
|
|
|
case NVPTXISD::Suld3DI64Trap:
|
|
|
|
Opc = NVPTX::SULD_3D_I64_TRAP;
|
|
|
|
Ops.push_back(TexHandle);
|
|
|
|
Ops.push_back(N->getOperand(2));
|
|
|
|
Ops.push_back(N->getOperand(3));
|
|
|
|
Ops.push_back(N->getOperand(4));
|
|
|
|
Ops.push_back(Chain);
|
|
|
|
break;
|
|
|
|
case NVPTXISD::Suld3DV2I8Trap:
|
|
|
|
Opc = NVPTX::SULD_3D_V2I8_TRAP;
|
|
|
|
Ops.push_back(TexHandle);
|
|
|
|
Ops.push_back(N->getOperand(2));
|
|
|
|
Ops.push_back(N->getOperand(3));
|
|
|
|
Ops.push_back(N->getOperand(4));
|
|
|
|
Ops.push_back(Chain);
|
|
|
|
break;
|
|
|
|
case NVPTXISD::Suld3DV2I16Trap:
|
|
|
|
Opc = NVPTX::SULD_3D_V2I16_TRAP;
|
|
|
|
Ops.push_back(TexHandle);
|
|
|
|
Ops.push_back(N->getOperand(2));
|
|
|
|
Ops.push_back(N->getOperand(3));
|
|
|
|
Ops.push_back(N->getOperand(4));
|
|
|
|
Ops.push_back(Chain);
|
|
|
|
break;
|
|
|
|
case NVPTXISD::Suld3DV2I32Trap:
|
|
|
|
Opc = NVPTX::SULD_3D_V2I32_TRAP;
|
|
|
|
Ops.push_back(TexHandle);
|
|
|
|
Ops.push_back(N->getOperand(2));
|
|
|
|
Ops.push_back(N->getOperand(3));
|
|
|
|
Ops.push_back(N->getOperand(4));
|
|
|
|
Ops.push_back(Chain);
|
|
|
|
break;
|
|
|
|
case NVPTXISD::Suld3DV2I64Trap:
|
|
|
|
Opc = NVPTX::SULD_3D_V2I64_TRAP;
|
|
|
|
Ops.push_back(TexHandle);
|
|
|
|
Ops.push_back(N->getOperand(2));
|
|
|
|
Ops.push_back(N->getOperand(3));
|
|
|
|
Ops.push_back(N->getOperand(4));
|
|
|
|
Ops.push_back(Chain);
|
|
|
|
break;
|
|
|
|
case NVPTXISD::Suld3DV4I8Trap:
|
|
|
|
Opc = NVPTX::SULD_3D_V4I8_TRAP;
|
|
|
|
Ops.push_back(TexHandle);
|
|
|
|
Ops.push_back(N->getOperand(2));
|
|
|
|
Ops.push_back(N->getOperand(3));
|
|
|
|
Ops.push_back(N->getOperand(4));
|
|
|
|
Ops.push_back(Chain);
|
|
|
|
break;
|
|
|
|
case NVPTXISD::Suld3DV4I16Trap:
|
|
|
|
Opc = NVPTX::SULD_3D_V4I16_TRAP;
|
|
|
|
Ops.push_back(TexHandle);
|
|
|
|
Ops.push_back(N->getOperand(2));
|
|
|
|
Ops.push_back(N->getOperand(3));
|
|
|
|
Ops.push_back(N->getOperand(4));
|
|
|
|
Ops.push_back(Chain);
|
|
|
|
break;
|
|
|
|
case NVPTXISD::Suld3DV4I32Trap:
|
|
|
|
Opc = NVPTX::SULD_3D_V4I32_TRAP;
|
|
|
|
Ops.push_back(TexHandle);
|
|
|
|
Ops.push_back(N->getOperand(2));
|
|
|
|
Ops.push_back(N->getOperand(3));
|
|
|
|
Ops.push_back(N->getOperand(4));
|
|
|
|
Ops.push_back(Chain);
|
|
|
|
break;
|
|
|
|
case NVPTXISD::Suld1DI8Zero:
|
|
|
|
Opc = NVPTX::SULD_1D_I8_ZERO;
|
|
|
|
Ops.push_back(TexHandle);
|
|
|
|
Ops.push_back(N->getOperand(2));
|
|
|
|
Ops.push_back(Chain);
|
|
|
|
break;
|
|
|
|
case NVPTXISD::Suld1DI16Zero:
|
|
|
|
Opc = NVPTX::SULD_1D_I16_ZERO;
|
|
|
|
Ops.push_back(TexHandle);
|
|
|
|
Ops.push_back(N->getOperand(2));
|
|
|
|
Ops.push_back(Chain);
|
|
|
|
break;
|
|
|
|
case NVPTXISD::Suld1DI32Zero:
|
|
|
|
Opc = NVPTX::SULD_1D_I32_ZERO;
|
|
|
|
Ops.push_back(TexHandle);
|
|
|
|
Ops.push_back(N->getOperand(2));
|
|
|
|
Ops.push_back(Chain);
|
|
|
|
break;
|
|
|
|
case NVPTXISD::Suld1DI64Zero:
|
|
|
|
Opc = NVPTX::SULD_1D_I64_ZERO;
|
|
|
|
Ops.push_back(TexHandle);
|
|
|
|
Ops.push_back(N->getOperand(2));
|
|
|
|
Ops.push_back(Chain);
|
|
|
|
break;
|
|
|
|
case NVPTXISD::Suld1DV2I8Zero:
|
|
|
|
Opc = NVPTX::SULD_1D_V2I8_ZERO;
|
|
|
|
Ops.push_back(TexHandle);
|
|
|
|
Ops.push_back(N->getOperand(2));
|
|
|
|
Ops.push_back(Chain);
|
|
|
|
break;
|
|
|
|
case NVPTXISD::Suld1DV2I16Zero:
|
|
|
|
Opc = NVPTX::SULD_1D_V2I16_ZERO;
|
|
|
|
Ops.push_back(TexHandle);
|
|
|
|
Ops.push_back(N->getOperand(2));
|
|
|
|
Ops.push_back(Chain);
|
|
|
|
break;
|
|
|
|
case NVPTXISD::Suld1DV2I32Zero:
|
|
|
|
Opc = NVPTX::SULD_1D_V2I32_ZERO;
|
|
|
|
Ops.push_back(TexHandle);
|
|
|
|
Ops.push_back(N->getOperand(2));
|
|
|
|
Ops.push_back(Chain);
|
|
|
|
break;
|
|
|
|
case NVPTXISD::Suld1DV2I64Zero:
|
|
|
|
Opc = NVPTX::SULD_1D_V2I64_ZERO;
|
|
|
|
Ops.push_back(TexHandle);
|
|
|
|
Ops.push_back(N->getOperand(2));
|
|
|
|
Ops.push_back(Chain);
|
|
|
|
break;
|
|
|
|
case NVPTXISD::Suld1DV4I8Zero:
|
|
|
|
Opc = NVPTX::SULD_1D_V4I8_ZERO;
|
|
|
|
Ops.push_back(TexHandle);
|
|
|
|
Ops.push_back(N->getOperand(2));
|
|
|
|
Ops.push_back(Chain);
|
|
|
|
break;
|
|
|
|
case NVPTXISD::Suld1DV4I16Zero:
|
|
|
|
Opc = NVPTX::SULD_1D_V4I16_ZERO;
|
|
|
|
Ops.push_back(TexHandle);
|
|
|
|
Ops.push_back(N->getOperand(2));
|
|
|
|
Ops.push_back(Chain);
|
|
|
|
break;
|
|
|
|
case NVPTXISD::Suld1DV4I32Zero:
|
|
|
|
Opc = NVPTX::SULD_1D_V4I32_ZERO;
|
|
|
|
Ops.push_back(TexHandle);
|
|
|
|
Ops.push_back(N->getOperand(2));
|
|
|
|
Ops.push_back(Chain);
|
|
|
|
break;
|
|
|
|
case NVPTXISD::Suld1DArrayI8Zero:
|
|
|
|
Opc = NVPTX::SULD_1D_ARRAY_I8_ZERO;
|
|
|
|
Ops.push_back(TexHandle);
|
|
|
|
Ops.push_back(N->getOperand(2));
|
|
|
|
Ops.push_back(N->getOperand(3));
|
|
|
|
Ops.push_back(Chain);
|
|
|
|
break;
|
|
|
|
case NVPTXISD::Suld1DArrayI16Zero:
|
|
|
|
Opc = NVPTX::SULD_1D_ARRAY_I16_ZERO;
|
|
|
|
Ops.push_back(TexHandle);
|
|
|
|
Ops.push_back(N->getOperand(2));
|
|
|
|
Ops.push_back(N->getOperand(3));
|
|
|
|
Ops.push_back(Chain);
|
|
|
|
break;
|
|
|
|
case NVPTXISD::Suld1DArrayI32Zero:
|
|
|
|
Opc = NVPTX::SULD_1D_ARRAY_I32_ZERO;
|
|
|
|
Ops.push_back(TexHandle);
|
|
|
|
Ops.push_back(N->getOperand(2));
|
|
|
|
Ops.push_back(N->getOperand(3));
|
|
|
|
Ops.push_back(Chain);
|
|
|
|
break;
|
|
|
|
case NVPTXISD::Suld1DArrayI64Zero:
|
|
|
|
Opc = NVPTX::SULD_1D_ARRAY_I64_ZERO;
|
|
|
|
Ops.push_back(TexHandle);
|
|
|
|
Ops.push_back(N->getOperand(2));
|
|
|
|
Ops.push_back(N->getOperand(3));
|
|
|
|
Ops.push_back(Chain);
|
|
|
|
break;
|
|
|
|
case NVPTXISD::Suld1DArrayV2I8Zero:
|
|
|
|
Opc = NVPTX::SULD_1D_ARRAY_V2I8_ZERO;
|
|
|
|
Ops.push_back(TexHandle);
|
|
|
|
Ops.push_back(N->getOperand(2));
|
|
|
|
Ops.push_back(N->getOperand(3));
|
|
|
|
Ops.push_back(Chain);
|
|
|
|
break;
|
|
|
|
case NVPTXISD::Suld1DArrayV2I16Zero:
|
|
|
|
Opc = NVPTX::SULD_1D_ARRAY_V2I16_ZERO;
|
|
|
|
Ops.push_back(TexHandle);
|
|
|
|
Ops.push_back(N->getOperand(2));
|
|
|
|
Ops.push_back(N->getOperand(3));
|
|
|
|
Ops.push_back(Chain);
|
|
|
|
break;
|
|
|
|
case NVPTXISD::Suld1DArrayV2I32Zero:
|
|
|
|
Opc = NVPTX::SULD_1D_ARRAY_V2I32_ZERO;
|
|
|
|
Ops.push_back(TexHandle);
|
|
|
|
Ops.push_back(N->getOperand(2));
|
|
|
|
Ops.push_back(N->getOperand(3));
|
|
|
|
Ops.push_back(Chain);
|
|
|
|
break;
|
|
|
|
case NVPTXISD::Suld1DArrayV2I64Zero:
|
|
|
|
Opc = NVPTX::SULD_1D_ARRAY_V2I64_ZERO;
|
|
|
|
Ops.push_back(TexHandle);
|
|
|
|
Ops.push_back(N->getOperand(2));
|
|
|
|
Ops.push_back(N->getOperand(3));
|
|
|
|
Ops.push_back(Chain);
|
|
|
|
break;
|
|
|
|
case NVPTXISD::Suld1DArrayV4I8Zero:
|
|
|
|
Opc = NVPTX::SULD_1D_ARRAY_V4I8_ZERO;
|
|
|
|
Ops.push_back(TexHandle);
|
|
|
|
Ops.push_back(N->getOperand(2));
|
|
|
|
Ops.push_back(N->getOperand(3));
|
|
|
|
Ops.push_back(Chain);
|
|
|
|
break;
|
|
|
|
case NVPTXISD::Suld1DArrayV4I16Zero:
|
|
|
|
Opc = NVPTX::SULD_1D_ARRAY_V4I16_ZERO;
|
|
|
|
Ops.push_back(TexHandle);
|
|
|
|
Ops.push_back(N->getOperand(2));
|
|
|
|
Ops.push_back(N->getOperand(3));
|
|
|
|
Ops.push_back(Chain);
|
|
|
|
break;
|
|
|
|
case NVPTXISD::Suld1DArrayV4I32Zero:
|
|
|
|
Opc = NVPTX::SULD_1D_ARRAY_V4I32_ZERO;
|
|
|
|
Ops.push_back(TexHandle);
|
|
|
|
Ops.push_back(N->getOperand(2));
|
|
|
|
Ops.push_back(N->getOperand(3));
|
|
|
|
Ops.push_back(Chain);
|
|
|
|
break;
|
|
|
|
case NVPTXISD::Suld2DI8Zero:
|
|
|
|
Opc = NVPTX::SULD_2D_I8_ZERO;
|
|
|
|
Ops.push_back(TexHandle);
|
|
|
|
Ops.push_back(N->getOperand(2));
|
|
|
|
Ops.push_back(N->getOperand(3));
|
|
|
|
Ops.push_back(Chain);
|
|
|
|
break;
|
|
|
|
case NVPTXISD::Suld2DI16Zero:
|
|
|
|
Opc = NVPTX::SULD_2D_I16_ZERO;
|
|
|
|
Ops.push_back(TexHandle);
|
|
|
|
Ops.push_back(N->getOperand(2));
|
|
|
|
Ops.push_back(N->getOperand(3));
|
|
|
|
Ops.push_back(Chain);
|
|
|
|
break;
|
|
|
|
case NVPTXISD::Suld2DI32Zero:
|
|
|
|
Opc = NVPTX::SULD_2D_I32_ZERO;
|
|
|
|
Ops.push_back(TexHandle);
|
|
|
|
Ops.push_back(N->getOperand(2));
|
|
|
|
Ops.push_back(N->getOperand(3));
|
|
|
|
Ops.push_back(Chain);
|
|
|
|
break;
|
|
|
|
case NVPTXISD::Suld2DI64Zero:
|
|
|
|
Opc = NVPTX::SULD_2D_I64_ZERO;
|
|
|
|
Ops.push_back(TexHandle);
|
|
|
|
Ops.push_back(N->getOperand(2));
|
|
|
|
Ops.push_back(N->getOperand(3));
|
|
|
|
Ops.push_back(Chain);
|
|
|
|
break;
|
|
|
|
case NVPTXISD::Suld2DV2I8Zero:
|
|
|
|
Opc = NVPTX::SULD_2D_V2I8_ZERO;
|
|
|
|
Ops.push_back(TexHandle);
|
|
|
|
Ops.push_back(N->getOperand(2));
|
|
|
|
Ops.push_back(N->getOperand(3));
|
|
|
|
Ops.push_back(Chain);
|
|
|
|
break;
|
|
|
|
case NVPTXISD::Suld2DV2I16Zero:
|
|
|
|
Opc = NVPTX::SULD_2D_V2I16_ZERO;
|
|
|
|
Ops.push_back(TexHandle);
|
|
|
|
Ops.push_back(N->getOperand(2));
|
|
|
|
Ops.push_back(N->getOperand(3));
|
|
|
|
Ops.push_back(Chain);
|
|
|
|
break;
|
|
|
|
case NVPTXISD::Suld2DV2I32Zero:
|
|
|
|
Opc = NVPTX::SULD_2D_V2I32_ZERO;
|
|
|
|
Ops.push_back(TexHandle);
|
|
|
|
Ops.push_back(N->getOperand(2));
|
|
|
|
Ops.push_back(N->getOperand(3));
|
|
|
|
Ops.push_back(Chain);
|
|
|
|
break;
|
|
|
|
case NVPTXISD::Suld2DV2I64Zero:
|
|
|
|
Opc = NVPTX::SULD_2D_V2I64_ZERO;
|
|
|
|
Ops.push_back(TexHandle);
|
|
|
|
Ops.push_back(N->getOperand(2));
|
|
|
|
Ops.push_back(N->getOperand(3));
|
|
|
|
Ops.push_back(Chain);
|
|
|
|
break;
|
|
|
|
case NVPTXISD::Suld2DV4I8Zero:
|
|
|
|
Opc = NVPTX::SULD_2D_V4I8_ZERO;
|
|
|
|
Ops.push_back(TexHandle);
|
|
|
|
Ops.push_back(N->getOperand(2));
|
|
|
|
Ops.push_back(N->getOperand(3));
|
|
|
|
Ops.push_back(Chain);
|
|
|
|
break;
|
|
|
|
case NVPTXISD::Suld2DV4I16Zero:
|
|
|
|
Opc = NVPTX::SULD_2D_V4I16_ZERO;
|
|
|
|
Ops.push_back(TexHandle);
|
|
|
|
Ops.push_back(N->getOperand(2));
|
|
|
|
Ops.push_back(N->getOperand(3));
|
|
|
|
Ops.push_back(Chain);
|
|
|
|
break;
|
|
|
|
case NVPTXISD::Suld2DV4I32Zero:
|
|
|
|
Opc = NVPTX::SULD_2D_V4I32_ZERO;
|
|
|
|
Ops.push_back(TexHandle);
|
|
|
|
Ops.push_back(N->getOperand(2));
|
|
|
|
Ops.push_back(N->getOperand(3));
|
|
|
|
Ops.push_back(Chain);
|
|
|
|
break;
|
|
|
|
case NVPTXISD::Suld2DArrayI8Zero:
|
|
|
|
Opc = NVPTX::SULD_2D_ARRAY_I8_ZERO;
|
|
|
|
Ops.push_back(TexHandle);
|
|
|
|
Ops.push_back(N->getOperand(2));
|
|
|
|
Ops.push_back(N->getOperand(3));
|
|
|
|
Ops.push_back(N->getOperand(4));
|
|
|
|
Ops.push_back(Chain);
|
|
|
|
break;
|
|
|
|
case NVPTXISD::Suld2DArrayI16Zero:
|
|
|
|
Opc = NVPTX::SULD_2D_ARRAY_I16_ZERO;
|
|
|
|
Ops.push_back(TexHandle);
|
|
|
|
Ops.push_back(N->getOperand(2));
|
|
|
|
Ops.push_back(N->getOperand(3));
|
|
|
|
Ops.push_back(N->getOperand(4));
|
|
|
|
Ops.push_back(Chain);
|
|
|
|
break;
|
|
|
|
case NVPTXISD::Suld2DArrayI32Zero:
|
|
|
|
Opc = NVPTX::SULD_2D_ARRAY_I32_ZERO;
|
|
|
|
Ops.push_back(TexHandle);
|
|
|
|
Ops.push_back(N->getOperand(2));
|
|
|
|
Ops.push_back(N->getOperand(3));
|
|
|
|
Ops.push_back(N->getOperand(4));
|
|
|
|
Ops.push_back(Chain);
|
|
|
|
break;
|
|
|
|
case NVPTXISD::Suld2DArrayI64Zero:
|
|
|
|
Opc = NVPTX::SULD_2D_ARRAY_I64_ZERO;
|
|
|
|
Ops.push_back(TexHandle);
|
|
|
|
Ops.push_back(N->getOperand(2));
|
|
|
|
Ops.push_back(N->getOperand(3));
|
|
|
|
Ops.push_back(N->getOperand(4));
|
|
|
|
Ops.push_back(Chain);
|
|
|
|
break;
|
|
|
|
case NVPTXISD::Suld2DArrayV2I8Zero:
|
|
|
|
Opc = NVPTX::SULD_2D_ARRAY_V2I8_ZERO;
|
|
|
|
Ops.push_back(TexHandle);
|
|
|
|
Ops.push_back(N->getOperand(2));
|
|
|
|
Ops.push_back(N->getOperand(3));
|
|
|
|
Ops.push_back(N->getOperand(4));
|
|
|
|
Ops.push_back(Chain);
|
|
|
|
break;
|
|
|
|
case NVPTXISD::Suld2DArrayV2I16Zero:
|
|
|
|
Opc = NVPTX::SULD_2D_ARRAY_V2I16_ZERO;
|
|
|
|
Ops.push_back(TexHandle);
|
|
|
|
Ops.push_back(N->getOperand(2));
|
|
|
|
Ops.push_back(N->getOperand(3));
|
|
|
|
Ops.push_back(N->getOperand(4));
|
|
|
|
Ops.push_back(Chain);
|
|
|
|
break;
|
|
|
|
case NVPTXISD::Suld2DArrayV2I32Zero:
|
|
|
|
Opc = NVPTX::SULD_2D_ARRAY_V2I32_ZERO;
|
|
|
|
Ops.push_back(TexHandle);
|
|
|
|
Ops.push_back(N->getOperand(2));
|
|
|
|
Ops.push_back(N->getOperand(3));
|
|
|
|
Ops.push_back(N->getOperand(4));
|
|
|
|
Ops.push_back(Chain);
|
|
|
|
break;
|
|
|
|
case NVPTXISD::Suld2DArrayV2I64Zero:
|
|
|
|
Opc = NVPTX::SULD_2D_ARRAY_V2I64_ZERO;
|
|
|
|
Ops.push_back(TexHandle);
|
|
|
|
Ops.push_back(N->getOperand(2));
|
|
|
|
Ops.push_back(N->getOperand(3));
|
|
|
|
Ops.push_back(N->getOperand(4));
|
|
|
|
Ops.push_back(Chain);
|
|
|
|
break;
|
|
|
|
case NVPTXISD::Suld2DArrayV4I8Zero:
|
|
|
|
Opc = NVPTX::SULD_2D_ARRAY_V4I8_ZERO;
|
|
|
|
Ops.push_back(TexHandle);
|
|
|
|
Ops.push_back(N->getOperand(2));
|
|
|
|
Ops.push_back(N->getOperand(3));
|
|
|
|
Ops.push_back(N->getOperand(4));
|
|
|
|
Ops.push_back(Chain);
|
|
|
|
break;
|
|
|
|
case NVPTXISD::Suld2DArrayV4I16Zero:
|
|
|
|
Opc = NVPTX::SULD_2D_ARRAY_V4I16_ZERO;
|
|
|
|
Ops.push_back(TexHandle);
|
|
|
|
Ops.push_back(N->getOperand(2));
|
|
|
|
Ops.push_back(N->getOperand(3));
|
|
|
|
Ops.push_back(N->getOperand(4));
|
|
|
|
Ops.push_back(Chain);
|
|
|
|
break;
|
|
|
|
case NVPTXISD::Suld2DArrayV4I32Zero:
|
|
|
|
Opc = NVPTX::SULD_2D_ARRAY_V4I32_ZERO;
|
|
|
|
Ops.push_back(TexHandle);
|
|
|
|
Ops.push_back(N->getOperand(2));
|
|
|
|
Ops.push_back(N->getOperand(3));
|
|
|
|
Ops.push_back(N->getOperand(4));
|
|
|
|
Ops.push_back(Chain);
|
|
|
|
break;
|
|
|
|
case NVPTXISD::Suld3DI8Zero:
|
|
|
|
Opc = NVPTX::SULD_3D_I8_ZERO;
|
|
|
|
Ops.push_back(TexHandle);
|
|
|
|
Ops.push_back(N->getOperand(2));
|
|
|
|
Ops.push_back(N->getOperand(3));
|
|
|
|
Ops.push_back(N->getOperand(4));
|
|
|
|
Ops.push_back(Chain);
|
|
|
|
break;
|
|
|
|
case NVPTXISD::Suld3DI16Zero:
|
|
|
|
Opc = NVPTX::SULD_3D_I16_ZERO;
|
|
|
|
Ops.push_back(TexHandle);
|
|
|
|
Ops.push_back(N->getOperand(2));
|
|
|
|
Ops.push_back(N->getOperand(3));
|
|
|
|
Ops.push_back(N->getOperand(4));
|
|
|
|
Ops.push_back(Chain);
|
|
|
|
break;
|
|
|
|
case NVPTXISD::Suld3DI32Zero:
|
|
|
|
Opc = NVPTX::SULD_3D_I32_ZERO;
|
|
|
|
Ops.push_back(TexHandle);
|
|
|
|
Ops.push_back(N->getOperand(2));
|
|
|
|
Ops.push_back(N->getOperand(3));
|
|
|
|
Ops.push_back(N->getOperand(4));
|
|
|
|
Ops.push_back(Chain);
|
|
|
|
break;
|
|
|
|
case NVPTXISD::Suld3DI64Zero:
|
|
|
|
Opc = NVPTX::SULD_3D_I64_ZERO;
|
|
|
|
Ops.push_back(TexHandle);
|
|
|
|
Ops.push_back(N->getOperand(2));
|
|
|
|
Ops.push_back(N->getOperand(3));
|
|
|
|
Ops.push_back(N->getOperand(4));
|
|
|
|
Ops.push_back(Chain);
|
|
|
|
break;
|
|
|
|
case NVPTXISD::Suld3DV2I8Zero:
|
|
|
|
Opc = NVPTX::SULD_3D_V2I8_ZERO;
|
|
|
|
Ops.push_back(TexHandle);
|
|
|
|
Ops.push_back(N->getOperand(2));
|
|
|
|
Ops.push_back(N->getOperand(3));
|
|
|
|
Ops.push_back(N->getOperand(4));
|
|
|
|
Ops.push_back(Chain);
|
|
|
|
break;
|
|
|
|
case NVPTXISD::Suld3DV2I16Zero:
|
|
|
|
Opc = NVPTX::SULD_3D_V2I16_ZERO;
|
|
|
|
Ops.push_back(TexHandle);
|
|
|
|
Ops.push_back(N->getOperand(2));
|
|
|
|
Ops.push_back(N->getOperand(3));
|
|
|
|
Ops.push_back(N->getOperand(4));
|
|
|
|
Ops.push_back(Chain);
|
|
|
|
break;
|
|
|
|
case NVPTXISD::Suld3DV2I32Zero:
|
|
|
|
Opc = NVPTX::SULD_3D_V2I32_ZERO;
|
|
|
|
Ops.push_back(TexHandle);
|
|
|
|
Ops.push_back(N->getOperand(2));
|
|
|
|
Ops.push_back(N->getOperand(3));
|
|
|
|
Ops.push_back(N->getOperand(4));
|
|
|
|
Ops.push_back(Chain);
|
|
|
|
break;
|
|
|
|
case NVPTXISD::Suld3DV2I64Zero:
|
|
|
|
Opc = NVPTX::SULD_3D_V2I64_ZERO;
|
|
|
|
Ops.push_back(TexHandle);
|
|
|
|
Ops.push_back(N->getOperand(2));
|
|
|
|
Ops.push_back(N->getOperand(3));
|
|
|
|
Ops.push_back(N->getOperand(4));
|
|
|
|
Ops.push_back(Chain);
|
|
|
|
break;
|
|
|
|
case NVPTXISD::Suld3DV4I8Zero:
|
|
|
|
Opc = NVPTX::SULD_3D_V4I8_ZERO;
|
|
|
|
Ops.push_back(TexHandle);
|
|
|
|
Ops.push_back(N->getOperand(2));
|
|
|
|
Ops.push_back(N->getOperand(3));
|
|
|
|
Ops.push_back(N->getOperand(4));
|
|
|
|
Ops.push_back(Chain);
|
|
|
|
break;
|
|
|
|
case NVPTXISD::Suld3DV4I16Zero:
|
|
|
|
Opc = NVPTX::SULD_3D_V4I16_ZERO;
|
|
|
|
Ops.push_back(TexHandle);
|
|
|
|
Ops.push_back(N->getOperand(2));
|
|
|
|
Ops.push_back(N->getOperand(3));
|
|
|
|
Ops.push_back(N->getOperand(4));
|
|
|
|
Ops.push_back(Chain);
|
|
|
|
break;
|
|
|
|
case NVPTXISD::Suld3DV4I32Zero:
|
|
|
|
Opc = NVPTX::SULD_3D_V4I32_ZERO;
|
|
|
|
Ops.push_back(TexHandle);
|
|
|
|
Ops.push_back(N->getOperand(2));
|
|
|
|
Ops.push_back(N->getOperand(3));
|
|
|
|
Ops.push_back(N->getOperand(4));
|
|
|
|
Ops.push_back(Chain);
|
|
|
|
break;
|
|
|
|
}
|
2016-05-14 05:12:53 +08:00
|
|
|
ReplaceNode(N, CurDAG->getMachineNode(Opc, SDLoc(N), N->getVTList(), Ops));
|
|
|
|
return true;
|
2014-07-17 19:59:04 +08:00
|
|
|
}
|
|
|
|
|
2014-04-09 23:39:15 +08:00
|
|
|
|
2014-06-28 02:35:27 +08:00
|
|
|
/// SelectBFE - Look for instruction sequences that can be made more efficient
|
|
|
|
/// by using the 'bfe' (bit-field extract) PTX instruction
|
2016-05-14 05:12:53 +08:00
|
|
|
bool NVPTXDAGToDAGISel::tryBFE(SDNode *N) {
|
2015-04-28 22:05:47 +08:00
|
|
|
SDLoc DL(N);
|
2014-06-28 02:35:27 +08:00
|
|
|
SDValue LHS = N->getOperand(0);
|
|
|
|
SDValue RHS = N->getOperand(1);
|
|
|
|
SDValue Len;
|
|
|
|
SDValue Start;
|
|
|
|
SDValue Val;
|
|
|
|
bool IsSigned = false;
|
|
|
|
|
|
|
|
if (N->getOpcode() == ISD::AND) {
|
|
|
|
// Canonicalize the operands
|
|
|
|
// We want 'and %val, %mask'
|
|
|
|
if (isa<ConstantSDNode>(LHS) && !isa<ConstantSDNode>(RHS)) {
|
|
|
|
std::swap(LHS, RHS);
|
|
|
|
}
|
|
|
|
|
|
|
|
ConstantSDNode *Mask = dyn_cast<ConstantSDNode>(RHS);
|
|
|
|
if (!Mask) {
|
|
|
|
// We need a constant mask on the RHS of the AND
|
2016-05-14 05:12:53 +08:00
|
|
|
return false;
|
2014-06-28 02:35:27 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
// Extract the mask bits
|
|
|
|
uint64_t MaskVal = Mask->getZExtValue();
|
|
|
|
if (!isMask_64(MaskVal)) {
|
|
|
|
// We *could* handle shifted masks here, but doing so would require an
|
|
|
|
// 'and' operation to fix up the low-order bits so we would trade
|
|
|
|
// shr+and for bfe+and, which has the same throughput
|
2016-05-14 05:12:53 +08:00
|
|
|
return false;
|
2014-06-28 02:35:27 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
// How many bits are in our mask?
|
2015-02-12 23:35:40 +08:00
|
|
|
uint64_t NumBits = countTrailingOnes(MaskVal);
|
2015-04-28 22:05:47 +08:00
|
|
|
Len = CurDAG->getTargetConstant(NumBits, DL, MVT::i32);
|
2014-06-28 02:35:27 +08:00
|
|
|
|
|
|
|
if (LHS.getOpcode() == ISD::SRL || LHS.getOpcode() == ISD::SRA) {
|
|
|
|
// We have a 'srl/and' pair, extract the effective start bit and length
|
|
|
|
Val = LHS.getNode()->getOperand(0);
|
|
|
|
Start = LHS.getNode()->getOperand(1);
|
|
|
|
ConstantSDNode *StartConst = dyn_cast<ConstantSDNode>(Start);
|
|
|
|
if (StartConst) {
|
|
|
|
uint64_t StartVal = StartConst->getZExtValue();
|
|
|
|
// How many "good" bits do we have left? "good" is defined here as bits
|
|
|
|
// that exist in the original value, not shifted in.
|
2016-09-15 00:05:51 +08:00
|
|
|
uint64_t GoodBits = Start.getValueSizeInBits() - StartVal;
|
2014-06-28 02:35:27 +08:00
|
|
|
if (NumBits > GoodBits) {
|
|
|
|
// Do not handle the case where bits have been shifted in. In theory
|
|
|
|
// we could handle this, but the cost is likely higher than just
|
|
|
|
// emitting the srl/and pair.
|
2016-05-14 05:12:53 +08:00
|
|
|
return false;
|
2014-06-28 02:35:27 +08:00
|
|
|
}
|
2015-04-28 22:05:47 +08:00
|
|
|
Start = CurDAG->getTargetConstant(StartVal, DL, MVT::i32);
|
2014-06-28 02:35:27 +08:00
|
|
|
} else {
|
|
|
|
// Do not handle the case where the shift amount (can be zero if no srl
|
|
|
|
// was found) is not constant. We could handle this case, but it would
|
|
|
|
// require run-time logic that would be more expensive than just
|
|
|
|
// emitting the srl/and pair.
|
2016-05-14 05:12:53 +08:00
|
|
|
return false;
|
2014-06-28 02:35:27 +08:00
|
|
|
}
|
|
|
|
} else {
|
|
|
|
// Do not handle the case where the LHS of the and is not a shift. While
|
|
|
|
// it would be trivial to handle this case, it would just transform
|
|
|
|
// 'and' -> 'bfe', but 'and' has higher-throughput.
|
2016-05-14 05:12:53 +08:00
|
|
|
return false;
|
2014-06-28 02:35:27 +08:00
|
|
|
}
|
|
|
|
} else if (N->getOpcode() == ISD::SRL || N->getOpcode() == ISD::SRA) {
|
|
|
|
if (LHS->getOpcode() == ISD::AND) {
|
|
|
|
ConstantSDNode *ShiftCnst = dyn_cast<ConstantSDNode>(RHS);
|
|
|
|
if (!ShiftCnst) {
|
|
|
|
// Shift amount must be constant
|
2016-05-14 05:12:53 +08:00
|
|
|
return false;
|
2014-06-28 02:35:27 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
uint64_t ShiftAmt = ShiftCnst->getZExtValue();
|
|
|
|
|
|
|
|
SDValue AndLHS = LHS->getOperand(0);
|
|
|
|
SDValue AndRHS = LHS->getOperand(1);
|
|
|
|
|
|
|
|
// Canonicalize the AND to have the mask on the RHS
|
|
|
|
if (isa<ConstantSDNode>(AndLHS)) {
|
|
|
|
std::swap(AndLHS, AndRHS);
|
|
|
|
}
|
|
|
|
|
|
|
|
ConstantSDNode *MaskCnst = dyn_cast<ConstantSDNode>(AndRHS);
|
|
|
|
if (!MaskCnst) {
|
|
|
|
// Mask must be constant
|
2016-05-14 05:12:53 +08:00
|
|
|
return false;
|
2014-06-28 02:35:27 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
uint64_t MaskVal = MaskCnst->getZExtValue();
|
|
|
|
uint64_t NumZeros;
|
|
|
|
uint64_t NumBits;
|
|
|
|
if (isMask_64(MaskVal)) {
|
|
|
|
NumZeros = 0;
|
|
|
|
// The number of bits in the result bitfield will be the number of
|
|
|
|
// trailing ones (the AND) minus the number of bits we shift off
|
2015-02-12 23:35:40 +08:00
|
|
|
NumBits = countTrailingOnes(MaskVal) - ShiftAmt;
|
2014-06-28 02:35:27 +08:00
|
|
|
} else if (isShiftedMask_64(MaskVal)) {
|
|
|
|
NumZeros = countTrailingZeros(MaskVal);
|
2015-02-12 23:35:40 +08:00
|
|
|
unsigned NumOnes = countTrailingOnes(MaskVal >> NumZeros);
|
2014-06-28 02:35:27 +08:00
|
|
|
// The number of bits in the result bitfield will be the number of
|
|
|
|
// trailing zeros plus the number of set bits in the mask minus the
|
|
|
|
// number of bits we shift off
|
|
|
|
NumBits = NumZeros + NumOnes - ShiftAmt;
|
|
|
|
} else {
|
|
|
|
// This is not a mask we can handle
|
2016-05-14 05:12:53 +08:00
|
|
|
return false;
|
2014-06-28 02:35:27 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
if (ShiftAmt < NumZeros) {
|
|
|
|
// Handling this case would require extra logic that would make this
|
|
|
|
// transformation non-profitable
|
2016-05-14 05:12:53 +08:00
|
|
|
return false;
|
2014-06-28 02:35:27 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
Val = AndLHS;
|
2015-04-28 22:05:47 +08:00
|
|
|
Start = CurDAG->getTargetConstant(ShiftAmt, DL, MVT::i32);
|
|
|
|
Len = CurDAG->getTargetConstant(NumBits, DL, MVT::i32);
|
2014-06-28 02:35:27 +08:00
|
|
|
} else if (LHS->getOpcode() == ISD::SHL) {
|
|
|
|
// Here, we have a pattern like:
|
|
|
|
//
|
|
|
|
// (sra (shl val, NN), MM)
|
|
|
|
// or
|
|
|
|
// (srl (shl val, NN), MM)
|
|
|
|
//
|
|
|
|
// If MM >= NN, we can efficiently optimize this with bfe
|
|
|
|
Val = LHS->getOperand(0);
|
|
|
|
|
|
|
|
SDValue ShlRHS = LHS->getOperand(1);
|
|
|
|
ConstantSDNode *ShlCnst = dyn_cast<ConstantSDNode>(ShlRHS);
|
|
|
|
if (!ShlCnst) {
|
|
|
|
// Shift amount must be constant
|
2016-05-14 05:12:53 +08:00
|
|
|
return false;
|
2014-06-28 02:35:27 +08:00
|
|
|
}
|
|
|
|
uint64_t InnerShiftAmt = ShlCnst->getZExtValue();
|
|
|
|
|
|
|
|
SDValue ShrRHS = RHS;
|
|
|
|
ConstantSDNode *ShrCnst = dyn_cast<ConstantSDNode>(ShrRHS);
|
|
|
|
if (!ShrCnst) {
|
|
|
|
// Shift amount must be constant
|
2016-05-14 05:12:53 +08:00
|
|
|
return false;
|
2014-06-28 02:35:27 +08:00
|
|
|
}
|
|
|
|
uint64_t OuterShiftAmt = ShrCnst->getZExtValue();
|
|
|
|
|
|
|
|
// To avoid extra codegen and be profitable, we need Outer >= Inner
|
|
|
|
if (OuterShiftAmt < InnerShiftAmt) {
|
2016-05-14 05:12:53 +08:00
|
|
|
return false;
|
2014-06-28 02:35:27 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
// If the outer shift is more than the type size, we have no bitfield to
|
|
|
|
// extract (since we also check that the inner shift is <= the outer shift
|
|
|
|
// then this also implies that the inner shift is < the type size)
|
2016-09-15 00:05:51 +08:00
|
|
|
if (OuterShiftAmt >= Val.getValueSizeInBits()) {
|
2016-05-14 05:12:53 +08:00
|
|
|
return false;
|
2014-06-28 02:35:27 +08:00
|
|
|
}
|
|
|
|
|
2016-09-15 00:05:51 +08:00
|
|
|
Start = CurDAG->getTargetConstant(OuterShiftAmt - InnerShiftAmt, DL,
|
|
|
|
MVT::i32);
|
|
|
|
Len = CurDAG->getTargetConstant(Val.getValueSizeInBits() - OuterShiftAmt,
|
|
|
|
DL, MVT::i32);
|
2014-06-28 02:35:27 +08:00
|
|
|
|
|
|
|
if (N->getOpcode() == ISD::SRA) {
|
|
|
|
// If we have a arithmetic right shift, we need to use the signed bfe
|
|
|
|
// variant
|
|
|
|
IsSigned = true;
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
// No can do...
|
2016-05-14 05:12:53 +08:00
|
|
|
return false;
|
2014-06-28 02:35:27 +08:00
|
|
|
}
|
|
|
|
} else {
|
|
|
|
// No can do...
|
2016-05-14 05:12:53 +08:00
|
|
|
return false;
|
2014-06-28 02:35:27 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
unsigned Opc;
|
|
|
|
// For the BFE operations we form here from "and" and "srl", always use the
|
|
|
|
// unsigned variants.
|
|
|
|
if (Val.getValueType() == MVT::i32) {
|
|
|
|
if (IsSigned) {
|
|
|
|
Opc = NVPTX::BFE_S32rii;
|
|
|
|
} else {
|
|
|
|
Opc = NVPTX::BFE_U32rii;
|
|
|
|
}
|
|
|
|
} else if (Val.getValueType() == MVT::i64) {
|
|
|
|
if (IsSigned) {
|
|
|
|
Opc = NVPTX::BFE_S64rii;
|
|
|
|
} else {
|
|
|
|
Opc = NVPTX::BFE_U64rii;
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
// We cannot handle this type
|
2016-05-14 05:12:53 +08:00
|
|
|
return false;
|
2014-06-28 02:35:27 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
SDValue Ops[] = {
|
|
|
|
Val, Start, Len
|
|
|
|
};
|
|
|
|
|
2016-05-14 05:12:53 +08:00
|
|
|
ReplaceNode(N, CurDAG->getMachineNode(Opc, DL, N->getVTList(), Ops));
|
|
|
|
return true;
|
2014-06-28 02:35:27 +08:00
|
|
|
}
|
|
|
|
|
2012-05-05 04:18:50 +08:00
|
|
|
// SelectDirectAddr - Match a direct address for DAG.
|
|
|
|
// A direct address could be a globaladdress or externalsymbol.
|
|
|
|
bool NVPTXDAGToDAGISel::SelectDirectAddr(SDValue N, SDValue &Address) {
|
|
|
|
// Return true if TGA or ES.
|
2013-03-30 22:29:21 +08:00
|
|
|
if (N.getOpcode() == ISD::TargetGlobalAddress ||
|
|
|
|
N.getOpcode() == ISD::TargetExternalSymbol) {
|
2012-05-05 04:18:50 +08:00
|
|
|
Address = N;
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
if (N.getOpcode() == NVPTXISD::Wrapper) {
|
|
|
|
Address = N.getOperand(0);
|
|
|
|
return true;
|
|
|
|
}
|
2016-07-21 02:39:47 +08:00
|
|
|
// addrspacecast(MoveParam(arg_symbol) to addrspace(PARAM)) -> arg_symbol
|
|
|
|
if (AddrSpaceCastSDNode *CastN = dyn_cast<AddrSpaceCastSDNode>(N)) {
|
|
|
|
if (CastN->getSrcAddressSpace() == ADDRESS_SPACE_GENERIC &&
|
|
|
|
CastN->getDestAddressSpace() == ADDRESS_SPACE_PARAM &&
|
|
|
|
CastN->getOperand(0).getOpcode() == NVPTXISD::MoveParam)
|
|
|
|
return SelectDirectAddr(CastN->getOperand(0).getOperand(0), Address);
|
2012-05-05 04:18:50 +08:00
|
|
|
}
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
// symbol+offset
|
2013-03-30 22:29:21 +08:00
|
|
|
bool NVPTXDAGToDAGISel::SelectADDRsi_imp(
|
|
|
|
SDNode *OpNode, SDValue Addr, SDValue &Base, SDValue &Offset, MVT mvt) {
|
2012-05-05 04:18:50 +08:00
|
|
|
if (Addr.getOpcode() == ISD::ADD) {
|
|
|
|
if (ConstantSDNode *CN = dyn_cast<ConstantSDNode>(Addr.getOperand(1))) {
|
2013-03-30 22:29:21 +08:00
|
|
|
SDValue base = Addr.getOperand(0);
|
2012-05-05 04:18:50 +08:00
|
|
|
if (SelectDirectAddr(base, Base)) {
|
2015-04-28 22:05:47 +08:00
|
|
|
Offset = CurDAG->getTargetConstant(CN->getZExtValue(), SDLoc(OpNode),
|
|
|
|
mvt);
|
2012-05-05 04:18:50 +08:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
// symbol+offset
|
|
|
|
bool NVPTXDAGToDAGISel::SelectADDRsi(SDNode *OpNode, SDValue Addr,
|
|
|
|
SDValue &Base, SDValue &Offset) {
|
|
|
|
return SelectADDRsi_imp(OpNode, Addr, Base, Offset, MVT::i32);
|
|
|
|
}
|
|
|
|
|
|
|
|
// symbol+offset
|
|
|
|
bool NVPTXDAGToDAGISel::SelectADDRsi64(SDNode *OpNode, SDValue Addr,
|
|
|
|
SDValue &Base, SDValue &Offset) {
|
|
|
|
return SelectADDRsi_imp(OpNode, Addr, Base, Offset, MVT::i64);
|
|
|
|
}
|
|
|
|
|
|
|
|
// register+offset
|
2013-03-30 22:29:21 +08:00
|
|
|
bool NVPTXDAGToDAGISel::SelectADDRri_imp(
|
|
|
|
SDNode *OpNode, SDValue Addr, SDValue &Base, SDValue &Offset, MVT mvt) {
|
2012-05-05 04:18:50 +08:00
|
|
|
if (FrameIndexSDNode *FIN = dyn_cast<FrameIndexSDNode>(Addr)) {
|
|
|
|
Base = CurDAG->getTargetFrameIndex(FIN->getIndex(), mvt);
|
2015-04-28 22:05:47 +08:00
|
|
|
Offset = CurDAG->getTargetConstant(0, SDLoc(OpNode), mvt);
|
2012-05-05 04:18:50 +08:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
if (Addr.getOpcode() == ISD::TargetExternalSymbol ||
|
|
|
|
Addr.getOpcode() == ISD::TargetGlobalAddress)
|
2013-03-30 22:29:21 +08:00
|
|
|
return false; // direct calls.
|
2012-05-05 04:18:50 +08:00
|
|
|
|
|
|
|
if (Addr.getOpcode() == ISD::ADD) {
|
|
|
|
if (SelectDirectAddr(Addr.getOperand(0), Addr)) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
if (ConstantSDNode *CN = dyn_cast<ConstantSDNode>(Addr.getOperand(1))) {
|
|
|
|
if (FrameIndexSDNode *FIN =
|
2013-03-30 22:29:21 +08:00
|
|
|
dyn_cast<FrameIndexSDNode>(Addr.getOperand(0)))
|
2012-05-05 04:18:50 +08:00
|
|
|
// Constant offset from frame ref.
|
|
|
|
Base = CurDAG->getTargetFrameIndex(FIN->getIndex(), mvt);
|
|
|
|
else
|
|
|
|
Base = Addr.getOperand(0);
|
2015-04-28 22:05:47 +08:00
|
|
|
Offset = CurDAG->getTargetConstant(CN->getZExtValue(), SDLoc(OpNode),
|
|
|
|
mvt);
|
2012-05-05 04:18:50 +08:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
// register+offset
|
|
|
|
bool NVPTXDAGToDAGISel::SelectADDRri(SDNode *OpNode, SDValue Addr,
|
|
|
|
SDValue &Base, SDValue &Offset) {
|
|
|
|
return SelectADDRri_imp(OpNode, Addr, Base, Offset, MVT::i32);
|
|
|
|
}
|
|
|
|
|
|
|
|
// register+offset
|
|
|
|
bool NVPTXDAGToDAGISel::SelectADDRri64(SDNode *OpNode, SDValue Addr,
|
|
|
|
SDValue &Base, SDValue &Offset) {
|
|
|
|
return SelectADDRri_imp(OpNode, Addr, Base, Offset, MVT::i64);
|
|
|
|
}
|
|
|
|
|
|
|
|
bool NVPTXDAGToDAGISel::ChkMemSDNodeAddressSpace(SDNode *N,
|
|
|
|
unsigned int spN) const {
|
2014-04-25 13:30:21 +08:00
|
|
|
const Value *Src = nullptr;
|
2012-05-05 04:18:50 +08:00
|
|
|
if (MemSDNode *mN = dyn_cast<MemSDNode>(N)) {
|
2014-04-15 15:22:52 +08:00
|
|
|
if (spN == 0 && mN->getMemOperand()->getPseudoValue())
|
|
|
|
return true;
|
|
|
|
Src = mN->getMemOperand()->getValue();
|
2012-05-05 04:18:50 +08:00
|
|
|
}
|
|
|
|
if (!Src)
|
|
|
|
return false;
|
2015-08-02 06:20:21 +08:00
|
|
|
if (auto *PT = dyn_cast<PointerType>(Src->getType()))
|
2012-05-05 04:18:50 +08:00
|
|
|
return (PT->getAddressSpace() == spN);
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
/// SelectInlineAsmMemoryOperand - Implement addressing mode selection for
|
|
|
|
/// inline asm expressions.
|
2013-03-30 22:29:21 +08:00
|
|
|
bool NVPTXDAGToDAGISel::SelectInlineAsmMemoryOperand(
|
2015-03-13 20:45:09 +08:00
|
|
|
const SDValue &Op, unsigned ConstraintID, std::vector<SDValue> &OutOps) {
|
2012-05-05 04:18:50 +08:00
|
|
|
SDValue Op0, Op1;
|
2015-03-13 20:45:09 +08:00
|
|
|
switch (ConstraintID) {
|
2013-03-30 22:29:21 +08:00
|
|
|
default:
|
|
|
|
return true;
|
2015-03-13 20:45:09 +08:00
|
|
|
case InlineAsm::Constraint_m: // memory
|
2012-05-05 04:18:50 +08:00
|
|
|
if (SelectDirectAddr(Op, Op0)) {
|
|
|
|
OutOps.push_back(Op0);
|
2015-04-28 22:05:47 +08:00
|
|
|
OutOps.push_back(CurDAG->getTargetConstant(0, SDLoc(Op), MVT::i32));
|
2012-05-05 04:18:50 +08:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
if (SelectADDRri(Op.getNode(), Op, Op0, Op1)) {
|
|
|
|
OutOps.push_back(Op0);
|
|
|
|
OutOps.push_back(Op1);
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
return true;
|
|
|
|
}
|
2016-05-03 02:12:02 +08:00
|
|
|
|
|
|
|
/// GetConvertOpcode - Returns the CVT_ instruction opcode that implements a
|
|
|
|
/// conversion from \p SrcTy to \p DestTy.
|
|
|
|
unsigned NVPTXDAGToDAGISel::GetConvertOpcode(MVT DestTy, MVT SrcTy,
|
|
|
|
bool IsSigned) {
|
|
|
|
switch (SrcTy.SimpleTy) {
|
|
|
|
default:
|
|
|
|
llvm_unreachable("Unhandled source type");
|
|
|
|
case MVT::i8:
|
|
|
|
switch (DestTy.SimpleTy) {
|
|
|
|
default:
|
|
|
|
llvm_unreachable("Unhandled dest type");
|
|
|
|
case MVT::i16:
|
|
|
|
return IsSigned ? NVPTX::CVT_s16_s8 : NVPTX::CVT_u16_u8;
|
|
|
|
case MVT::i32:
|
|
|
|
return IsSigned ? NVPTX::CVT_s32_s8 : NVPTX::CVT_u32_u8;
|
|
|
|
case MVT::i64:
|
|
|
|
return IsSigned ? NVPTX::CVT_s64_s8 : NVPTX::CVT_u64_u8;
|
|
|
|
}
|
|
|
|
case MVT::i16:
|
|
|
|
switch (DestTy.SimpleTy) {
|
|
|
|
default:
|
|
|
|
llvm_unreachable("Unhandled dest type");
|
|
|
|
case MVT::i8:
|
|
|
|
return IsSigned ? NVPTX::CVT_s8_s16 : NVPTX::CVT_u8_u16;
|
|
|
|
case MVT::i32:
|
|
|
|
return IsSigned ? NVPTX::CVT_s32_s16 : NVPTX::CVT_u32_u16;
|
|
|
|
case MVT::i64:
|
|
|
|
return IsSigned ? NVPTX::CVT_s64_s16 : NVPTX::CVT_u64_u16;
|
|
|
|
}
|
|
|
|
case MVT::i32:
|
|
|
|
switch (DestTy.SimpleTy) {
|
|
|
|
default:
|
|
|
|
llvm_unreachable("Unhandled dest type");
|
|
|
|
case MVT::i8:
|
|
|
|
return IsSigned ? NVPTX::CVT_s8_s32 : NVPTX::CVT_u8_u32;
|
|
|
|
case MVT::i16:
|
|
|
|
return IsSigned ? NVPTX::CVT_s16_s32 : NVPTX::CVT_u16_u32;
|
|
|
|
case MVT::i64:
|
|
|
|
return IsSigned ? NVPTX::CVT_s64_s32 : NVPTX::CVT_u64_u32;
|
|
|
|
}
|
|
|
|
case MVT::i64:
|
|
|
|
switch (DestTy.SimpleTy) {
|
|
|
|
default:
|
|
|
|
llvm_unreachable("Unhandled dest type");
|
|
|
|
case MVT::i8:
|
|
|
|
return IsSigned ? NVPTX::CVT_s8_s64 : NVPTX::CVT_u8_u64;
|
|
|
|
case MVT::i16:
|
|
|
|
return IsSigned ? NVPTX::CVT_s16_s64 : NVPTX::CVT_u16_u64;
|
|
|
|
case MVT::i32:
|
|
|
|
return IsSigned ? NVPTX::CVT_s32_s64 : NVPTX::CVT_u32_u64;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|