2012-12-12 05:25:42 +08:00
|
|
|
//===-- AMDGPUInstrInfo.h - AMDGPU Instruction Information ------*- C++ -*-===//
|
|
|
|
//
|
|
|
|
// The LLVM Compiler Infrastructure
|
|
|
|
//
|
|
|
|
// This file is distributed under the University of Illinois Open Source
|
|
|
|
// License. See LICENSE.TXT for details.
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
//
|
|
|
|
/// \file
|
2018-05-01 23:54:18 +08:00
|
|
|
/// Contains the definition of a TargetInstrInfo class that is common
|
2012-12-12 05:25:42 +08:00
|
|
|
/// to all AMD GPUs.
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
2016-03-11 16:00:27 +08:00
|
|
|
#ifndef LLVM_LIB_TARGET_AMDGPU_AMDGPUINSTRINFO_H
|
|
|
|
#define LLVM_LIB_TARGET_AMDGPU_AMDGPUINSTRINFO_H
|
2012-12-12 05:25:42 +08:00
|
|
|
|
2017-03-27 22:04:01 +08:00
|
|
|
#include "AMDGPU.h"
|
2016-10-07 22:46:06 +08:00
|
|
|
#include "Utils/AMDGPUBaseInfo.h"
|
2017-11-08 09:01:31 +08:00
|
|
|
#include "llvm/CodeGen/TargetInstrInfo.h"
|
2012-12-12 05:25:42 +08:00
|
|
|
|
|
|
|
#define GET_INSTRINFO_HEADER
|
|
|
|
#include "AMDGPUGenInstrInfo.inc"
|
2017-12-14 05:07:51 +08:00
|
|
|
#undef GET_INSTRINFO_HEADER
|
2012-12-12 05:25:42 +08:00
|
|
|
|
|
|
|
namespace llvm {
|
|
|
|
|
2014-06-13 09:32:00 +08:00
|
|
|
class AMDGPUSubtarget;
|
2012-12-12 05:25:42 +08:00
|
|
|
class MachineFunction;
|
|
|
|
class MachineInstr;
|
|
|
|
class MachineInstrBuilder;
|
|
|
|
|
|
|
|
class AMDGPUInstrInfo : public AMDGPUGenInstrInfo {
|
|
|
|
private:
|
2014-06-13 09:32:00 +08:00
|
|
|
const AMDGPUSubtarget &ST;
|
2012-12-12 05:25:42 +08:00
|
|
|
|
2016-06-24 14:30:11 +08:00
|
|
|
virtual void anchor();
|
2017-03-27 22:04:01 +08:00
|
|
|
protected:
|
|
|
|
AMDGPUAS AMDGPUASI;
|
2012-12-12 05:25:42 +08:00
|
|
|
|
2014-09-15 23:41:53 +08:00
|
|
|
public:
|
2016-06-24 14:30:11 +08:00
|
|
|
explicit AMDGPUInstrInfo(const AMDGPUSubtarget &st);
|
|
|
|
|
2012-12-12 05:25:42 +08:00
|
|
|
bool shouldScheduleLoadsNear(SDNode *Load1, SDNode *Load2,
|
|
|
|
int64_t Offset1, int64_t Offset2,
|
2014-04-29 15:57:24 +08:00
|
|
|
unsigned NumLoads) const override;
|
2012-12-12 05:25:42 +08:00
|
|
|
|
2018-05-01 23:54:18 +08:00
|
|
|
/// Return a target-specific opcode if Opcode is a pseudo instruction.
|
2015-01-16 02:42:51 +08:00
|
|
|
/// Return -1 if the target-specific opcode for the pseudo instruction does
|
|
|
|
/// not exist. If Opcode is not a pseudo instruction, this is identity.
|
|
|
|
int pseudoToMCOpcode(int Opcode) const;
|
2018-02-10 00:57:48 +08:00
|
|
|
|
|
|
|
static bool isUniformMMO(const MachineMemOperand *MMO);
|
2012-12-12 05:25:42 +08:00
|
|
|
};
|
AMDGPU: Make getTgtMemIntrinsic table-driven for resource-based intrinsics
Summary:
Avoids having to list all intrinsics manually.
This is in preparation for the new dimension-aware image intrinsics,
which I'd rather not have to list here by hand.
Change-Id: If7ced04998397ef68c4cb8f7de66b5050fb767e5
Reviewers: arsenm, rampitec, b-sumner
Subscribers: kzhuravl, wdng, mgorny, yaxunl, dstuttard, tpr, llvm-commits, t-tye
Differential Revision: https://reviews.llvm.org/D44937
llvm-svn: 328938
2018-04-02 01:09:07 +08:00
|
|
|
|
|
|
|
namespace AMDGPU {
|
|
|
|
|
|
|
|
struct RsrcIntrinsic {
|
|
|
|
unsigned Intr;
|
|
|
|
uint8_t RsrcArg;
|
|
|
|
bool IsImage;
|
|
|
|
};
|
2018-06-21 21:36:33 +08:00
|
|
|
const RsrcIntrinsic *lookupRsrcIntrinsic(unsigned Intr);
|
AMDGPU: Make getTgtMemIntrinsic table-driven for resource-based intrinsics
Summary:
Avoids having to list all intrinsics manually.
This is in preparation for the new dimension-aware image intrinsics,
which I'd rather not have to list here by hand.
Change-Id: If7ced04998397ef68c4cb8f7de66b5050fb767e5
Reviewers: arsenm, rampitec, b-sumner
Subscribers: kzhuravl, wdng, mgorny, yaxunl, dstuttard, tpr, llvm-commits, t-tye
Differential Revision: https://reviews.llvm.org/D44937
llvm-svn: 328938
2018-04-02 01:09:07 +08:00
|
|
|
|
AMDGPU: Dimension-aware image intrinsics
Summary:
These new image intrinsics contain the texture type as part of
their name and have each component of the address/coordinate as
individual parameters.
This is a preparatory step for implementing the A16 feature, where
coordinates are passed as half-floats or -ints, but the Z compare
value and texel offsets are still full dwords, making it difficult
or impossible to distinguish between A16 on or off in the old-style
intrinsics.
Additionally, these intrinsics pass the 'texfailpolicy' and
'cachectrl' as i32 bit fields to reduce operand clutter and allow
for future extensibility.
v2:
- gather4 supports 2darray images
- fix a bug with 1D images on SI
Change-Id: I099f309e0a394082a5901ea196c3967afb867f04
Reviewers: arsenm, rampitec, b-sumner
Subscribers: kzhuravl, wdng, yaxunl, dstuttard, tpr, llvm-commits, t-tye
Differential Revision: https://reviews.llvm.org/D44939
llvm-svn: 329166
2018-04-04 18:58:54 +08:00
|
|
|
struct D16ImageDimIntrinsic {
|
|
|
|
unsigned Intr;
|
|
|
|
unsigned D16HelperIntr;
|
|
|
|
};
|
2018-06-21 21:36:33 +08:00
|
|
|
const D16ImageDimIntrinsic *lookupD16ImageDimIntrinsic(unsigned Intr);
|
AMDGPU: Dimension-aware image intrinsics
Summary:
These new image intrinsics contain the texture type as part of
their name and have each component of the address/coordinate as
individual parameters.
This is a preparatory step for implementing the A16 feature, where
coordinates are passed as half-floats or -ints, but the Z compare
value and texel offsets are still full dwords, making it difficult
or impossible to distinguish between A16 on or off in the old-style
intrinsics.
Additionally, these intrinsics pass the 'texfailpolicy' and
'cachectrl' as i32 bit fields to reduce operand clutter and allow
for future extensibility.
v2:
- gather4 supports 2darray images
- fix a bug with 1D images on SI
Change-Id: I099f309e0a394082a5901ea196c3967afb867f04
Reviewers: arsenm, rampitec, b-sumner
Subscribers: kzhuravl, wdng, yaxunl, dstuttard, tpr, llvm-commits, t-tye
Differential Revision: https://reviews.llvm.org/D44939
llvm-svn: 329166
2018-04-04 18:58:54 +08:00
|
|
|
|
AMDGPU: Select MIMG instructions manually in SITargetLowering
Summary:
Having TableGen patterns for image intrinsics is hitting limitations:
for D16 we already have to manually pre-lower the packing of data
values, and we will have to do the same for A16 eventually.
Since there is already some custom C++ code anyway, it is arguably easier
to just do everything in C++, now that we can use the beefed-up generic
tables backend of TableGen to provide all the required metadata and map
intrinsics to corresponding opcodes. With this approach, all image
intrinsic lowering happens in SITargetLowering::lowerImage. That code is
dense due to all the cases that it handles, but it should still be easier
to follow than what we had before, by virtue of it all being done in a
single location, and by virtue of not relying on the TableGen pattern
magic that very few people really understand.
This means that we will have MachineSDNodes with MIMG instructions
during DAG combining, but that seems alright: previously we had
intrinsic nodes instead, but those are similarly opaque to the generic
CodeGen infrastructure, and the final pattern matching just did a 1:1
translation to machine instructions anyway. If anything, the fact that
we now merge the address words into a vector before DAG combine should
be an advantage.
Change-Id: I417f26bd88f54ce9781c1668acc01f3f99774de6
Reviewers: arsenm, rampitec, rtaylor, tstellar
Subscribers: kzhuravl, wdng, yaxunl, dstuttard, tpr, t-tye, llvm-commits
Differential Revision: https://reviews.llvm.org/D48017
llvm-svn: 335228
2018-06-21 21:36:57 +08:00
|
|
|
struct ImageDimIntrinsicInfo {
|
|
|
|
unsigned Intr;
|
|
|
|
unsigned BaseOpcode;
|
|
|
|
MIMGDim Dim;
|
|
|
|
};
|
|
|
|
const ImageDimIntrinsicInfo *getImageDimIntrinsicInfo(unsigned Intr);
|
|
|
|
|
AMDGPU: Make getTgtMemIntrinsic table-driven for resource-based intrinsics
Summary:
Avoids having to list all intrinsics manually.
This is in preparation for the new dimension-aware image intrinsics,
which I'd rather not have to list here by hand.
Change-Id: If7ced04998397ef68c4cb8f7de66b5050fb767e5
Reviewers: arsenm, rampitec, b-sumner
Subscribers: kzhuravl, wdng, mgorny, yaxunl, dstuttard, tpr, llvm-commits, t-tye
Differential Revision: https://reviews.llvm.org/D44937
llvm-svn: 328938
2018-04-02 01:09:07 +08:00
|
|
|
} // end AMDGPU namespace
|
2015-06-23 17:49:53 +08:00
|
|
|
} // End llvm namespace
|
2012-12-12 05:25:42 +08:00
|
|
|
|
2014-08-14 00:26:38 +08:00
|
|
|
#endif
|