2018-05-25 01:37:18 +02:00
|
|
|
|
// Copyright 2018 yuzu Emulator Project
|
2018-04-05 03:43:40 +02:00
|
|
|
|
// Licensed under GPLv2 or any later version
|
|
|
|
|
// Refer to the license.txt file included.
|
|
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
2019-06-24 06:51:02 +02:00
|
|
|
|
#include <array>
|
2018-04-21 02:49:05 +02:00
|
|
|
|
#include <bitset>
|
2018-10-30 05:03:25 +01:00
|
|
|
|
#include <optional>
|
2018-09-21 22:14:15 +02:00
|
|
|
|
#include <tuple>
|
2018-04-21 02:49:05 +02:00
|
|
|
|
#include <vector>
|
|
|
|
|
|
2018-08-19 21:00:12 +02:00
|
|
|
|
#include "common/assert.h"
|
2018-04-05 03:43:40 +02:00
|
|
|
|
#include "common/bit_field.h"
|
2018-04-21 02:49:05 +02:00
|
|
|
|
#include "common/common_types.h"
|
2018-04-05 03:43:40 +02:00
|
|
|
|
|
2018-07-21 00:14:17 +02:00
|
|
|
|
namespace Tegra::Shader {
|
2018-04-05 03:43:40 +02:00
|
|
|
|
|
|
|
|
|
struct Register {
|
2018-04-26 05:55:21 +02:00
|
|
|
|
/// Number of registers
|
2018-09-15 15:21:06 +02:00
|
|
|
|
static constexpr std::size_t NumRegisters = 256;
|
2018-04-26 05:55:21 +02:00
|
|
|
|
|
|
|
|
|
/// Register 255 is special cased to always be 0
|
2018-09-15 15:21:06 +02:00
|
|
|
|
static constexpr std::size_t ZeroIndex = 255;
|
2018-04-20 16:04:54 +02:00
|
|
|
|
|
2018-04-28 04:19:14 +02:00
|
|
|
|
enum class Size : u64 {
|
|
|
|
|
Byte = 0,
|
|
|
|
|
Short = 1,
|
|
|
|
|
Word = 2,
|
|
|
|
|
Long = 3,
|
|
|
|
|
};
|
|
|
|
|
|
2018-04-18 00:06:10 +02:00
|
|
|
|
constexpr Register() = default;
|
2018-04-05 03:43:40 +02:00
|
|
|
|
|
|
|
|
|
constexpr Register(u64 value) : value(value) {}
|
|
|
|
|
|
|
|
|
|
constexpr operator u64() const {
|
|
|
|
|
return value;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
template <typename T>
|
|
|
|
|
constexpr u64 operator-(const T& oth) const {
|
|
|
|
|
return value - oth;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
template <typename T>
|
|
|
|
|
constexpr u64 operator&(const T& oth) const {
|
|
|
|
|
return value & oth;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
constexpr u64 operator&(const Register& oth) const {
|
|
|
|
|
return value & oth.value;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
constexpr u64 operator~() const {
|
|
|
|
|
return ~value;
|
|
|
|
|
}
|
|
|
|
|
|
2018-04-26 05:55:21 +02:00
|
|
|
|
u64 GetSwizzledIndex(u64 elem) const {
|
|
|
|
|
elem = (value + elem) & 3;
|
|
|
|
|
return (value & ~3) + elem;
|
|
|
|
|
}
|
|
|
|
|
|
2018-04-05 03:43:40 +02:00
|
|
|
|
private:
|
2018-04-18 00:06:10 +02:00
|
|
|
|
u64 value{};
|
2018-04-05 03:43:40 +02:00
|
|
|
|
};
|
|
|
|
|
|
2018-09-08 23:13:02 +02:00
|
|
|
|
enum class AttributeSize : u64 {
|
|
|
|
|
Word = 0,
|
|
|
|
|
DoubleWord = 1,
|
|
|
|
|
TripleWord = 2,
|
|
|
|
|
QuadWord = 3,
|
|
|
|
|
};
|
|
|
|
|
|
2018-04-05 03:43:40 +02:00
|
|
|
|
union Attribute {
|
2018-04-14 20:09:32 +02:00
|
|
|
|
Attribute() = default;
|
2018-04-05 03:43:40 +02:00
|
|
|
|
|
2018-04-18 00:06:10 +02:00
|
|
|
|
constexpr explicit Attribute(u64 value) : value(value) {}
|
2018-04-05 03:43:40 +02:00
|
|
|
|
|
|
|
|
|
enum class Index : u64 {
|
2019-07-08 01:36:42 +02:00
|
|
|
|
LayerViewportPointSize = 6,
|
2018-04-05 03:43:40 +02:00
|
|
|
|
Position = 7,
|
|
|
|
|
Attribute_0 = 8,
|
2018-08-10 18:34:51 +02:00
|
|
|
|
Attribute_31 = 39,
|
2020-03-16 01:00:51 +01:00
|
|
|
|
FrontColor = 40,
|
|
|
|
|
FrontSecondaryColor = 41,
|
|
|
|
|
BackColor = 42,
|
|
|
|
|
BackSecondaryColor = 43,
|
2018-11-23 05:57:49 +01:00
|
|
|
|
ClipDistances0123 = 44,
|
|
|
|
|
ClipDistances4567 = 45,
|
2018-09-05 05:09:24 +02:00
|
|
|
|
PointCoord = 46,
|
2018-05-30 17:58:03 +02:00
|
|
|
|
// This attribute contains a tuple of (~, ~, InstanceId, VertexId) when inside a vertex
|
|
|
|
|
// shader, and a tuple of (TessCoord.x, TessCoord.y, TessCoord.z, ~) when inside a Tess Eval
|
|
|
|
|
// shader.
|
|
|
|
|
TessCoordInstanceIDVertexID = 47,
|
2020-03-16 01:00:51 +01:00
|
|
|
|
TexCoord_0 = 48,
|
|
|
|
|
TexCoord_7 = 55,
|
2018-08-19 07:14:34 +02:00
|
|
|
|
// This attribute contains a tuple of (Unk, Unk, Unk, gl_FrontFacing) when inside a fragment
|
|
|
|
|
// shader. It is unknown what the other values contain.
|
|
|
|
|
FrontFacing = 63,
|
2018-04-05 03:43:40 +02:00
|
|
|
|
};
|
|
|
|
|
|
2018-04-10 05:39:44 +02:00
|
|
|
|
union {
|
2018-09-08 23:13:02 +02:00
|
|
|
|
BitField<20, 10, u64> immediate;
|
2018-04-10 05:39:44 +02:00
|
|
|
|
BitField<22, 2, u64> element;
|
|
|
|
|
BitField<24, 6, Index> index;
|
2019-11-01 04:34:38 +01:00
|
|
|
|
BitField<31, 1, u64> patch;
|
2018-09-08 23:13:02 +02:00
|
|
|
|
BitField<47, 3, AttributeSize> size;
|
2019-04-30 23:12:30 +02:00
|
|
|
|
|
|
|
|
|
bool IsPhysical() const {
|
2019-11-01 04:34:38 +01:00
|
|
|
|
return patch == 0 && element == 0 && static_cast<u64>(index.Value()) == 0;
|
2019-04-30 23:12:30 +02:00
|
|
|
|
}
|
2018-04-10 05:39:44 +02:00
|
|
|
|
} fmt20;
|
|
|
|
|
|
|
|
|
|
union {
|
|
|
|
|
BitField<30, 2, u64> element;
|
|
|
|
|
BitField<32, 6, Index> index;
|
|
|
|
|
} fmt28;
|
2018-04-05 03:43:40 +02:00
|
|
|
|
|
|
|
|
|
BitField<39, 8, u64> reg;
|
2018-04-18 00:06:10 +02:00
|
|
|
|
u64 value{};
|
2018-04-05 03:43:40 +02:00
|
|
|
|
};
|
|
|
|
|
|
2018-04-10 07:26:15 +02:00
|
|
|
|
union Sampler {
|
|
|
|
|
Sampler() = default;
|
|
|
|
|
|
2018-04-18 00:06:10 +02:00
|
|
|
|
constexpr explicit Sampler(u64 value) : value(value) {}
|
2018-04-10 07:26:15 +02:00
|
|
|
|
|
|
|
|
|
enum class Index : u64 {
|
|
|
|
|
Sampler_0 = 8,
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
BitField<36, 13, Index> index;
|
2018-04-18 00:06:10 +02:00
|
|
|
|
u64 value{};
|
2018-04-10 07:26:15 +02:00
|
|
|
|
};
|
|
|
|
|
|
2019-04-27 07:07:18 +02:00
|
|
|
|
union Image {
|
|
|
|
|
Image() = default;
|
|
|
|
|
|
|
|
|
|
constexpr explicit Image(u64 value) : value{value} {}
|
|
|
|
|
|
|
|
|
|
BitField<36, 13, u64> index;
|
|
|
|
|
u64 value;
|
|
|
|
|
};
|
|
|
|
|
|
2018-07-21 00:14:17 +02:00
|
|
|
|
} // namespace Tegra::Shader
|
2018-04-05 03:43:40 +02:00
|
|
|
|
|
|
|
|
|
namespace std {
|
|
|
|
|
|
2018-04-21 02:49:05 +02:00
|
|
|
|
// TODO(bunnei): The below is forbidden by the C++ standard, but works fine. See #330.
|
2018-04-05 03:43:40 +02:00
|
|
|
|
template <>
|
|
|
|
|
struct make_unsigned<Tegra::Shader::Attribute> {
|
|
|
|
|
using type = Tegra::Shader::Attribute;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
template <>
|
|
|
|
|
struct make_unsigned<Tegra::Shader::Register> {
|
|
|
|
|
using type = Tegra::Shader::Register;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
} // namespace std
|
|
|
|
|
|
2018-07-21 00:14:17 +02:00
|
|
|
|
namespace Tegra::Shader {
|
2018-04-05 03:43:40 +02:00
|
|
|
|
|
|
|
|
|
enum class Pred : u64 {
|
|
|
|
|
UnusedIndex = 0x7,
|
2018-04-20 16:09:50 +02:00
|
|
|
|
NeverExecute = 0xF,
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
enum class PredCondition : u64 {
|
|
|
|
|
LessThan = 1,
|
|
|
|
|
Equal = 2,
|
|
|
|
|
LessEqual = 3,
|
|
|
|
|
GreaterThan = 4,
|
|
|
|
|
NotEqual = 5,
|
|
|
|
|
GreaterEqual = 6,
|
2018-07-13 02:03:45 +02:00
|
|
|
|
LessThanWithNan = 9,
|
2018-11-23 17:51:32 +01:00
|
|
|
|
LessEqualWithNan = 11,
|
2018-08-18 09:49:59 +02:00
|
|
|
|
GreaterThanWithNan = 12,
|
2018-06-30 09:00:39 +02:00
|
|
|
|
NotEqualWithNan = 13,
|
2018-08-31 09:40:18 +02:00
|
|
|
|
GreaterEqualWithNan = 14,
|
2018-04-20 16:09:50 +02:00
|
|
|
|
// TODO(Subv): Other condition types
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
enum class PredOperation : u64 {
|
|
|
|
|
And = 0,
|
|
|
|
|
Or = 1,
|
|
|
|
|
Xor = 2,
|
2018-04-05 03:43:40 +02:00
|
|
|
|
};
|
|
|
|
|
|
2018-06-04 20:24:31 +02:00
|
|
|
|
enum class LogicOperation : u64 {
|
|
|
|
|
And = 0,
|
|
|
|
|
Or = 1,
|
|
|
|
|
Xor = 2,
|
|
|
|
|
PassB = 3,
|
|
|
|
|
};
|
|
|
|
|
|
2018-04-10 04:09:23 +02:00
|
|
|
|
enum class SubOp : u64 {
|
|
|
|
|
Cos = 0x0,
|
|
|
|
|
Sin = 0x1,
|
|
|
|
|
Ex2 = 0x2,
|
|
|
|
|
Lg2 = 0x3,
|
|
|
|
|
Rcp = 0x4,
|
|
|
|
|
Rsq = 0x5,
|
2018-07-03 02:48:15 +02:00
|
|
|
|
Sqrt = 0x8,
|
2018-04-10 04:09:23 +02:00
|
|
|
|
};
|
|
|
|
|
|
2018-06-07 04:21:29 +02:00
|
|
|
|
enum class F2iRoundingOp : u64 {
|
2019-02-11 23:46:45 +01:00
|
|
|
|
RoundEven = 0,
|
2018-06-05 01:05:12 +02:00
|
|
|
|
Floor = 1,
|
|
|
|
|
Ceil = 2,
|
|
|
|
|
Trunc = 3,
|
|
|
|
|
};
|
|
|
|
|
|
2018-06-07 04:21:29 +02:00
|
|
|
|
enum class F2fRoundingOp : u64 {
|
|
|
|
|
None = 0,
|
|
|
|
|
Pass = 3,
|
|
|
|
|
Round = 8,
|
|
|
|
|
Floor = 9,
|
|
|
|
|
Ceil = 10,
|
|
|
|
|
Trunc = 11,
|
|
|
|
|
};
|
|
|
|
|
|
2020-01-16 08:00:52 +01:00
|
|
|
|
enum class AtomicOp : u64 {
|
|
|
|
|
Add = 0,
|
|
|
|
|
Min = 1,
|
|
|
|
|
Max = 2,
|
|
|
|
|
Inc = 3,
|
|
|
|
|
Dec = 4,
|
|
|
|
|
And = 5,
|
|
|
|
|
Or = 6,
|
|
|
|
|
Xor = 7,
|
|
|
|
|
Exch = 8,
|
|
|
|
|
};
|
|
|
|
|
|
2020-01-26 01:03:02 +01:00
|
|
|
|
enum class GlobalAtomicOp : u64 {
|
|
|
|
|
Add = 0,
|
|
|
|
|
Min = 1,
|
|
|
|
|
Max = 2,
|
|
|
|
|
Inc = 3,
|
|
|
|
|
Dec = 4,
|
|
|
|
|
And = 5,
|
|
|
|
|
Or = 6,
|
|
|
|
|
Xor = 7,
|
|
|
|
|
Exch = 8,
|
|
|
|
|
SafeAdd = 10,
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
enum class GlobalAtomicType : u64 {
|
|
|
|
|
U32 = 0,
|
|
|
|
|
S32 = 1,
|
|
|
|
|
U64 = 2,
|
|
|
|
|
F32_FTZ_RN = 3,
|
|
|
|
|
F16x2_FTZ_RN = 4,
|
|
|
|
|
S64 = 5,
|
|
|
|
|
};
|
|
|
|
|
|
2018-06-06 05:46:23 +02:00
|
|
|
|
enum class UniformType : u64 {
|
|
|
|
|
UnsignedByte = 0,
|
|
|
|
|
SignedByte = 1,
|
|
|
|
|
UnsignedShort = 2,
|
|
|
|
|
SignedShort = 3,
|
|
|
|
|
Single = 4,
|
|
|
|
|
Double = 5,
|
2018-12-29 06:44:54 +01:00
|
|
|
|
Quad = 6,
|
|
|
|
|
UnsignedQuad = 7,
|
2018-06-06 05:46:23 +02:00
|
|
|
|
};
|
|
|
|
|
|
2018-10-20 03:48:21 +02:00
|
|
|
|
enum class StoreType : u64 {
|
|
|
|
|
Unsigned8 = 0,
|
|
|
|
|
Signed8 = 1,
|
|
|
|
|
Unsigned16 = 2,
|
|
|
|
|
Signed16 = 3,
|
2019-02-03 03:44:38 +01:00
|
|
|
|
Bits32 = 4,
|
|
|
|
|
Bits64 = 5,
|
|
|
|
|
Bits128 = 6,
|
2018-10-20 03:48:21 +02:00
|
|
|
|
};
|
|
|
|
|
|
2020-01-16 08:00:52 +01:00
|
|
|
|
enum class AtomicType : u64 {
|
|
|
|
|
U32 = 0,
|
|
|
|
|
S32 = 1,
|
|
|
|
|
U64 = 2,
|
|
|
|
|
S64 = 3,
|
|
|
|
|
};
|
|
|
|
|
|
2018-07-04 22:25:48 +02:00
|
|
|
|
enum class IMinMaxExchange : u64 {
|
|
|
|
|
None = 0,
|
|
|
|
|
XLo = 1,
|
|
|
|
|
XMed = 2,
|
|
|
|
|
XHi = 3,
|
|
|
|
|
};
|
|
|
|
|
|
2018-10-18 07:38:58 +02:00
|
|
|
|
enum class VideoType : u64 {
|
2018-10-11 08:56:14 +02:00
|
|
|
|
Size16_Low = 0,
|
|
|
|
|
Size16_High = 1,
|
|
|
|
|
Size32 = 2,
|
|
|
|
|
Invalid = 3,
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
enum class VmadShr : u64 {
|
|
|
|
|
Shr7 = 1,
|
|
|
|
|
Shr15 = 2,
|
|
|
|
|
};
|
|
|
|
|
|
2018-08-12 22:51:32 +02:00
|
|
|
|
enum class XmadMode : u64 {
|
|
|
|
|
None = 0,
|
|
|
|
|
CLo = 1,
|
|
|
|
|
CHi = 2,
|
|
|
|
|
CSfu = 3,
|
|
|
|
|
CBcc = 4,
|
|
|
|
|
};
|
|
|
|
|
|
2018-08-24 18:15:43 +02:00
|
|
|
|
enum class IAdd3Mode : u64 {
|
|
|
|
|
None = 0,
|
|
|
|
|
RightShift = 1,
|
|
|
|
|
LeftShift = 2,
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
enum class IAdd3Height : u64 {
|
|
|
|
|
None = 0,
|
|
|
|
|
LowerHalfWord = 1,
|
|
|
|
|
UpperHalfWord = 2,
|
|
|
|
|
};
|
|
|
|
|
|
2018-07-13 02:00:37 +02:00
|
|
|
|
enum class FlowCondition : u64 {
|
|
|
|
|
Always = 0xF,
|
|
|
|
|
Fcsm_Tr = 0x1C, // TODO(bunnei): What is this used for?
|
|
|
|
|
};
|
|
|
|
|
|
2018-11-22 02:06:01 +01:00
|
|
|
|
enum class ConditionCode : u64 {
|
2018-09-09 03:54:11 +02:00
|
|
|
|
F = 0,
|
|
|
|
|
LT = 1,
|
|
|
|
|
EQ = 2,
|
|
|
|
|
LE = 3,
|
|
|
|
|
GT = 4,
|
|
|
|
|
NE = 5,
|
|
|
|
|
GE = 6,
|
|
|
|
|
Num = 7,
|
|
|
|
|
Nan = 8,
|
|
|
|
|
LTU = 9,
|
|
|
|
|
EQU = 10,
|
|
|
|
|
LEU = 11,
|
|
|
|
|
GTU = 12,
|
|
|
|
|
NEU = 13,
|
|
|
|
|
GEU = 14,
|
2018-10-15 20:32:31 +02:00
|
|
|
|
T = 15,
|
2018-09-09 03:54:11 +02:00
|
|
|
|
OFF = 16,
|
|
|
|
|
LO = 17,
|
|
|
|
|
SFF = 18,
|
|
|
|
|
LS = 19,
|
|
|
|
|
HI = 20,
|
|
|
|
|
SFT = 21,
|
|
|
|
|
HS = 22,
|
|
|
|
|
OFT = 23,
|
|
|
|
|
CSM_TA = 24,
|
|
|
|
|
CSM_TR = 25,
|
|
|
|
|
CSM_MX = 26,
|
|
|
|
|
FCSM_TA = 27,
|
|
|
|
|
FCSM_TR = 28,
|
|
|
|
|
FCSM_MX = 29,
|
|
|
|
|
RLE = 30,
|
|
|
|
|
RGT = 31,
|
|
|
|
|
};
|
|
|
|
|
|
2018-08-18 21:36:37 +02:00
|
|
|
|
enum class PredicateResultMode : u64 {
|
|
|
|
|
None = 0x0,
|
|
|
|
|
NotZero = 0x3,
|
|
|
|
|
};
|
|
|
|
|
|
2018-08-19 19:46:35 +02:00
|
|
|
|
enum class TextureType : u64 {
|
|
|
|
|
Texture1D = 0,
|
|
|
|
|
Texture2D = 1,
|
|
|
|
|
Texture3D = 2,
|
|
|
|
|
TextureCube = 3,
|
|
|
|
|
};
|
|
|
|
|
|
2018-09-08 01:53:06 +02:00
|
|
|
|
enum class TextureQueryType : u64 {
|
|
|
|
|
Dimension = 1,
|
|
|
|
|
TextureType = 2,
|
|
|
|
|
SamplePosition = 5,
|
|
|
|
|
Filter = 16,
|
|
|
|
|
LevelOfDetail = 18,
|
|
|
|
|
Wrap = 20,
|
|
|
|
|
BorderColor = 22,
|
|
|
|
|
};
|
|
|
|
|
|
2018-09-08 03:09:39 +02:00
|
|
|
|
enum class TextureProcessMode : u64 {
|
|
|
|
|
None = 0,
|
2019-02-22 07:30:12 +01:00
|
|
|
|
LZ = 1, // Load LOD of zero.
|
2018-09-08 03:09:39 +02:00
|
|
|
|
LB = 2, // Load Bias.
|
2019-02-22 07:30:12 +01:00
|
|
|
|
LL = 3, // Load LOD.
|
|
|
|
|
LBA = 6, // Load Bias. The A is unknown, does not appear to differ with LB.
|
|
|
|
|
LLA = 7 // Load LOD. The A is unknown, does not appear to differ with LL.
|
2018-09-08 03:09:39 +02:00
|
|
|
|
};
|
|
|
|
|
|
2018-09-12 22:17:18 +02:00
|
|
|
|
enum class TextureMiscMode : u64 {
|
|
|
|
|
DC,
|
|
|
|
|
AOFFI, // Uses Offset
|
|
|
|
|
NDV,
|
|
|
|
|
NODEP,
|
|
|
|
|
MZ,
|
|
|
|
|
PTP,
|
|
|
|
|
};
|
|
|
|
|
|
2019-04-27 07:07:18 +02:00
|
|
|
|
enum class SurfaceDataMode : u64 {
|
|
|
|
|
P = 0,
|
|
|
|
|
D_BA = 1,
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
enum class OutOfBoundsStore : u64 {
|
|
|
|
|
Ignore = 0,
|
|
|
|
|
Clamp = 1,
|
|
|
|
|
Trap = 2,
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
enum class ImageType : u64 {
|
|
|
|
|
Texture1D = 0,
|
|
|
|
|
TextureBuffer = 1,
|
|
|
|
|
Texture1DArray = 2,
|
|
|
|
|
Texture2D = 3,
|
|
|
|
|
Texture2DArray = 4,
|
|
|
|
|
Texture3D = 5,
|
|
|
|
|
};
|
|
|
|
|
|
2018-10-07 04:17:31 +02:00
|
|
|
|
enum class IsberdMode : u64 {
|
|
|
|
|
None = 0,
|
|
|
|
|
Patch = 1,
|
|
|
|
|
Prim = 2,
|
|
|
|
|
Attr = 3,
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
enum class IsberdShift : u64 { None = 0, U16 = 1, B32 = 2 };
|
|
|
|
|
|
2019-12-10 01:46:12 +01:00
|
|
|
|
enum class MembarType : u64 {
|
|
|
|
|
CTA = 0,
|
|
|
|
|
GL = 1,
|
|
|
|
|
SYS = 2,
|
|
|
|
|
VC = 3,
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
enum class MembarUnknown : u64 { Default = 0, IVALLD = 1, IVALLT = 2, IVALLTD = 3 };
|
|
|
|
|
|
2018-10-15 06:58:30 +02:00
|
|
|
|
enum class HalfType : u64 {
|
|
|
|
|
H0_H1 = 0,
|
|
|
|
|
F32 = 1,
|
|
|
|
|
H0_H0 = 2,
|
|
|
|
|
H1_H1 = 3,
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
enum class HalfMerge : u64 {
|
|
|
|
|
H0_H1 = 0,
|
|
|
|
|
F32 = 1,
|
|
|
|
|
Mrg_H0 = 2,
|
|
|
|
|
Mrg_H1 = 3,
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
enum class HalfPrecision : u64 {
|
|
|
|
|
None = 0,
|
|
|
|
|
FTZ = 1,
|
|
|
|
|
FMZ = 2,
|
|
|
|
|
};
|
|
|
|
|
|
2018-11-21 08:36:44 +01:00
|
|
|
|
enum class R2pMode : u64 {
|
|
|
|
|
Pr = 0,
|
|
|
|
|
Cc = 1,
|
|
|
|
|
};
|
|
|
|
|
|
2018-09-21 22:15:29 +02:00
|
|
|
|
enum class IpaInterpMode : u64 {
|
2019-02-13 02:14:39 +01:00
|
|
|
|
Pass = 0,
|
|
|
|
|
Multiply = 1,
|
|
|
|
|
Constant = 2,
|
2018-09-21 22:15:29 +02:00
|
|
|
|
Sc = 3,
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
enum class IpaSampleMode : u64 {
|
|
|
|
|
Default = 0,
|
|
|
|
|
Centroid = 1,
|
|
|
|
|
Offset = 2,
|
|
|
|
|
};
|
2018-08-29 06:37:29 +02:00
|
|
|
|
|
2019-04-02 04:18:13 +02:00
|
|
|
|
enum class LmemLoadCacheManagement : u64 {
|
|
|
|
|
Default = 0,
|
|
|
|
|
LU = 1,
|
|
|
|
|
CI = 2,
|
|
|
|
|
CV = 3,
|
|
|
|
|
};
|
|
|
|
|
|
2019-04-27 07:07:18 +02:00
|
|
|
|
enum class StoreCacheManagement : u64 {
|
2019-04-02 04:03:32 +02:00
|
|
|
|
Default = 0,
|
|
|
|
|
CG = 1,
|
|
|
|
|
CS = 2,
|
|
|
|
|
WT = 3,
|
|
|
|
|
};
|
|
|
|
|
|
2018-09-05 05:09:24 +02:00
|
|
|
|
struct IpaMode {
|
|
|
|
|
IpaInterpMode interpolation_mode;
|
|
|
|
|
IpaSampleMode sampling_mode;
|
2018-09-21 22:14:15 +02:00
|
|
|
|
|
|
|
|
|
bool operator==(const IpaMode& a) const {
|
|
|
|
|
return std::tie(interpolation_mode, sampling_mode) ==
|
|
|
|
|
std::tie(a.interpolation_mode, a.sampling_mode);
|
2018-09-05 05:09:24 +02:00
|
|
|
|
}
|
2018-09-21 22:14:15 +02:00
|
|
|
|
bool operator!=(const IpaMode& a) const {
|
|
|
|
|
return !operator==(a);
|
2018-09-05 05:09:24 +02:00
|
|
|
|
}
|
2018-12-20 23:09:21 +01:00
|
|
|
|
bool operator<(const IpaMode& a) const {
|
|
|
|
|
return std::tie(interpolation_mode, sampling_mode) <
|
|
|
|
|
std::tie(a.interpolation_mode, a.sampling_mode);
|
|
|
|
|
}
|
2018-09-05 05:09:24 +02:00
|
|
|
|
};
|
|
|
|
|
|
2018-10-07 04:17:31 +02:00
|
|
|
|
enum class SystemVariable : u64 {
|
|
|
|
|
LaneId = 0x00,
|
|
|
|
|
VirtCfg = 0x02,
|
|
|
|
|
VirtId = 0x03,
|
|
|
|
|
Pm0 = 0x04,
|
|
|
|
|
Pm1 = 0x05,
|
|
|
|
|
Pm2 = 0x06,
|
|
|
|
|
Pm3 = 0x07,
|
|
|
|
|
Pm4 = 0x08,
|
|
|
|
|
Pm5 = 0x09,
|
|
|
|
|
Pm6 = 0x0a,
|
|
|
|
|
Pm7 = 0x0b,
|
|
|
|
|
OrderingTicket = 0x0f,
|
|
|
|
|
PrimType = 0x10,
|
|
|
|
|
InvocationId = 0x11,
|
|
|
|
|
Ydirection = 0x12,
|
|
|
|
|
ThreadKill = 0x13,
|
|
|
|
|
ShaderType = 0x14,
|
|
|
|
|
DirectBeWriteAddressLow = 0x15,
|
|
|
|
|
DirectBeWriteAddressHigh = 0x16,
|
|
|
|
|
DirectBeWriteEnabled = 0x17,
|
|
|
|
|
MachineId0 = 0x18,
|
|
|
|
|
MachineId1 = 0x19,
|
|
|
|
|
MachineId2 = 0x1a,
|
|
|
|
|
MachineId3 = 0x1b,
|
|
|
|
|
Affinity = 0x1c,
|
|
|
|
|
InvocationInfo = 0x1d,
|
|
|
|
|
WscaleFactorXY = 0x1e,
|
|
|
|
|
WscaleFactorZ = 0x1f,
|
|
|
|
|
Tid = 0x20,
|
|
|
|
|
TidX = 0x21,
|
|
|
|
|
TidY = 0x22,
|
|
|
|
|
TidZ = 0x23,
|
|
|
|
|
CtaParam = 0x24,
|
|
|
|
|
CtaIdX = 0x25,
|
|
|
|
|
CtaIdY = 0x26,
|
|
|
|
|
CtaIdZ = 0x27,
|
|
|
|
|
NtId = 0x28,
|
|
|
|
|
CirQueueIncrMinusOne = 0x29,
|
|
|
|
|
Nlatc = 0x2a,
|
|
|
|
|
SmSpaVersion = 0x2c,
|
|
|
|
|
MultiPassShaderInfo = 0x2d,
|
|
|
|
|
LwinHi = 0x2e,
|
|
|
|
|
SwinHi = 0x2f,
|
|
|
|
|
SwinLo = 0x30,
|
|
|
|
|
SwinSz = 0x31,
|
|
|
|
|
SmemSz = 0x32,
|
|
|
|
|
SmemBanks = 0x33,
|
|
|
|
|
LwinLo = 0x34,
|
|
|
|
|
LwinSz = 0x35,
|
|
|
|
|
LmemLosz = 0x36,
|
|
|
|
|
LmemHioff = 0x37,
|
|
|
|
|
EqMask = 0x38,
|
|
|
|
|
LtMask = 0x39,
|
|
|
|
|
LeMask = 0x3a,
|
|
|
|
|
GtMask = 0x3b,
|
|
|
|
|
GeMask = 0x3c,
|
|
|
|
|
RegAlloc = 0x3d,
|
|
|
|
|
CtxAddr = 0x3e, // .fmask = F_SM50
|
|
|
|
|
BarrierAlloc = 0x3e, // .fmask = F_SM60
|
|
|
|
|
GlobalErrorStatus = 0x40,
|
|
|
|
|
WarpErrorStatus = 0x42,
|
|
|
|
|
WarpErrorStatusClear = 0x43,
|
|
|
|
|
PmHi0 = 0x48,
|
|
|
|
|
PmHi1 = 0x49,
|
|
|
|
|
PmHi2 = 0x4a,
|
|
|
|
|
PmHi3 = 0x4b,
|
|
|
|
|
PmHi4 = 0x4c,
|
|
|
|
|
PmHi5 = 0x4d,
|
|
|
|
|
PmHi6 = 0x4e,
|
|
|
|
|
PmHi7 = 0x4f,
|
|
|
|
|
ClockLo = 0x50,
|
|
|
|
|
ClockHi = 0x51,
|
|
|
|
|
GlobalTimerLo = 0x52,
|
|
|
|
|
GlobalTimerHi = 0x53,
|
|
|
|
|
HwTaskId = 0x60,
|
|
|
|
|
CircularQueueEntryIndex = 0x61,
|
|
|
|
|
CircularQueueEntryAddressLow = 0x62,
|
|
|
|
|
CircularQueueEntryAddressHigh = 0x63,
|
|
|
|
|
};
|
|
|
|
|
|
2019-04-30 04:27:15 +02:00
|
|
|
|
enum class PhysicalAttributeDirection : u64 {
|
|
|
|
|
Input = 0,
|
|
|
|
|
Output = 1,
|
|
|
|
|
};
|
|
|
|
|
|
2019-08-10 04:50:21 +02:00
|
|
|
|
enum class VoteOperation : u64 {
|
|
|
|
|
All = 0, // allThreadsNV
|
|
|
|
|
Any = 1, // anyThreadNV
|
|
|
|
|
Eq = 2, // allThreadsEqualNV
|
|
|
|
|
};
|
|
|
|
|
|
2019-09-18 06:50:40 +02:00
|
|
|
|
enum class ImageAtomicOperationType : u64 {
|
2019-07-18 02:03:53 +02:00
|
|
|
|
U32 = 0,
|
|
|
|
|
S32 = 1,
|
|
|
|
|
U64 = 2,
|
|
|
|
|
F32 = 3,
|
|
|
|
|
S64 = 5,
|
|
|
|
|
SD32 = 6,
|
|
|
|
|
SD64 = 7,
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
enum class ImageAtomicOperation : u64 {
|
|
|
|
|
Add = 0,
|
|
|
|
|
Min = 1,
|
|
|
|
|
Max = 2,
|
|
|
|
|
Inc = 3,
|
|
|
|
|
Dec = 4,
|
|
|
|
|
And = 5,
|
|
|
|
|
Or = 6,
|
|
|
|
|
Xor = 7,
|
|
|
|
|
Exch = 8,
|
|
|
|
|
};
|
|
|
|
|
|
2019-08-27 03:09:12 +02:00
|
|
|
|
enum class ShuffleOperation : u64 {
|
|
|
|
|
Idx = 0, // shuffleNV
|
|
|
|
|
Up = 1, // shuffleUpNV
|
|
|
|
|
Down = 2, // shuffleDownNV
|
|
|
|
|
Bfly = 3, // shuffleXorNV
|
|
|
|
|
};
|
|
|
|
|
|
2020-02-01 06:57:01 +01:00
|
|
|
|
enum class ShfType : u64 {
|
|
|
|
|
Bits32 = 0,
|
|
|
|
|
U64 = 2,
|
|
|
|
|
S64 = 3,
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
enum class ShfXmode : u64 {
|
|
|
|
|
None = 0,
|
|
|
|
|
HI = 1,
|
|
|
|
|
X = 2,
|
|
|
|
|
XHI = 3,
|
|
|
|
|
};
|
|
|
|
|
|
2018-04-05 03:43:40 +02:00
|
|
|
|
union Instruction {
|
2019-10-24 06:57:19 +02:00
|
|
|
|
constexpr Instruction& operator=(const Instruction& instr) {
|
2018-04-21 02:49:05 +02:00
|
|
|
|
value = instr.value;
|
2018-04-05 03:43:40 +02:00
|
|
|
|
return *this;
|
|
|
|
|
}
|
|
|
|
|
|
2018-04-21 02:49:05 +02:00
|
|
|
|
constexpr Instruction(u64 value) : value{value} {}
|
|
|
|
|
|
2018-04-10 05:39:44 +02:00
|
|
|
|
BitField<0, 8, Register> gpr0;
|
|
|
|
|
BitField<8, 8, Register> gpr8;
|
2018-04-20 16:16:55 +02:00
|
|
|
|
union {
|
|
|
|
|
BitField<16, 4, Pred> full_pred;
|
|
|
|
|
BitField<16, 3, u64> pred_index;
|
|
|
|
|
} pred;
|
|
|
|
|
BitField<19, 1, u64> negate_pred;
|
2018-04-10 05:39:44 +02:00
|
|
|
|
BitField<20, 8, Register> gpr20;
|
2018-06-30 21:48:25 +02:00
|
|
|
|
BitField<20, 4, SubOp> sub_op;
|
2018-04-10 05:39:44 +02:00
|
|
|
|
BitField<28, 8, Register> gpr28;
|
|
|
|
|
BitField<39, 8, Register> gpr39;
|
2018-04-21 02:49:05 +02:00
|
|
|
|
BitField<48, 16, u64> opcode;
|
2018-04-10 05:39:44 +02:00
|
|
|
|
|
2019-07-30 02:18:30 +02:00
|
|
|
|
union {
|
|
|
|
|
BitField<8, 5, ConditionCode> cc;
|
|
|
|
|
BitField<13, 1, u64> trigger;
|
|
|
|
|
} nop;
|
|
|
|
|
|
2019-08-10 04:50:21 +02:00
|
|
|
|
union {
|
|
|
|
|
BitField<48, 2, VoteOperation> operation;
|
|
|
|
|
BitField<45, 3, u64> dest_pred;
|
|
|
|
|
BitField<39, 3, u64> value;
|
|
|
|
|
BitField<42, 1, u64> negate_value;
|
|
|
|
|
} vote;
|
|
|
|
|
|
2019-08-27 03:09:12 +02:00
|
|
|
|
union {
|
|
|
|
|
BitField<30, 2, ShuffleOperation> operation;
|
|
|
|
|
BitField<48, 3, u64> pred48;
|
|
|
|
|
BitField<28, 1, u64> is_index_imm;
|
|
|
|
|
BitField<29, 1, u64> is_mask_imm;
|
|
|
|
|
BitField<20, 5, u64> index_imm;
|
|
|
|
|
BitField<34, 13, u64> mask_imm;
|
|
|
|
|
} shfl;
|
|
|
|
|
|
2019-11-03 03:44:46 +01:00
|
|
|
|
union {
|
|
|
|
|
BitField<44, 1, u64> ftz;
|
|
|
|
|
BitField<39, 2, u64> tab5cb8_2;
|
|
|
|
|
BitField<38, 1, u64> ndv;
|
|
|
|
|
BitField<47, 1, u64> cc;
|
|
|
|
|
BitField<28, 8, u64> swizzle;
|
|
|
|
|
} fswzadd;
|
|
|
|
|
|
2019-05-18 07:35:01 +02:00
|
|
|
|
union {
|
|
|
|
|
BitField<8, 8, Register> gpr;
|
|
|
|
|
BitField<20, 24, s64> offset;
|
|
|
|
|
} gmem;
|
|
|
|
|
|
2018-04-10 05:39:44 +02:00
|
|
|
|
union {
|
2018-10-11 08:56:14 +02:00
|
|
|
|
BitField<20, 16, u64> imm20_16;
|
2018-04-19 20:34:50 +02:00
|
|
|
|
BitField<20, 19, u64> imm20_19;
|
2018-06-12 18:24:10 +02:00
|
|
|
|
BitField<20, 32, s64> imm20_32;
|
2018-04-10 05:39:44 +02:00
|
|
|
|
BitField<45, 1, u64> negate_b;
|
|
|
|
|
BitField<46, 1, u64> abs_a;
|
|
|
|
|
BitField<48, 1, u64> negate_a;
|
|
|
|
|
BitField<49, 1, u64> abs_b;
|
2018-06-09 08:36:33 +02:00
|
|
|
|
BitField<50, 1, u64> saturate_d;
|
2018-04-16 02:45:56 +02:00
|
|
|
|
BitField<56, 1, u64> negate_imm;
|
|
|
|
|
|
2018-05-21 00:53:06 +02:00
|
|
|
|
union {
|
|
|
|
|
BitField<39, 3, u64> pred;
|
|
|
|
|
BitField<42, 1, u64> negate_pred;
|
|
|
|
|
} fmnmx;
|
|
|
|
|
|
2018-06-17 19:26:11 +02:00
|
|
|
|
union {
|
|
|
|
|
BitField<39, 1, u64> invert_a;
|
|
|
|
|
BitField<40, 1, u64> invert_b;
|
|
|
|
|
BitField<41, 2, LogicOperation> operation;
|
2018-08-18 21:36:37 +02:00
|
|
|
|
BitField<44, 2, PredicateResultMode> pred_result_mode;
|
2018-06-17 19:26:11 +02:00
|
|
|
|
BitField<48, 3, Pred> pred48;
|
|
|
|
|
} lop;
|
|
|
|
|
|
2018-06-04 20:24:31 +02:00
|
|
|
|
union {
|
|
|
|
|
BitField<53, 2, LogicOperation> operation;
|
|
|
|
|
BitField<55, 1, u64> invert_a;
|
|
|
|
|
BitField<56, 1, u64> invert_b;
|
2018-06-17 18:49:34 +02:00
|
|
|
|
} lop32i;
|
2018-06-04 20:24:31 +02:00
|
|
|
|
|
2018-08-22 09:02:18 +02:00
|
|
|
|
union {
|
|
|
|
|
BitField<28, 8, u64> imm_lut28;
|
|
|
|
|
BitField<48, 8, u64> imm_lut48;
|
|
|
|
|
|
|
|
|
|
u32 GetImmLut28() const {
|
|
|
|
|
return static_cast<u32>(imm_lut28);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
u32 GetImmLut48() const {
|
|
|
|
|
return static_cast<u32>(imm_lut48);
|
|
|
|
|
}
|
|
|
|
|
} lop3;
|
|
|
|
|
|
2018-10-11 08:56:14 +02:00
|
|
|
|
u16 GetImm20_16() const {
|
|
|
|
|
return static_cast<u16>(imm20_16);
|
|
|
|
|
}
|
|
|
|
|
|
2018-08-08 07:27:12 +02:00
|
|
|
|
u32 GetImm20_19() const {
|
2018-04-19 20:34:50 +02:00
|
|
|
|
u32 imm{static_cast<u32>(imm20_19)};
|
2018-04-16 02:45:56 +02:00
|
|
|
|
imm <<= 12;
|
|
|
|
|
imm |= negate_imm ? 0x80000000 : 0;
|
2018-08-08 07:27:12 +02:00
|
|
|
|
return imm;
|
2018-04-16 02:45:56 +02:00
|
|
|
|
}
|
2018-04-19 20:34:50 +02:00
|
|
|
|
|
2018-08-08 07:27:12 +02:00
|
|
|
|
u32 GetImm20_32() const {
|
|
|
|
|
return static_cast<u32>(imm20_32);
|
2018-04-19 20:34:50 +02:00
|
|
|
|
}
|
2018-06-05 02:03:47 +02:00
|
|
|
|
|
2018-06-05 04:15:19 +02:00
|
|
|
|
s32 GetSignedImm20_20() const {
|
|
|
|
|
u32 immediate = static_cast<u32>(imm20_19 | (negate_imm << 19));
|
2018-06-05 02:03:47 +02:00
|
|
|
|
// Sign extend the 20-bit value.
|
|
|
|
|
u32 mask = 1U << (20 - 1);
|
|
|
|
|
return static_cast<s32>((immediate ^ mask) - mask);
|
|
|
|
|
}
|
2018-06-05 04:15:19 +02:00
|
|
|
|
} alu;
|
2018-06-05 02:03:47 +02:00
|
|
|
|
|
2018-08-29 06:37:29 +02:00
|
|
|
|
union {
|
2019-05-03 02:45:53 +02:00
|
|
|
|
BitField<38, 1, u64> idx;
|
2018-09-01 08:34:27 +02:00
|
|
|
|
BitField<51, 1, u64> saturate;
|
|
|
|
|
BitField<52, 2, IpaSampleMode> sample_mode;
|
|
|
|
|
BitField<54, 2, IpaInterpMode> interp_mode;
|
2018-08-29 06:37:29 +02:00
|
|
|
|
} ipa;
|
|
|
|
|
|
2018-06-09 06:01:17 +02:00
|
|
|
|
union {
|
2018-09-01 11:05:10 +02:00
|
|
|
|
BitField<39, 2, u64> tab5cb8_2;
|
2018-12-15 02:10:14 +01:00
|
|
|
|
BitField<41, 3, u64> postfactor;
|
2018-09-01 11:05:10 +02:00
|
|
|
|
BitField<44, 2, u64> tab5c68_0;
|
2018-08-16 16:05:16 +02:00
|
|
|
|
BitField<48, 1, u64> negate_b;
|
|
|
|
|
} fmul;
|
|
|
|
|
|
2018-10-23 02:17:04 +02:00
|
|
|
|
union {
|
|
|
|
|
BitField<55, 1, u64> saturate;
|
|
|
|
|
} fmul32;
|
|
|
|
|
|
2018-10-19 22:54:13 +02:00
|
|
|
|
union {
|
|
|
|
|
BitField<52, 1, u64> generates_cc;
|
|
|
|
|
} op_32;
|
|
|
|
|
|
2018-06-09 06:01:17 +02:00
|
|
|
|
union {
|
|
|
|
|
BitField<48, 1, u64> is_signed;
|
|
|
|
|
} shift;
|
|
|
|
|
|
2019-08-31 22:06:00 +02:00
|
|
|
|
union {
|
|
|
|
|
BitField<39, 1, u64> wrap;
|
|
|
|
|
} shr;
|
|
|
|
|
|
2020-02-01 06:57:01 +01:00
|
|
|
|
union {
|
|
|
|
|
BitField<37, 2, ShfType> type;
|
|
|
|
|
BitField<48, 2, ShfXmode> xmode;
|
|
|
|
|
BitField<50, 1, u64> wrap;
|
|
|
|
|
BitField<20, 6, u64> immediate;
|
|
|
|
|
} shf;
|
|
|
|
|
|
2018-06-05 04:15:19 +02:00
|
|
|
|
union {
|
|
|
|
|
BitField<39, 5, u64> shift_amount;
|
|
|
|
|
BitField<48, 1, u64> negate_b;
|
|
|
|
|
BitField<49, 1, u64> negate_a;
|
2018-06-09 05:25:22 +02:00
|
|
|
|
} alu_integer;
|
2018-06-05 02:03:47 +02:00
|
|
|
|
|
2018-10-15 07:04:31 +02:00
|
|
|
|
union {
|
|
|
|
|
BitField<39, 1, u64> ftz;
|
|
|
|
|
BitField<32, 1, u64> saturate;
|
|
|
|
|
BitField<49, 2, HalfMerge> merge;
|
|
|
|
|
|
|
|
|
|
BitField<43, 1, u64> negate_a;
|
|
|
|
|
BitField<44, 1, u64> abs_a;
|
|
|
|
|
BitField<47, 2, HalfType> type_a;
|
|
|
|
|
|
|
|
|
|
BitField<31, 1, u64> negate_b;
|
|
|
|
|
BitField<30, 1, u64> abs_b;
|
2018-12-21 23:10:45 +01:00
|
|
|
|
BitField<28, 2, HalfType> type_b;
|
2018-10-15 07:04:31 +02:00
|
|
|
|
|
|
|
|
|
BitField<35, 2, HalfType> type_c;
|
|
|
|
|
} alu_half;
|
|
|
|
|
|
2018-10-15 07:07:16 +02:00
|
|
|
|
union {
|
|
|
|
|
BitField<39, 2, HalfPrecision> precision;
|
|
|
|
|
BitField<39, 1, u64> ftz;
|
|
|
|
|
BitField<52, 1, u64> saturate;
|
|
|
|
|
BitField<49, 2, HalfMerge> merge;
|
|
|
|
|
|
|
|
|
|
BitField<43, 1, u64> negate_a;
|
|
|
|
|
BitField<44, 1, u64> abs_a;
|
|
|
|
|
BitField<47, 2, HalfType> type_a;
|
|
|
|
|
} alu_half_imm;
|
|
|
|
|
|
|
|
|
|
union {
|
|
|
|
|
BitField<29, 1, u64> first_negate;
|
|
|
|
|
BitField<20, 9, u64> first;
|
|
|
|
|
|
|
|
|
|
BitField<56, 1, u64> second_negate;
|
|
|
|
|
BitField<30, 9, u64> second;
|
|
|
|
|
|
|
|
|
|
u32 PackImmediates() const {
|
|
|
|
|
// Immediates are half floats shifted.
|
|
|
|
|
constexpr u32 imm_shift = 6;
|
|
|
|
|
return static_cast<u32>((first << imm_shift) | (second << (16 + imm_shift)));
|
|
|
|
|
}
|
|
|
|
|
} half_imm;
|
|
|
|
|
|
2018-10-15 07:08:31 +02:00
|
|
|
|
union {
|
|
|
|
|
union {
|
|
|
|
|
BitField<37, 2, HalfPrecision> precision;
|
|
|
|
|
BitField<32, 1, u64> saturate;
|
|
|
|
|
|
2018-12-23 06:26:35 +01:00
|
|
|
|
BitField<31, 1, u64> negate_b;
|
2018-10-15 07:08:31 +02:00
|
|
|
|
BitField<30, 1, u64> negate_c;
|
|
|
|
|
BitField<35, 2, HalfType> type_c;
|
|
|
|
|
} rr;
|
|
|
|
|
|
|
|
|
|
BitField<57, 2, HalfPrecision> precision;
|
|
|
|
|
BitField<52, 1, u64> saturate;
|
|
|
|
|
|
|
|
|
|
BitField<49, 2, HalfMerge> merge;
|
|
|
|
|
|
|
|
|
|
BitField<47, 2, HalfType> type_a;
|
|
|
|
|
|
|
|
|
|
BitField<56, 1, u64> negate_b;
|
|
|
|
|
BitField<28, 2, HalfType> type_b;
|
|
|
|
|
|
|
|
|
|
BitField<51, 1, u64> negate_c;
|
|
|
|
|
BitField<53, 2, HalfType> type_reg39;
|
|
|
|
|
} hfma2;
|
|
|
|
|
|
2018-08-31 03:32:58 +02:00
|
|
|
|
union {
|
|
|
|
|
BitField<40, 1, u64> invert;
|
|
|
|
|
} popc;
|
|
|
|
|
|
2019-11-12 15:07:22 +01:00
|
|
|
|
union {
|
|
|
|
|
BitField<41, 1, u64> sh;
|
|
|
|
|
BitField<40, 1, u64> invert;
|
|
|
|
|
BitField<48, 1, u64> is_signed;
|
|
|
|
|
} flo;
|
|
|
|
|
|
2018-07-22 06:37:12 +02:00
|
|
|
|
union {
|
|
|
|
|
BitField<39, 3, u64> pred;
|
|
|
|
|
BitField<42, 1, u64> neg_pred;
|
|
|
|
|
} sel;
|
|
|
|
|
|
2018-07-04 22:25:48 +02:00
|
|
|
|
union {
|
|
|
|
|
BitField<39, 3, u64> pred;
|
|
|
|
|
BitField<42, 1, u64> negate_pred;
|
|
|
|
|
BitField<43, 2, IMinMaxExchange> exchange;
|
|
|
|
|
BitField<48, 1, u64> is_signed;
|
|
|
|
|
} imnmx;
|
|
|
|
|
|
2018-08-24 18:15:43 +02:00
|
|
|
|
union {
|
|
|
|
|
BitField<31, 2, IAdd3Height> height_c;
|
|
|
|
|
BitField<33, 2, IAdd3Height> height_b;
|
|
|
|
|
BitField<35, 2, IAdd3Height> height_a;
|
|
|
|
|
BitField<37, 2, IAdd3Mode> mode;
|
|
|
|
|
BitField<49, 1, u64> neg_c;
|
|
|
|
|
BitField<50, 1, u64> neg_b;
|
|
|
|
|
BitField<51, 1, u64> neg_a;
|
|
|
|
|
} iadd3;
|
|
|
|
|
|
2018-06-12 18:24:10 +02:00
|
|
|
|
union {
|
|
|
|
|
BitField<54, 1, u64> saturate;
|
|
|
|
|
BitField<56, 1, u64> negate_a;
|
|
|
|
|
} iadd32i;
|
|
|
|
|
|
2018-07-12 19:00:31 +02:00
|
|
|
|
union {
|
|
|
|
|
BitField<53, 1, u64> negate_b;
|
|
|
|
|
BitField<54, 1, u64> abs_a;
|
|
|
|
|
BitField<56, 1, u64> negate_a;
|
|
|
|
|
BitField<57, 1, u64> abs_b;
|
|
|
|
|
} fadd32i;
|
|
|
|
|
|
2018-06-07 06:58:12 +02:00
|
|
|
|
union {
|
2020-03-13 06:52:16 +01:00
|
|
|
|
BitField<40, 1, u64> brev;
|
|
|
|
|
BitField<47, 1, u64> rd_cc;
|
|
|
|
|
BitField<48, 1, u64> is_signed;
|
2018-06-07 06:58:12 +02:00
|
|
|
|
} bfe;
|
|
|
|
|
|
2018-09-11 18:26:42 +02:00
|
|
|
|
union {
|
|
|
|
|
BitField<48, 3, u64> pred48;
|
|
|
|
|
|
|
|
|
|
union {
|
|
|
|
|
BitField<20, 20, u64> entry_a;
|
|
|
|
|
BitField<39, 5, u64> entry_b;
|
|
|
|
|
BitField<45, 1, u64> neg;
|
|
|
|
|
BitField<46, 1, u64> uses_cc;
|
|
|
|
|
} imm;
|
|
|
|
|
|
|
|
|
|
union {
|
|
|
|
|
BitField<20, 14, u64> cb_index;
|
|
|
|
|
BitField<34, 5, u64> cb_offset;
|
|
|
|
|
BitField<56, 1, u64> neg;
|
|
|
|
|
BitField<57, 1, u64> uses_cc;
|
|
|
|
|
} hi;
|
|
|
|
|
|
|
|
|
|
union {
|
|
|
|
|
BitField<20, 14, u64> cb_index;
|
|
|
|
|
BitField<34, 5, u64> cb_offset;
|
|
|
|
|
BitField<39, 5, u64> entry_a;
|
|
|
|
|
BitField<45, 1, u64> neg;
|
|
|
|
|
BitField<46, 1, u64> uses_cc;
|
|
|
|
|
} rz;
|
|
|
|
|
|
|
|
|
|
union {
|
|
|
|
|
BitField<39, 5, u64> entry_a;
|
|
|
|
|
BitField<45, 1, u64> neg;
|
|
|
|
|
BitField<46, 1, u64> uses_cc;
|
|
|
|
|
} r1;
|
|
|
|
|
|
|
|
|
|
union {
|
|
|
|
|
BitField<28, 8, u64> entry_a;
|
|
|
|
|
BitField<37, 1, u64> neg;
|
|
|
|
|
BitField<38, 1, u64> uses_cc;
|
|
|
|
|
} r2;
|
|
|
|
|
|
|
|
|
|
} lea;
|
|
|
|
|
|
2018-07-13 02:00:37 +02:00
|
|
|
|
union {
|
|
|
|
|
BitField<0, 5, FlowCondition> cond;
|
|
|
|
|
} flow;
|
|
|
|
|
|
2018-04-10 05:39:44 +02:00
|
|
|
|
union {
|
2018-09-01 10:45:14 +02:00
|
|
|
|
BitField<47, 1, u64> cc;
|
2018-04-10 05:39:44 +02:00
|
|
|
|
BitField<48, 1, u64> negate_b;
|
|
|
|
|
BitField<49, 1, u64> negate_c;
|
2018-09-01 10:45:14 +02:00
|
|
|
|
BitField<51, 2, u64> tab5980_1;
|
|
|
|
|
BitField<53, 2, u64> tab5980_0;
|
2018-04-10 05:39:44 +02:00
|
|
|
|
} ffma;
|
|
|
|
|
|
2018-06-06 05:46:23 +02:00
|
|
|
|
union {
|
|
|
|
|
BitField<48, 3, UniformType> type;
|
|
|
|
|
BitField<44, 2, u64> unknown;
|
|
|
|
|
} ld_c;
|
|
|
|
|
|
2018-10-20 03:48:21 +02:00
|
|
|
|
union {
|
|
|
|
|
BitField<48, 3, StoreType> type;
|
|
|
|
|
} ldst_sl;
|
|
|
|
|
|
|
|
|
|
union {
|
|
|
|
|
BitField<44, 2, u64> unknown;
|
|
|
|
|
} ld_l;
|
|
|
|
|
|
|
|
|
|
union {
|
2019-04-27 07:07:18 +02:00
|
|
|
|
BitField<44, 2, StoreCacheManagement> cache_management;
|
2018-10-20 03:48:21 +02:00
|
|
|
|
} st_l;
|
|
|
|
|
|
2018-12-29 06:44:54 +01:00
|
|
|
|
union {
|
|
|
|
|
BitField<48, 3, UniformType> type;
|
|
|
|
|
BitField<46, 2, u64> cache_mode;
|
|
|
|
|
} ldg;
|
|
|
|
|
|
2019-02-07 04:05:41 +01:00
|
|
|
|
union {
|
|
|
|
|
BitField<48, 3, UniformType> type;
|
|
|
|
|
BitField<46, 2, u64> cache_mode;
|
|
|
|
|
} stg;
|
|
|
|
|
|
2020-01-26 01:03:02 +01:00
|
|
|
|
union {
|
|
|
|
|
BitField<52, 4, GlobalAtomicOp> operation;
|
|
|
|
|
BitField<49, 3, GlobalAtomicType> type;
|
|
|
|
|
BitField<28, 20, s64> offset;
|
|
|
|
|
} atom;
|
|
|
|
|
|
2020-01-16 08:00:52 +01:00
|
|
|
|
union {
|
|
|
|
|
BitField<52, 4, AtomicOp> operation;
|
|
|
|
|
BitField<28, 2, AtomicType> type;
|
|
|
|
|
BitField<30, 22, s64> offset;
|
|
|
|
|
|
|
|
|
|
s32 GetImmediateOffset() const {
|
|
|
|
|
return static_cast<s32>(offset << 2);
|
|
|
|
|
}
|
|
|
|
|
} atoms;
|
|
|
|
|
|
2019-04-30 04:27:15 +02:00
|
|
|
|
union {
|
|
|
|
|
BitField<32, 1, PhysicalAttributeDirection> direction;
|
|
|
|
|
BitField<47, 3, AttributeSize> size;
|
|
|
|
|
BitField<20, 11, u64> address;
|
|
|
|
|
} al2p;
|
|
|
|
|
|
2019-05-18 07:35:01 +02:00
|
|
|
|
union {
|
|
|
|
|
BitField<53, 3, UniformType> type;
|
|
|
|
|
BitField<52, 1, u64> extended;
|
|
|
|
|
} generic;
|
|
|
|
|
|
2018-04-20 16:09:50 +02:00
|
|
|
|
union {
|
|
|
|
|
BitField<0, 3, u64> pred0;
|
|
|
|
|
BitField<3, 3, u64> pred3;
|
2019-08-28 02:57:43 +02:00
|
|
|
|
BitField<6, 1, u64> neg_b;
|
2018-04-20 16:09:50 +02:00
|
|
|
|
BitField<7, 1, u64> abs_a;
|
|
|
|
|
BitField<39, 3, u64> pred39;
|
|
|
|
|
BitField<42, 1, u64> neg_pred;
|
|
|
|
|
BitField<43, 1, u64> neg_a;
|
|
|
|
|
BitField<44, 1, u64> abs_b;
|
|
|
|
|
BitField<45, 2, PredOperation> op;
|
|
|
|
|
BitField<47, 1, u64> ftz;
|
|
|
|
|
BitField<48, 4, PredCondition> cond;
|
|
|
|
|
} fsetp;
|
|
|
|
|
|
2018-06-04 18:12:03 +02:00
|
|
|
|
union {
|
|
|
|
|
BitField<0, 3, u64> pred0;
|
|
|
|
|
BitField<3, 3, u64> pred3;
|
|
|
|
|
BitField<39, 3, u64> pred39;
|
|
|
|
|
BitField<42, 1, u64> neg_pred;
|
|
|
|
|
BitField<45, 2, PredOperation> op;
|
|
|
|
|
BitField<48, 1, u64> is_signed;
|
|
|
|
|
BitField<49, 3, PredCondition> cond;
|
|
|
|
|
} isetp;
|
|
|
|
|
|
2019-09-20 02:56:29 +02:00
|
|
|
|
union {
|
|
|
|
|
BitField<48, 1, u64> is_signed;
|
|
|
|
|
BitField<49, 3, PredCondition> cond;
|
|
|
|
|
} icmp;
|
|
|
|
|
|
2018-07-04 22:15:03 +02:00
|
|
|
|
union {
|
|
|
|
|
BitField<0, 3, u64> pred0;
|
|
|
|
|
BitField<3, 3, u64> pred3;
|
|
|
|
|
BitField<12, 3, u64> pred12;
|
|
|
|
|
BitField<15, 1, u64> neg_pred12;
|
|
|
|
|
BitField<24, 2, PredOperation> cond;
|
|
|
|
|
BitField<29, 3, u64> pred29;
|
|
|
|
|
BitField<32, 1, u64> neg_pred29;
|
|
|
|
|
BitField<39, 3, u64> pred39;
|
|
|
|
|
BitField<42, 1, u64> neg_pred39;
|
|
|
|
|
BitField<45, 2, PredOperation> op;
|
|
|
|
|
} psetp;
|
|
|
|
|
|
2018-10-18 07:38:58 +02:00
|
|
|
|
union {
|
|
|
|
|
BitField<43, 4, PredCondition> cond;
|
|
|
|
|
BitField<45, 2, PredOperation> op;
|
|
|
|
|
BitField<3, 3, u64> pred3;
|
|
|
|
|
BitField<0, 3, u64> pred0;
|
|
|
|
|
BitField<39, 3, u64> pred39;
|
|
|
|
|
} vsetp;
|
|
|
|
|
|
2018-09-11 18:26:42 +02:00
|
|
|
|
union {
|
|
|
|
|
BitField<12, 3, u64> pred12;
|
|
|
|
|
BitField<15, 1, u64> neg_pred12;
|
|
|
|
|
BitField<24, 2, PredOperation> cond;
|
|
|
|
|
BitField<29, 3, u64> pred29;
|
|
|
|
|
BitField<32, 1, u64> neg_pred29;
|
|
|
|
|
BitField<39, 3, u64> pred39;
|
|
|
|
|
BitField<42, 1, u64> neg_pred39;
|
|
|
|
|
BitField<44, 1, u64> bf;
|
|
|
|
|
BitField<45, 2, PredOperation> op;
|
|
|
|
|
} pset;
|
|
|
|
|
|
2018-09-09 04:44:20 +02:00
|
|
|
|
union {
|
|
|
|
|
BitField<0, 3, u64> pred0;
|
|
|
|
|
BitField<3, 3, u64> pred3;
|
2018-11-22 02:06:01 +01:00
|
|
|
|
BitField<8, 5, ConditionCode> cc; // flag in cc
|
2018-09-09 04:44:20 +02:00
|
|
|
|
BitField<39, 3, u64> pred39;
|
|
|
|
|
BitField<42, 1, u64> neg_pred39;
|
|
|
|
|
BitField<45, 4, PredOperation> op; // op with pred39
|
|
|
|
|
} csetp;
|
|
|
|
|
|
2018-10-15 07:09:40 +02:00
|
|
|
|
union {
|
|
|
|
|
BitField<6, 1, u64> ftz;
|
|
|
|
|
BitField<45, 2, PredOperation> op;
|
|
|
|
|
BitField<3, 3, u64> pred3;
|
|
|
|
|
BitField<0, 3, u64> pred0;
|
|
|
|
|
BitField<43, 1, u64> negate_a;
|
|
|
|
|
BitField<44, 1, u64> abs_a;
|
|
|
|
|
BitField<47, 2, HalfType> type_a;
|
2019-05-14 22:16:23 +02:00
|
|
|
|
union {
|
|
|
|
|
BitField<35, 4, PredCondition> cond;
|
|
|
|
|
BitField<49, 1, u64> h_and;
|
|
|
|
|
BitField<31, 1, u64> negate_b;
|
|
|
|
|
BitField<30, 1, u64> abs_b;
|
|
|
|
|
BitField<28, 2, HalfType> type_b;
|
|
|
|
|
} reg;
|
|
|
|
|
union {
|
|
|
|
|
BitField<56, 1, u64> negate_b;
|
|
|
|
|
BitField<54, 1, u64> abs_b;
|
|
|
|
|
} cbuf;
|
|
|
|
|
union {
|
|
|
|
|
BitField<49, 4, PredCondition> cond;
|
|
|
|
|
BitField<53, 1, u64> h_and;
|
|
|
|
|
} cbuf_and_imm;
|
2018-10-15 07:09:40 +02:00
|
|
|
|
BitField<42, 1, u64> neg_pred;
|
|
|
|
|
BitField<39, 3, u64> pred39;
|
|
|
|
|
} hsetp2;
|
|
|
|
|
|
2018-11-21 08:36:44 +01:00
|
|
|
|
union {
|
|
|
|
|
BitField<40, 1, R2pMode> mode;
|
|
|
|
|
BitField<41, 2, u64> byte;
|
|
|
|
|
BitField<20, 7, u64> immediate_mask;
|
2019-12-20 21:41:27 +01:00
|
|
|
|
} p2r_r2p;
|
2018-11-21 08:36:44 +01:00
|
|
|
|
|
2018-04-25 05:42:54 +02:00
|
|
|
|
union {
|
|
|
|
|
BitField<39, 3, u64> pred39;
|
|
|
|
|
BitField<42, 1, u64> neg_pred;
|
|
|
|
|
BitField<43, 1, u64> neg_a;
|
|
|
|
|
BitField<44, 1, u64> abs_b;
|
|
|
|
|
BitField<45, 2, PredOperation> op;
|
|
|
|
|
BitField<48, 4, PredCondition> cond;
|
2018-06-04 18:58:29 +02:00
|
|
|
|
BitField<52, 1, u64> bf;
|
2018-04-25 05:42:54 +02:00
|
|
|
|
BitField<53, 1, u64> neg_b;
|
|
|
|
|
BitField<54, 1, u64> abs_a;
|
|
|
|
|
BitField<55, 1, u64> ftz;
|
|
|
|
|
} fset;
|
2018-06-09 23:19:13 +02:00
|
|
|
|
|
2020-01-27 05:14:25 +01:00
|
|
|
|
union {
|
|
|
|
|
BitField<47, 1, u64> ftz;
|
|
|
|
|
BitField<48, 4, PredCondition> cond;
|
|
|
|
|
} fcmp;
|
|
|
|
|
|
2018-10-15 07:10:15 +02:00
|
|
|
|
union {
|
|
|
|
|
BitField<49, 1, u64> bf;
|
|
|
|
|
BitField<35, 3, PredCondition> cond;
|
|
|
|
|
BitField<50, 1, u64> ftz;
|
|
|
|
|
BitField<45, 2, PredOperation> op;
|
|
|
|
|
BitField<43, 1, u64> negate_a;
|
|
|
|
|
BitField<44, 1, u64> abs_a;
|
|
|
|
|
BitField<47, 2, HalfType> type_a;
|
|
|
|
|
BitField<31, 1, u64> negate_b;
|
|
|
|
|
BitField<30, 1, u64> abs_b;
|
|
|
|
|
BitField<28, 2, HalfType> type_b;
|
|
|
|
|
BitField<42, 1, u64> neg_pred;
|
|
|
|
|
BitField<39, 3, u64> pred39;
|
|
|
|
|
} hset2;
|
|
|
|
|
|
2018-06-09 23:19:13 +02:00
|
|
|
|
union {
|
|
|
|
|
BitField<39, 3, u64> pred39;
|
|
|
|
|
BitField<42, 1, u64> neg_pred;
|
|
|
|
|
BitField<44, 1, u64> bf;
|
|
|
|
|
BitField<45, 2, PredOperation> op;
|
|
|
|
|
BitField<48, 1, u64> is_signed;
|
|
|
|
|
BitField<49, 3, PredCondition> cond;
|
|
|
|
|
} iset;
|
2018-04-25 05:42:54 +02:00
|
|
|
|
|
2018-04-28 04:19:14 +02:00
|
|
|
|
union {
|
|
|
|
|
BitField<45, 1, u64> negate_a;
|
|
|
|
|
BitField<49, 1, u64> abs_a;
|
2019-04-16 01:04:33 +02:00
|
|
|
|
BitField<10, 2, Register::Size> src_size;
|
|
|
|
|
BitField<13, 1, u64> is_input_signed;
|
|
|
|
|
BitField<8, 2, Register::Size> dst_size;
|
|
|
|
|
BitField<12, 1, u64> is_output_signed;
|
|
|
|
|
|
|
|
|
|
union {
|
|
|
|
|
BitField<39, 2, u64> tab5cb8_2;
|
|
|
|
|
} i2f;
|
2018-06-05 01:05:12 +02:00
|
|
|
|
|
|
|
|
|
union {
|
2018-06-07 04:21:29 +02:00
|
|
|
|
BitField<39, 2, F2iRoundingOp> rounding;
|
2018-06-05 01:05:12 +02:00
|
|
|
|
} f2i;
|
|
|
|
|
|
|
|
|
|
union {
|
2019-04-16 01:04:33 +02:00
|
|
|
|
BitField<39, 4, u64> rounding;
|
|
|
|
|
// H0, H1 extract for F16 missing
|
|
|
|
|
BitField<41, 1, u64> selector; // Guessed as some games set it, TODO: reverse this value
|
|
|
|
|
F2fRoundingOp GetRoundingMode() const {
|
|
|
|
|
constexpr u64 rounding_mask = 0x0B;
|
|
|
|
|
return static_cast<F2fRoundingOp>(rounding.Value() & rounding_mask);
|
|
|
|
|
}
|
2018-06-05 01:05:12 +02:00
|
|
|
|
} f2f;
|
2019-04-16 01:04:33 +02:00
|
|
|
|
|
2019-08-28 21:09:33 +02:00
|
|
|
|
union {
|
|
|
|
|
BitField<41, 2, u64> selector;
|
|
|
|
|
} int_src;
|
|
|
|
|
|
|
|
|
|
union {
|
|
|
|
|
BitField<41, 1, u64> selector;
|
|
|
|
|
} float_src;
|
2018-04-29 02:01:36 +02:00
|
|
|
|
} conversion;
|
2018-04-28 04:19:14 +02:00
|
|
|
|
|
2018-06-01 05:22:21 +02:00
|
|
|
|
union {
|
2018-08-19 19:46:35 +02:00
|
|
|
|
BitField<28, 1, u64> array;
|
|
|
|
|
BitField<29, 2, TextureType> texture_type;
|
2018-06-01 05:22:21 +02:00
|
|
|
|
BitField<31, 4, u64> component_mask;
|
2018-09-12 22:17:18 +02:00
|
|
|
|
BitField<49, 1, u64> nodep_flag;
|
|
|
|
|
BitField<50, 1, u64> dc_flag;
|
|
|
|
|
BitField<54, 1, u64> aoffi_flag;
|
2018-09-08 03:09:39 +02:00
|
|
|
|
BitField<55, 3, TextureProcessMode> process_mode;
|
2018-06-01 05:22:21 +02:00
|
|
|
|
|
2018-09-15 15:21:06 +02:00
|
|
|
|
bool IsComponentEnabled(std::size_t component) const {
|
2018-06-20 18:39:10 +02:00
|
|
|
|
return ((1ull << component) & component_mask) != 0;
|
2018-06-01 05:22:21 +02:00
|
|
|
|
}
|
2018-09-12 22:17:18 +02:00
|
|
|
|
|
|
|
|
|
TextureProcessMode GetTextureProcessMode() const {
|
|
|
|
|
return process_mode;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool UsesMiscMode(TextureMiscMode mode) const {
|
|
|
|
|
switch (mode) {
|
|
|
|
|
case TextureMiscMode::DC:
|
|
|
|
|
return dc_flag != 0;
|
|
|
|
|
case TextureMiscMode::NODEP:
|
|
|
|
|
return nodep_flag != 0;
|
|
|
|
|
case TextureMiscMode::AOFFI:
|
|
|
|
|
return aoffi_flag != 0;
|
|
|
|
|
default:
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
return false;
|
|
|
|
|
}
|
2018-06-01 05:22:21 +02:00
|
|
|
|
} tex;
|
|
|
|
|
|
2019-03-27 00:02:24 +01:00
|
|
|
|
union {
|
|
|
|
|
BitField<28, 1, u64> array;
|
|
|
|
|
BitField<29, 2, TextureType> texture_type;
|
|
|
|
|
BitField<31, 4, u64> component_mask;
|
|
|
|
|
BitField<49, 1, u64> nodep_flag;
|
|
|
|
|
BitField<50, 1, u64> dc_flag;
|
|
|
|
|
BitField<36, 1, u64> aoffi_flag;
|
|
|
|
|
BitField<37, 3, TextureProcessMode> process_mode;
|
|
|
|
|
|
|
|
|
|
bool IsComponentEnabled(std::size_t component) const {
|
2019-04-07 14:30:26 +02:00
|
|
|
|
return ((1ULL << component) & component_mask) != 0;
|
2019-03-27 00:02:24 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
TextureProcessMode GetTextureProcessMode() const {
|
|
|
|
|
return process_mode;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool UsesMiscMode(TextureMiscMode mode) const {
|
|
|
|
|
switch (mode) {
|
|
|
|
|
case TextureMiscMode::DC:
|
|
|
|
|
return dc_flag != 0;
|
|
|
|
|
case TextureMiscMode::NODEP:
|
|
|
|
|
return nodep_flag != 0;
|
|
|
|
|
case TextureMiscMode::AOFFI:
|
|
|
|
|
return aoffi_flag != 0;
|
|
|
|
|
default:
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
} tex_b;
|
|
|
|
|
|
2018-09-08 01:53:06 +02:00
|
|
|
|
union {
|
|
|
|
|
BitField<22, 6, TextureQueryType> query_type;
|
|
|
|
|
BitField<31, 4, u64> component_mask;
|
2018-09-12 22:17:18 +02:00
|
|
|
|
BitField<49, 1, u64> nodep_flag;
|
|
|
|
|
|
|
|
|
|
bool UsesMiscMode(TextureMiscMode mode) const {
|
|
|
|
|
switch (mode) {
|
|
|
|
|
case TextureMiscMode::NODEP:
|
|
|
|
|
return nodep_flag != 0;
|
|
|
|
|
default:
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
return false;
|
|
|
|
|
}
|
2019-02-03 22:07:20 +01:00
|
|
|
|
|
|
|
|
|
bool IsComponentEnabled(std::size_t component) const {
|
2019-02-04 02:27:26 +01:00
|
|
|
|
return ((1ULL << component) & component_mask) != 0;
|
2019-02-03 22:07:20 +01:00
|
|
|
|
}
|
2018-09-08 01:53:06 +02:00
|
|
|
|
} txq;
|
|
|
|
|
|
2018-09-08 18:40:18 +02:00
|
|
|
|
union {
|
|
|
|
|
BitField<28, 1, u64> array;
|
|
|
|
|
BitField<29, 2, TextureType> texture_type;
|
|
|
|
|
BitField<31, 4, u64> component_mask;
|
2018-09-12 22:17:18 +02:00
|
|
|
|
BitField<35, 1, u64> ndv_flag;
|
|
|
|
|
BitField<49, 1, u64> nodep_flag;
|
2018-09-08 18:40:18 +02:00
|
|
|
|
|
2018-09-15 15:21:06 +02:00
|
|
|
|
bool IsComponentEnabled(std::size_t component) const {
|
2018-09-08 18:40:18 +02:00
|
|
|
|
return ((1ull << component) & component_mask) != 0;
|
|
|
|
|
}
|
2018-09-12 22:17:18 +02:00
|
|
|
|
|
|
|
|
|
bool UsesMiscMode(TextureMiscMode mode) const {
|
|
|
|
|
switch (mode) {
|
|
|
|
|
case TextureMiscMode::NDV:
|
|
|
|
|
return (ndv_flag != 0);
|
|
|
|
|
case TextureMiscMode::NODEP:
|
|
|
|
|
return (nodep_flag != 0);
|
|
|
|
|
default:
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
return false;
|
|
|
|
|
}
|
2018-09-08 18:40:18 +02:00
|
|
|
|
} tmml;
|
|
|
|
|
|
2018-06-01 04:57:32 +02:00
|
|
|
|
union {
|
2018-08-19 19:46:35 +02:00
|
|
|
|
BitField<28, 1, u64> array;
|
|
|
|
|
BitField<29, 2, TextureType> texture_type;
|
2018-09-12 22:17:18 +02:00
|
|
|
|
BitField<35, 1, u64> ndv_flag;
|
|
|
|
|
BitField<49, 1, u64> nodep_flag;
|
|
|
|
|
BitField<50, 1, u64> dc_flag;
|
2019-12-16 08:09:24 +01:00
|
|
|
|
BitField<54, 2, u64> offset_mode;
|
2018-08-19 19:46:35 +02:00
|
|
|
|
BitField<56, 2, u64> component;
|
2018-09-12 22:17:18 +02:00
|
|
|
|
|
|
|
|
|
bool UsesMiscMode(TextureMiscMode mode) const {
|
|
|
|
|
switch (mode) {
|
|
|
|
|
case TextureMiscMode::NDV:
|
|
|
|
|
return ndv_flag != 0;
|
|
|
|
|
case TextureMiscMode::NODEP:
|
|
|
|
|
return nodep_flag != 0;
|
|
|
|
|
case TextureMiscMode::DC:
|
|
|
|
|
return dc_flag != 0;
|
|
|
|
|
case TextureMiscMode::AOFFI:
|
2019-12-16 08:09:24 +01:00
|
|
|
|
return offset_mode == 1;
|
2018-09-12 22:17:18 +02:00
|
|
|
|
case TextureMiscMode::PTP:
|
2019-12-16 08:09:24 +01:00
|
|
|
|
return offset_mode == 2;
|
2018-09-12 22:17:18 +02:00
|
|
|
|
default:
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
return false;
|
|
|
|
|
}
|
2018-08-19 19:46:35 +02:00
|
|
|
|
} tld4;
|
|
|
|
|
|
2019-10-30 01:48:18 +01:00
|
|
|
|
union {
|
|
|
|
|
BitField<35, 1, u64> ndv_flag;
|
|
|
|
|
BitField<49, 1, u64> nodep_flag;
|
|
|
|
|
BitField<50, 1, u64> dc_flag;
|
2019-12-16 08:09:24 +01:00
|
|
|
|
BitField<33, 2, u64> offset_mode;
|
2019-10-30 01:48:18 +01:00
|
|
|
|
BitField<37, 2, u64> component;
|
|
|
|
|
|
|
|
|
|
bool UsesMiscMode(TextureMiscMode mode) const {
|
|
|
|
|
switch (mode) {
|
|
|
|
|
case TextureMiscMode::NDV:
|
|
|
|
|
return ndv_flag != 0;
|
|
|
|
|
case TextureMiscMode::NODEP:
|
|
|
|
|
return nodep_flag != 0;
|
|
|
|
|
case TextureMiscMode::DC:
|
|
|
|
|
return dc_flag != 0;
|
|
|
|
|
case TextureMiscMode::AOFFI:
|
2019-12-16 08:09:24 +01:00
|
|
|
|
return offset_mode == 1;
|
2019-10-30 01:48:18 +01:00
|
|
|
|
case TextureMiscMode::PTP:
|
2019-12-16 08:09:24 +01:00
|
|
|
|
return offset_mode == 2;
|
2019-10-30 01:48:18 +01:00
|
|
|
|
default:
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
} tld4_b;
|
|
|
|
|
|
2018-08-19 19:46:35 +02:00
|
|
|
|
union {
|
2018-09-12 22:17:18 +02:00
|
|
|
|
BitField<49, 1, u64> nodep_flag;
|
|
|
|
|
BitField<50, 1, u64> dc_flag;
|
|
|
|
|
BitField<51, 1, u64> aoffi_flag;
|
2018-08-19 19:46:35 +02:00
|
|
|
|
BitField<52, 2, u64> component;
|
2019-12-11 23:12:29 +01:00
|
|
|
|
BitField<55, 1, u64> fp16_flag;
|
2018-09-12 22:17:18 +02:00
|
|
|
|
|
|
|
|
|
bool UsesMiscMode(TextureMiscMode mode) const {
|
|
|
|
|
switch (mode) {
|
|
|
|
|
case TextureMiscMode::DC:
|
|
|
|
|
return dc_flag != 0;
|
|
|
|
|
case TextureMiscMode::NODEP:
|
|
|
|
|
return nodep_flag != 0;
|
|
|
|
|
case TextureMiscMode::AOFFI:
|
|
|
|
|
return aoffi_flag != 0;
|
|
|
|
|
default:
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
return false;
|
|
|
|
|
}
|
2018-08-19 19:46:35 +02:00
|
|
|
|
} tld4s;
|
|
|
|
|
|
|
|
|
|
union {
|
2018-07-22 09:23:15 +02:00
|
|
|
|
BitField<0, 8, Register> gpr0;
|
2018-06-03 18:08:17 +02:00
|
|
|
|
BitField<28, 8, Register> gpr28;
|
2018-09-12 22:17:18 +02:00
|
|
|
|
BitField<49, 1, u64> nodep_flag;
|
2018-08-19 19:46:35 +02:00
|
|
|
|
BitField<50, 3, u64> component_mask_selector;
|
|
|
|
|
BitField<53, 4, u64> texture_info;
|
2018-12-26 05:35:44 +01:00
|
|
|
|
BitField<59, 1, u64> fp32_flag;
|
2018-08-19 19:46:35 +02:00
|
|
|
|
|
|
|
|
|
TextureType GetTextureType() const {
|
|
|
|
|
// The TEXS instruction has a weird encoding for the texture type.
|
|
|
|
|
if (texture_info == 0)
|
|
|
|
|
return TextureType::Texture1D;
|
|
|
|
|
if (texture_info >= 1 && texture_info <= 9)
|
|
|
|
|
return TextureType::Texture2D;
|
|
|
|
|
if (texture_info >= 10 && texture_info <= 11)
|
|
|
|
|
return TextureType::Texture3D;
|
|
|
|
|
if (texture_info >= 12 && texture_info <= 13)
|
|
|
|
|
return TextureType::TextureCube;
|
|
|
|
|
|
2018-08-21 03:53:49 +02:00
|
|
|
|
LOG_CRITICAL(HW_GPU, "Unhandled texture_info: {}",
|
|
|
|
|
static_cast<u32>(texture_info.Value()));
|
|
|
|
|
UNREACHABLE();
|
2018-12-19 02:52:32 +01:00
|
|
|
|
return TextureType::Texture1D;
|
2018-08-19 19:46:35 +02:00
|
|
|
|
}
|
|
|
|
|
|
2018-09-12 22:17:18 +02:00
|
|
|
|
TextureProcessMode GetTextureProcessMode() const {
|
|
|
|
|
switch (texture_info) {
|
|
|
|
|
case 0:
|
|
|
|
|
case 2:
|
|
|
|
|
case 6:
|
|
|
|
|
case 8:
|
|
|
|
|
case 9:
|
|
|
|
|
case 11:
|
|
|
|
|
return TextureProcessMode::LZ;
|
|
|
|
|
case 3:
|
|
|
|
|
case 5:
|
|
|
|
|
case 13:
|
|
|
|
|
return TextureProcessMode::LL;
|
|
|
|
|
default:
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
return TextureProcessMode::None;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool UsesMiscMode(TextureMiscMode mode) const {
|
|
|
|
|
switch (mode) {
|
|
|
|
|
case TextureMiscMode::DC:
|
|
|
|
|
return (texture_info >= 4 && texture_info <= 6) || texture_info == 9;
|
|
|
|
|
case TextureMiscMode::NODEP:
|
|
|
|
|
return nodep_flag != 0;
|
|
|
|
|
default:
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
2018-08-19 19:46:35 +02:00
|
|
|
|
bool IsArrayTexture() const {
|
|
|
|
|
// TEXS only supports Texture2D arrays.
|
|
|
|
|
return texture_info >= 7 && texture_info <= 9;
|
|
|
|
|
}
|
2018-06-03 18:08:17 +02:00
|
|
|
|
|
|
|
|
|
bool HasTwoDestinations() const {
|
|
|
|
|
return gpr28.Value() != Register::ZeroIndex;
|
|
|
|
|
}
|
|
|
|
|
|
2018-09-15 15:21:06 +02:00
|
|
|
|
bool IsComponentEnabled(std::size_t component) const {
|
2018-08-19 21:00:12 +02:00
|
|
|
|
static constexpr std::array<std::array<u32, 8>, 4> mask_lut{{
|
|
|
|
|
{},
|
|
|
|
|
{0x1, 0x2, 0x4, 0x8, 0x3, 0x9, 0xa, 0xc},
|
|
|
|
|
{0x1, 0x2, 0x4, 0x8, 0x3, 0x9, 0xa, 0xc},
|
|
|
|
|
{0x7, 0xb, 0xd, 0xe, 0xf},
|
|
|
|
|
}};
|
2018-06-03 18:08:17 +02:00
|
|
|
|
|
2018-09-15 15:21:06 +02:00
|
|
|
|
std::size_t index{gpr0.Value() != Register::ZeroIndex ? 1U : 0U};
|
2018-07-22 09:23:15 +02:00
|
|
|
|
index |= gpr28.Value() != Register::ZeroIndex ? 2 : 0;
|
2018-06-03 18:08:17 +02:00
|
|
|
|
|
2018-08-19 21:00:12 +02:00
|
|
|
|
u32 mask = mask_lut[index][component_mask_selector];
|
|
|
|
|
// A mask of 0 means this instruction uses an unimplemented mask.
|
|
|
|
|
ASSERT(mask != 0);
|
|
|
|
|
return ((1ull << component) & mask) != 0;
|
2018-06-03 18:08:17 +02:00
|
|
|
|
}
|
2018-06-01 04:57:32 +02:00
|
|
|
|
} texs;
|
|
|
|
|
|
2019-04-28 01:50:35 +02:00
|
|
|
|
union {
|
|
|
|
|
BitField<28, 1, u64> is_array;
|
|
|
|
|
BitField<29, 2, TextureType> texture_type;
|
|
|
|
|
BitField<35, 1, u64> aoffi;
|
|
|
|
|
BitField<49, 1, u64> nodep_flag;
|
|
|
|
|
BitField<50, 1, u64> ms; // Multisample?
|
|
|
|
|
BitField<54, 1, u64> cl;
|
|
|
|
|
BitField<55, 1, u64> process_mode;
|
|
|
|
|
|
|
|
|
|
TextureProcessMode GetTextureProcessMode() const {
|
|
|
|
|
return process_mode == 0 ? TextureProcessMode::LZ : TextureProcessMode::LL;
|
|
|
|
|
}
|
|
|
|
|
} tld;
|
|
|
|
|
|
2018-08-19 19:46:35 +02:00
|
|
|
|
union {
|
2018-09-12 22:17:18 +02:00
|
|
|
|
BitField<49, 1, u64> nodep_flag;
|
2018-08-19 19:46:35 +02:00
|
|
|
|
BitField<53, 4, u64> texture_info;
|
2019-05-14 20:47:58 +02:00
|
|
|
|
BitField<59, 1, u64> fp32_flag;
|
2018-08-19 19:46:35 +02:00
|
|
|
|
|
|
|
|
|
TextureType GetTextureType() const {
|
|
|
|
|
// The TLDS instruction has a weird encoding for the texture type.
|
|
|
|
|
if (texture_info >= 0 && texture_info <= 1) {
|
|
|
|
|
return TextureType::Texture1D;
|
|
|
|
|
}
|
|
|
|
|
if (texture_info == 2 || texture_info == 8 || texture_info == 12 ||
|
2018-08-21 21:08:33 +02:00
|
|
|
|
(texture_info >= 4 && texture_info <= 6)) {
|
2018-08-19 19:46:35 +02:00
|
|
|
|
return TextureType::Texture2D;
|
|
|
|
|
}
|
|
|
|
|
if (texture_info == 7) {
|
|
|
|
|
return TextureType::Texture3D;
|
|
|
|
|
}
|
|
|
|
|
|
2018-08-21 03:53:49 +02:00
|
|
|
|
LOG_CRITICAL(HW_GPU, "Unhandled texture_info: {}",
|
|
|
|
|
static_cast<u32>(texture_info.Value()));
|
|
|
|
|
UNREACHABLE();
|
2018-12-19 02:52:32 +01:00
|
|
|
|
return TextureType::Texture1D;
|
2018-08-19 19:46:35 +02:00
|
|
|
|
}
|
|
|
|
|
|
2018-09-12 22:17:18 +02:00
|
|
|
|
TextureProcessMode GetTextureProcessMode() const {
|
|
|
|
|
if (texture_info == 1 || texture_info == 5 || texture_info == 12)
|
|
|
|
|
return TextureProcessMode::LL;
|
|
|
|
|
return TextureProcessMode::LZ;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool UsesMiscMode(TextureMiscMode mode) const {
|
|
|
|
|
switch (mode) {
|
|
|
|
|
case TextureMiscMode::AOFFI:
|
|
|
|
|
return texture_info == 12 || texture_info == 4;
|
|
|
|
|
case TextureMiscMode::MZ:
|
|
|
|
|
return texture_info == 5;
|
|
|
|
|
case TextureMiscMode::NODEP:
|
|
|
|
|
return nodep_flag != 0;
|
|
|
|
|
default:
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
2018-08-19 19:46:35 +02:00
|
|
|
|
bool IsArrayTexture() const {
|
|
|
|
|
// TEXS only supports Texture2D arrays.
|
|
|
|
|
return texture_info == 8;
|
|
|
|
|
}
|
|
|
|
|
} tlds;
|
|
|
|
|
|
2019-11-12 18:43:08 +01:00
|
|
|
|
union {
|
|
|
|
|
BitField<28, 1, u64> is_array;
|
|
|
|
|
BitField<29, 2, TextureType> texture_type;
|
|
|
|
|
BitField<35, 1, u64> aoffi_flag;
|
|
|
|
|
BitField<49, 1, u64> nodep_flag;
|
|
|
|
|
|
|
|
|
|
bool UsesMiscMode(TextureMiscMode mode) const {
|
|
|
|
|
switch (mode) {
|
|
|
|
|
case TextureMiscMode::AOFFI:
|
|
|
|
|
return aoffi_flag != 0;
|
|
|
|
|
case TextureMiscMode::NODEP:
|
|
|
|
|
return nodep_flag != 0;
|
|
|
|
|
default:
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
} txd;
|
|
|
|
|
|
2019-04-27 07:07:18 +02:00
|
|
|
|
union {
|
|
|
|
|
BitField<24, 2, StoreCacheManagement> cache_management;
|
|
|
|
|
BitField<33, 3, ImageType> image_type;
|
|
|
|
|
BitField<49, 2, OutOfBoundsStore> out_of_bounds_store;
|
|
|
|
|
BitField<51, 1, u64> is_immediate;
|
|
|
|
|
BitField<52, 1, SurfaceDataMode> mode;
|
|
|
|
|
|
|
|
|
|
BitField<20, 3, StoreType> store_data_layout;
|
|
|
|
|
BitField<20, 4, u64> component_mask_selector;
|
|
|
|
|
|
|
|
|
|
bool IsComponentEnabled(std::size_t component) const {
|
|
|
|
|
ASSERT(mode == SurfaceDataMode::P);
|
|
|
|
|
constexpr u8 R = 0b0001;
|
|
|
|
|
constexpr u8 G = 0b0010;
|
|
|
|
|
constexpr u8 B = 0b0100;
|
|
|
|
|
constexpr u8 A = 0b1000;
|
|
|
|
|
constexpr std::array<u8, 16> mask = {
|
|
|
|
|
0, (R), (G), (R | G), (B), (R | B),
|
|
|
|
|
(G | B), (R | G | B), (A), (R | A), (G | A), (R | G | A),
|
|
|
|
|
(B | A), (R | B | A), (G | B | A), (R | G | B | A)};
|
|
|
|
|
return std::bitset<4>{mask.at(component_mask_selector)}.test(component);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
StoreType GetStoreDataLayout() const {
|
|
|
|
|
ASSERT(mode == SurfaceDataMode::D_BA);
|
|
|
|
|
return store_data_layout;
|
|
|
|
|
}
|
2019-09-18 06:07:01 +02:00
|
|
|
|
} suldst;
|
2019-04-27 07:07:18 +02:00
|
|
|
|
|
2019-07-18 02:03:53 +02:00
|
|
|
|
union {
|
|
|
|
|
BitField<28, 1, u64> is_ba;
|
2019-09-18 06:50:40 +02:00
|
|
|
|
BitField<51, 3, ImageAtomicOperationType> operation_type;
|
2019-07-18 02:03:53 +02:00
|
|
|
|
BitField<33, 3, ImageType> image_type;
|
|
|
|
|
BitField<29, 4, ImageAtomicOperation> operation;
|
|
|
|
|
BitField<49, 2, OutOfBoundsStore> out_of_bounds_store;
|
|
|
|
|
} suatom_d;
|
|
|
|
|
|
2018-06-02 21:45:50 +02:00
|
|
|
|
union {
|
2018-06-05 05:56:28 +02:00
|
|
|
|
BitField<20, 24, u64> target;
|
2018-06-02 21:45:50 +02:00
|
|
|
|
BitField<5, 1, u64> constant_buffer;
|
|
|
|
|
|
|
|
|
|
s32 GetBranchTarget() const {
|
|
|
|
|
// Sign extend the branch target offset
|
2018-06-05 05:56:28 +02:00
|
|
|
|
u32 mask = 1U << (24 - 1);
|
2018-06-02 21:45:50 +02:00
|
|
|
|
u32 value = static_cast<u32>(target);
|
2018-06-05 05:56:28 +02:00
|
|
|
|
// The branch offset is relative to the next instruction and is stored in bytes, so
|
|
|
|
|
// divide it by the size of an instruction and add 1 to it.
|
2019-11-08 21:08:07 +01:00
|
|
|
|
return static_cast<s32>((value ^ mask) - mask) / static_cast<s32>(sizeof(Instruction)) +
|
|
|
|
|
1;
|
2018-06-02 21:45:50 +02:00
|
|
|
|
}
|
|
|
|
|
} bra;
|
|
|
|
|
|
2019-06-25 03:25:38 +02:00
|
|
|
|
union {
|
|
|
|
|
BitField<20, 24, u64> target;
|
|
|
|
|
BitField<5, 1, u64> constant_buffer;
|
|
|
|
|
|
|
|
|
|
s32 GetBranchExtend() const {
|
|
|
|
|
// Sign extend the branch target offset
|
|
|
|
|
u32 mask = 1U << (24 - 1);
|
|
|
|
|
u32 value = static_cast<u32>(target);
|
|
|
|
|
// The branch offset is relative to the next instruction and is stored in bytes, so
|
|
|
|
|
// divide it by the size of an instruction and add 1 to it.
|
2019-11-08 21:08:07 +01:00
|
|
|
|
return static_cast<s32>((value ^ mask) - mask) / static_cast<s32>(sizeof(Instruction)) +
|
|
|
|
|
1;
|
2019-06-25 03:25:38 +02:00
|
|
|
|
}
|
|
|
|
|
} brx;
|
|
|
|
|
|
2018-10-07 04:17:31 +02:00
|
|
|
|
union {
|
|
|
|
|
BitField<39, 1, u64> emit; // EmitVertex
|
|
|
|
|
BitField<40, 1, u64> cut; // EndPrimitive
|
|
|
|
|
} out;
|
|
|
|
|
|
|
|
|
|
union {
|
|
|
|
|
BitField<31, 1, u64> skew;
|
|
|
|
|
BitField<32, 1, u64> o;
|
|
|
|
|
BitField<33, 2, IsberdMode> mode;
|
|
|
|
|
BitField<47, 2, IsberdShift> shift;
|
|
|
|
|
} isberd;
|
|
|
|
|
|
2019-12-10 01:46:12 +01:00
|
|
|
|
union {
|
|
|
|
|
BitField<8, 2, MembarType> type;
|
|
|
|
|
BitField<0, 2, MembarUnknown> unknown;
|
|
|
|
|
} membar;
|
|
|
|
|
|
2018-10-11 08:56:14 +02:00
|
|
|
|
union {
|
|
|
|
|
BitField<48, 1, u64> signed_a;
|
|
|
|
|
BitField<38, 1, u64> is_byte_chunk_a;
|
2018-10-18 07:38:58 +02:00
|
|
|
|
BitField<36, 2, VideoType> type_a;
|
2018-10-11 08:56:14 +02:00
|
|
|
|
BitField<36, 2, u64> byte_height_a;
|
|
|
|
|
|
|
|
|
|
BitField<49, 1, u64> signed_b;
|
|
|
|
|
BitField<50, 1, u64> use_register_b;
|
|
|
|
|
BitField<30, 1, u64> is_byte_chunk_b;
|
2018-10-18 07:38:58 +02:00
|
|
|
|
BitField<28, 2, VideoType> type_b;
|
2018-10-11 08:56:14 +02:00
|
|
|
|
BitField<28, 2, u64> byte_height_b;
|
2018-10-18 07:38:58 +02:00
|
|
|
|
} video;
|
2018-10-11 08:56:14 +02:00
|
|
|
|
|
2018-10-18 07:38:58 +02:00
|
|
|
|
union {
|
2018-10-11 08:56:14 +02:00
|
|
|
|
BitField<51, 2, VmadShr> shr;
|
|
|
|
|
BitField<55, 1, u64> saturate; // Saturates the result (a * b + c)
|
|
|
|
|
BitField<47, 1, u64> cc;
|
|
|
|
|
} vmad;
|
|
|
|
|
|
2018-08-12 22:51:32 +02:00
|
|
|
|
union {
|
|
|
|
|
BitField<20, 16, u64> imm20_16;
|
2019-04-08 15:49:11 +02:00
|
|
|
|
BitField<35, 1, u64> high_b_rr; // used on RR
|
2018-08-12 22:51:32 +02:00
|
|
|
|
BitField<36, 1, u64> product_shift_left;
|
|
|
|
|
BitField<37, 1, u64> merge_37;
|
|
|
|
|
BitField<48, 1, u64> sign_a;
|
|
|
|
|
BitField<49, 1, u64> sign_b;
|
2019-04-08 15:49:11 +02:00
|
|
|
|
BitField<50, 2, XmadMode> mode_cbf; // used by CR, RC
|
2018-08-12 22:51:32 +02:00
|
|
|
|
BitField<50, 3, XmadMode> mode;
|
|
|
|
|
BitField<52, 1, u64> high_b;
|
|
|
|
|
BitField<53, 1, u64> high_a;
|
2019-04-08 15:49:11 +02:00
|
|
|
|
BitField<55, 1, u64> product_shift_left_second; // used on CR
|
2018-08-12 22:51:32 +02:00
|
|
|
|
BitField<56, 1, u64> merge_56;
|
|
|
|
|
} xmad;
|
|
|
|
|
|
2018-06-06 04:45:22 +02:00
|
|
|
|
union {
|
2020-02-05 16:18:33 +01:00
|
|
|
|
BitField<20, 14, u64> shifted_offset;
|
2018-06-06 04:45:22 +02:00
|
|
|
|
BitField<34, 5, u64> index;
|
2019-01-28 22:11:23 +01:00
|
|
|
|
|
|
|
|
|
u64 GetOffset() const {
|
2020-02-05 16:18:33 +01:00
|
|
|
|
return shifted_offset * 4;
|
2019-01-28 22:11:23 +01:00
|
|
|
|
}
|
2018-06-06 04:45:22 +02:00
|
|
|
|
} cbuf34;
|
|
|
|
|
|
|
|
|
|
union {
|
|
|
|
|
BitField<20, 16, s64> offset;
|
|
|
|
|
BitField<36, 5, u64> index;
|
2019-01-28 22:11:23 +01:00
|
|
|
|
|
|
|
|
|
s64 GetOffset() const {
|
|
|
|
|
return offset;
|
|
|
|
|
}
|
2018-06-06 04:45:22 +02:00
|
|
|
|
} cbuf36;
|
|
|
|
|
|
2018-10-07 04:17:31 +02:00
|
|
|
|
// Unsure about the size of this one.
|
|
|
|
|
// It's always used with a gpr0, so any size should be fine.
|
|
|
|
|
BitField<20, 8, SystemVariable> sys20;
|
|
|
|
|
|
2018-09-09 03:54:11 +02:00
|
|
|
|
BitField<47, 1, u64> generates_cc;
|
2018-04-16 02:45:56 +02:00
|
|
|
|
BitField<61, 1, u64> is_b_imm;
|
2018-04-10 05:39:44 +02:00
|
|
|
|
BitField<60, 1, u64> is_b_gpr;
|
|
|
|
|
BitField<59, 1, u64> is_c_gpr;
|
2018-10-20 03:48:21 +02:00
|
|
|
|
BitField<20, 24, s64> smem_imm;
|
2018-11-22 02:06:01 +01:00
|
|
|
|
BitField<0, 5, ConditionCode> flow_condition_code;
|
2018-04-10 05:39:44 +02:00
|
|
|
|
|
2018-04-05 03:43:40 +02:00
|
|
|
|
Attribute attribute;
|
2018-04-10 07:26:15 +02:00
|
|
|
|
Sampler sampler;
|
2019-04-27 07:07:18 +02:00
|
|
|
|
Image image;
|
2018-04-05 03:43:40 +02:00
|
|
|
|
|
2018-04-21 02:49:05 +02:00
|
|
|
|
u64 value;
|
2018-04-05 03:43:40 +02:00
|
|
|
|
};
|
|
|
|
|
static_assert(sizeof(Instruction) == 0x8, "Incorrect structure size");
|
2018-08-10 02:39:30 +02:00
|
|
|
|
static_assert(std::is_standard_layout_v<Instruction>, "Instruction is not standard layout");
|
2018-04-05 03:43:40 +02:00
|
|
|
|
|
2018-04-21 02:49:05 +02:00
|
|
|
|
class OpCode {
|
|
|
|
|
public:
|
|
|
|
|
enum class Id {
|
|
|
|
|
KIL,
|
2018-06-09 05:46:10 +02:00
|
|
|
|
SSY,
|
2018-07-04 22:29:51 +02:00
|
|
|
|
SYNC,
|
2018-10-16 22:11:26 +02:00
|
|
|
|
BRK,
|
2018-07-04 22:29:51 +02:00
|
|
|
|
DEPBAR,
|
2019-08-10 04:50:21 +02:00
|
|
|
|
VOTE,
|
2019-08-27 03:09:12 +02:00
|
|
|
|
SHFL,
|
2019-11-03 03:44:46 +01:00
|
|
|
|
FSWZADD,
|
2018-06-06 05:48:38 +02:00
|
|
|
|
BFE_C,
|
|
|
|
|
BFE_R,
|
|
|
|
|
BFE_IMM,
|
2020-01-27 05:19:00 +01:00
|
|
|
|
BFI_RC,
|
2018-11-21 20:01:35 +01:00
|
|
|
|
BFI_IMM_R,
|
2018-06-02 21:22:55 +02:00
|
|
|
|
BRA,
|
2019-06-25 03:25:38 +02:00
|
|
|
|
BRX,
|
2018-10-16 22:11:26 +02:00
|
|
|
|
PBK,
|
2018-04-21 02:49:05 +02:00
|
|
|
|
LD_A,
|
2018-10-20 03:48:21 +02:00
|
|
|
|
LD_L,
|
|
|
|
|
LD_S,
|
2018-06-06 05:46:23 +02:00
|
|
|
|
LD_C,
|
2019-05-18 07:35:01 +02:00
|
|
|
|
LD, // Load from generic memory
|
|
|
|
|
LDG, // Load from global memory
|
2018-04-21 02:49:05 +02:00
|
|
|
|
ST_A,
|
2018-10-20 03:48:21 +02:00
|
|
|
|
ST_L,
|
|
|
|
|
ST_S,
|
2020-01-16 08:00:52 +01:00
|
|
|
|
ST, // Store in generic memory
|
|
|
|
|
STG, // Store in global memory
|
2020-01-26 01:03:02 +01:00
|
|
|
|
ATOM, // Atomic operation on global memory
|
2020-01-16 08:00:52 +01:00
|
|
|
|
ATOMS, // Atomic operation on shared memory
|
|
|
|
|
AL2P, // Transforms attribute memory into physical memory
|
2018-06-01 05:22:21 +02:00
|
|
|
|
TEX,
|
2019-03-26 22:05:23 +01:00
|
|
|
|
TEX_B, // Texture Load Bindless
|
2018-09-08 18:40:18 +02:00
|
|
|
|
TXQ, // Texture Query
|
2019-03-27 00:46:11 +01:00
|
|
|
|
TXQ_B, // Texture Query Bindless
|
2018-09-08 18:40:18 +02:00
|
|
|
|
TEXS, // Texture Fetch with scalar/non-vec4 source/destinations
|
2019-04-28 01:50:35 +02:00
|
|
|
|
TLD, // Texture Load
|
2018-09-08 18:40:18 +02:00
|
|
|
|
TLDS, // Texture Load with scalar/non-vec4 source/destinations
|
2019-10-30 01:48:18 +01:00
|
|
|
|
TLD4, // Texture Gather 4
|
|
|
|
|
TLD4_B, // Texture Gather 4 Bindless
|
2018-09-08 18:40:18 +02:00
|
|
|
|
TLD4S, // Texture Load 4 with scalar / non - vec4 source / destinations
|
|
|
|
|
TMML_B, // Texture Mip Map Level
|
|
|
|
|
TMML, // Texture Mip Map Level
|
2019-11-08 14:04:15 +01:00
|
|
|
|
TXD, // Texture Gradient/Load with Derivates
|
|
|
|
|
TXD_B, // Texture Gradient/Load with Derivates Bindless
|
2019-04-27 07:07:18 +02:00
|
|
|
|
SUST, // Surface Store
|
2019-09-18 03:38:01 +02:00
|
|
|
|
SULD, // Surface Load
|
2019-07-18 02:03:53 +02:00
|
|
|
|
SUATOM, // Surface Atomic Operation
|
2018-04-21 02:49:05 +02:00
|
|
|
|
EXIT,
|
2019-07-30 02:18:30 +02:00
|
|
|
|
NOP,
|
2018-04-21 02:49:05 +02:00
|
|
|
|
IPA,
|
2018-10-07 04:17:31 +02:00
|
|
|
|
OUT_R, // Emit vertex/primitive
|
|
|
|
|
ISBERD,
|
2019-12-10 01:46:12 +01:00
|
|
|
|
MEMBAR,
|
2018-10-11 08:56:14 +02:00
|
|
|
|
VMAD,
|
2018-10-18 07:39:15 +02:00
|
|
|
|
VSETP,
|
2018-04-21 04:23:52 +02:00
|
|
|
|
FFMA_IMM, // Fused Multiply and Add
|
2018-04-21 02:49:05 +02:00
|
|
|
|
FFMA_CR,
|
|
|
|
|
FFMA_RC,
|
|
|
|
|
FFMA_RR,
|
|
|
|
|
FADD_C,
|
|
|
|
|
FADD_R,
|
|
|
|
|
FADD_IMM,
|
2018-07-12 19:00:31 +02:00
|
|
|
|
FADD32I,
|
2018-04-21 02:49:05 +02:00
|
|
|
|
FMUL_C,
|
|
|
|
|
FMUL_R,
|
|
|
|
|
FMUL_IMM,
|
|
|
|
|
FMUL32_IMM,
|
2018-06-09 05:25:22 +02:00
|
|
|
|
IADD_C,
|
|
|
|
|
IADD_R,
|
|
|
|
|
IADD_IMM,
|
2018-08-24 18:15:43 +02:00
|
|
|
|
IADD3_C, // Add 3 Integers
|
2018-08-23 21:46:59 +02:00
|
|
|
|
IADD3_R,
|
|
|
|
|
IADD3_IMM,
|
2018-06-12 18:24:10 +02:00
|
|
|
|
IADD32I,
|
2018-06-05 01:29:51 +02:00
|
|
|
|
ISCADD_C, // Scale and Add
|
|
|
|
|
ISCADD_R,
|
|
|
|
|
ISCADD_IMM,
|
2019-11-08 14:04:15 +01:00
|
|
|
|
FLO_R,
|
|
|
|
|
FLO_C,
|
|
|
|
|
FLO_IMM,
|
2018-09-11 18:26:42 +02:00
|
|
|
|
LEA_R1,
|
|
|
|
|
LEA_R2,
|
|
|
|
|
LEA_RZ,
|
|
|
|
|
LEA_IMM,
|
|
|
|
|
LEA_HI,
|
2018-10-15 07:04:31 +02:00
|
|
|
|
HADD2_C,
|
|
|
|
|
HADD2_R,
|
2018-10-15 07:07:16 +02:00
|
|
|
|
HADD2_IMM,
|
2018-10-15 07:04:31 +02:00
|
|
|
|
HMUL2_C,
|
|
|
|
|
HMUL2_R,
|
2018-10-15 07:07:16 +02:00
|
|
|
|
HMUL2_IMM,
|
2018-10-15 07:08:31 +02:00
|
|
|
|
HFMA2_CR,
|
|
|
|
|
HFMA2_RC,
|
|
|
|
|
HFMA2_RR,
|
|
|
|
|
HFMA2_IMM_R,
|
2019-05-14 22:16:23 +02:00
|
|
|
|
HSETP2_C,
|
2018-10-15 07:09:40 +02:00
|
|
|
|
HSETP2_R,
|
2019-05-14 22:16:23 +02:00
|
|
|
|
HSETP2_IMM,
|
2018-10-15 07:10:15 +02:00
|
|
|
|
HSET2_R,
|
2018-08-31 03:32:58 +02:00
|
|
|
|
POPC_C,
|
|
|
|
|
POPC_R,
|
|
|
|
|
POPC_IMM,
|
2018-07-22 06:37:12 +02:00
|
|
|
|
SEL_C,
|
|
|
|
|
SEL_R,
|
|
|
|
|
SEL_IMM,
|
2019-09-20 02:56:29 +02:00
|
|
|
|
ICMP_RC,
|
|
|
|
|
ICMP_R,
|
|
|
|
|
ICMP_CR,
|
2019-09-20 17:41:05 +02:00
|
|
|
|
ICMP_IMM,
|
2020-01-27 05:14:25 +01:00
|
|
|
|
FCMP_R,
|
2018-06-01 06:03:23 +02:00
|
|
|
|
MUFU, // Multi-Function Operator
|
|
|
|
|
RRO_C, // Range Reduction Operator
|
|
|
|
|
RRO_R,
|
|
|
|
|
RRO_IMM,
|
2018-04-21 04:23:52 +02:00
|
|
|
|
F2F_C,
|
|
|
|
|
F2F_R,
|
|
|
|
|
F2F_IMM,
|
|
|
|
|
F2I_C,
|
|
|
|
|
F2I_R,
|
|
|
|
|
F2I_IMM,
|
|
|
|
|
I2F_C,
|
|
|
|
|
I2F_R,
|
|
|
|
|
I2F_IMM,
|
2018-04-25 19:52:55 +02:00
|
|
|
|
I2I_C,
|
|
|
|
|
I2I_R,
|
|
|
|
|
I2I_IMM,
|
2018-06-17 19:26:11 +02:00
|
|
|
|
LOP_C,
|
|
|
|
|
LOP_R,
|
|
|
|
|
LOP_IMM,
|
2018-04-21 04:23:52 +02:00
|
|
|
|
LOP32I,
|
2018-08-22 09:02:18 +02:00
|
|
|
|
LOP3_C,
|
|
|
|
|
LOP3_R,
|
|
|
|
|
LOP3_IMM,
|
2018-04-21 04:23:52 +02:00
|
|
|
|
MOV_C,
|
|
|
|
|
MOV_R,
|
|
|
|
|
MOV_IMM,
|
2018-10-07 04:17:31 +02:00
|
|
|
|
MOV_SYS,
|
2018-04-27 05:21:17 +02:00
|
|
|
|
MOV32_IMM,
|
2018-06-05 04:15:19 +02:00
|
|
|
|
SHL_C,
|
|
|
|
|
SHL_R,
|
|
|
|
|
SHL_IMM,
|
2018-04-21 04:23:52 +02:00
|
|
|
|
SHR_C,
|
|
|
|
|
SHR_R,
|
|
|
|
|
SHR_IMM,
|
2019-11-08 14:04:15 +01:00
|
|
|
|
SHF_RIGHT_R,
|
|
|
|
|
SHF_RIGHT_IMM,
|
|
|
|
|
SHF_LEFT_R,
|
|
|
|
|
SHF_LEFT_IMM,
|
2018-05-25 01:37:18 +02:00
|
|
|
|
FMNMX_C,
|
|
|
|
|
FMNMX_R,
|
|
|
|
|
FMNMX_IMM,
|
2018-06-06 05:48:38 +02:00
|
|
|
|
IMNMX_C,
|
|
|
|
|
IMNMX_R,
|
|
|
|
|
IMNMX_IMM,
|
2018-04-21 04:23:52 +02:00
|
|
|
|
FSETP_C, // Set Predicate
|
2018-04-21 02:49:05 +02:00
|
|
|
|
FSETP_R,
|
|
|
|
|
FSETP_IMM,
|
2018-04-25 05:42:54 +02:00
|
|
|
|
FSET_C,
|
|
|
|
|
FSET_R,
|
|
|
|
|
FSET_IMM,
|
2018-04-21 04:23:52 +02:00
|
|
|
|
ISETP_C,
|
|
|
|
|
ISETP_IMM,
|
|
|
|
|
ISETP_R,
|
2018-06-09 22:56:50 +02:00
|
|
|
|
ISET_R,
|
|
|
|
|
ISET_C,
|
|
|
|
|
ISET_IMM,
|
2018-05-19 18:41:14 +02:00
|
|
|
|
PSETP,
|
2018-09-11 18:26:42 +02:00
|
|
|
|
PSET,
|
2018-09-09 04:44:20 +02:00
|
|
|
|
CSETP,
|
2018-11-21 08:36:44 +01:00
|
|
|
|
R2P_IMM,
|
2019-12-20 21:41:27 +01:00
|
|
|
|
P2R_IMM,
|
2018-06-06 05:48:38 +02:00
|
|
|
|
XMAD_IMM,
|
|
|
|
|
XMAD_CR,
|
|
|
|
|
XMAD_RC,
|
|
|
|
|
XMAD_RR,
|
2018-04-21 02:49:05 +02:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
enum class Type {
|
|
|
|
|
Trivial,
|
|
|
|
|
Arithmetic,
|
2018-06-19 02:50:35 +02:00
|
|
|
|
ArithmeticImmediate,
|
2018-06-09 05:25:22 +02:00
|
|
|
|
ArithmeticInteger,
|
2018-06-12 18:24:10 +02:00
|
|
|
|
ArithmeticIntegerImmediate,
|
2018-10-15 07:04:31 +02:00
|
|
|
|
ArithmeticHalf,
|
2018-10-15 07:07:16 +02:00
|
|
|
|
ArithmeticHalfImmediate,
|
2018-06-07 06:58:12 +02:00
|
|
|
|
Bfe,
|
2018-11-21 20:01:35 +01:00
|
|
|
|
Bfi,
|
2018-06-05 04:15:19 +02:00
|
|
|
|
Shift,
|
2018-04-21 02:49:05 +02:00
|
|
|
|
Ffma,
|
2018-10-15 07:08:31 +02:00
|
|
|
|
Hfma2,
|
2018-04-21 02:49:05 +02:00
|
|
|
|
Flow,
|
2018-07-04 22:29:51 +02:00
|
|
|
|
Synch,
|
2019-08-10 04:50:21 +02:00
|
|
|
|
Warp,
|
2018-04-21 02:49:05 +02:00
|
|
|
|
Memory,
|
2019-02-22 06:19:45 +01:00
|
|
|
|
Texture,
|
2019-04-27 07:07:18 +02:00
|
|
|
|
Image,
|
2018-04-25 05:42:54 +02:00
|
|
|
|
FloatSet,
|
|
|
|
|
FloatSetPredicate,
|
2018-06-09 22:56:50 +02:00
|
|
|
|
IntegerSet,
|
2018-04-25 05:42:54 +02:00
|
|
|
|
IntegerSetPredicate,
|
2018-10-15 07:10:15 +02:00
|
|
|
|
HalfSet,
|
2018-10-15 07:09:40 +02:00
|
|
|
|
HalfSetPredicate,
|
2018-05-19 18:41:14 +02:00
|
|
|
|
PredicateSetPredicate,
|
2018-09-11 18:26:42 +02:00
|
|
|
|
PredicateSetRegister,
|
2018-11-21 08:36:44 +01:00
|
|
|
|
RegisterSetPredicate,
|
2018-04-29 02:01:36 +02:00
|
|
|
|
Conversion,
|
2018-12-24 05:23:00 +01:00
|
|
|
|
Video,
|
2018-08-12 22:51:32 +02:00
|
|
|
|
Xmad,
|
2018-04-21 02:49:05 +02:00
|
|
|
|
Unknown,
|
|
|
|
|
};
|
|
|
|
|
|
2018-08-11 23:00:14 +02:00
|
|
|
|
/// Returns whether an opcode has an execution predicate field or not (ie, whether it can be
|
|
|
|
|
/// conditionally executed).
|
|
|
|
|
static bool IsPredicatedInstruction(Id opcode) {
|
|
|
|
|
// TODO(Subv): Add the rest of unpredicated instructions.
|
2018-10-16 22:11:26 +02:00
|
|
|
|
return opcode != Id::SSY && opcode != Id::PBK;
|
2018-08-11 23:00:14 +02:00
|
|
|
|
}
|
|
|
|
|
|
2018-04-21 02:49:05 +02:00
|
|
|
|
class Matcher {
|
|
|
|
|
public:
|
2019-10-24 06:57:19 +02:00
|
|
|
|
constexpr Matcher(const char* const name, u16 mask, u16 expected, Id id, Type type)
|
2018-04-21 02:49:05 +02:00
|
|
|
|
: name{name}, mask{mask}, expected{expected}, id{id}, type{type} {}
|
|
|
|
|
|
2019-10-24 06:57:19 +02:00
|
|
|
|
constexpr const char* GetName() const {
|
2018-04-21 02:49:05 +02:00
|
|
|
|
return name;
|
|
|
|
|
}
|
|
|
|
|
|
2019-10-24 06:57:19 +02:00
|
|
|
|
constexpr u16 GetMask() const {
|
2018-04-21 02:49:05 +02:00
|
|
|
|
return mask;
|
|
|
|
|
}
|
|
|
|
|
|
2019-10-24 06:57:19 +02:00
|
|
|
|
constexpr Id GetId() const {
|
2018-04-21 02:49:05 +02:00
|
|
|
|
return id;
|
|
|
|
|
}
|
|
|
|
|
|
2019-10-24 06:57:19 +02:00
|
|
|
|
constexpr Type GetType() const {
|
2018-04-21 02:49:05 +02:00
|
|
|
|
return type;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Tests to see if the given instruction is the instruction this matcher represents.
|
|
|
|
|
* @param instruction The instruction to test
|
|
|
|
|
* @returns true if the given instruction matches.
|
|
|
|
|
*/
|
2019-10-24 06:57:19 +02:00
|
|
|
|
constexpr bool Matches(u16 instruction) const {
|
2018-04-21 02:49:05 +02:00
|
|
|
|
return (instruction & mask) == expected;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
const char* name;
|
|
|
|
|
u16 mask;
|
|
|
|
|
u16 expected;
|
|
|
|
|
Id id;
|
|
|
|
|
Type type;
|
|
|
|
|
};
|
|
|
|
|
|
2018-10-30 05:03:25 +01:00
|
|
|
|
static std::optional<std::reference_wrapper<const Matcher>> Decode(Instruction instr) {
|
2018-04-21 02:49:05 +02:00
|
|
|
|
static const auto table{GetDecodeTable()};
|
|
|
|
|
|
|
|
|
|
const auto matches_instruction = [instr](const auto& matcher) {
|
|
|
|
|
return matcher.Matches(static_cast<u16>(instr.opcode));
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
auto iter = std::find_if(table.begin(), table.end(), matches_instruction);
|
2018-10-30 05:03:25 +01:00
|
|
|
|
return iter != table.end() ? std::optional<std::reference_wrapper<const Matcher>>(*iter)
|
|
|
|
|
: std::nullopt;
|
2018-04-21 02:49:05 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
struct Detail {
|
|
|
|
|
private:
|
2018-09-15 15:21:06 +02:00
|
|
|
|
static constexpr std::size_t opcode_bitsize = 16;
|
2018-04-21 02:49:05 +02:00
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Generates the mask and the expected value after masking from a given bitstring.
|
|
|
|
|
* A '0' in a bitstring indicates that a zero must be present at that bit position.
|
|
|
|
|
* A '1' in a bitstring indicates that a one must be present at that bit position.
|
|
|
|
|
*/
|
2019-10-24 06:57:19 +02:00
|
|
|
|
static constexpr auto GetMaskAndExpect(const char* const bitstring) {
|
2018-04-21 02:49:05 +02:00
|
|
|
|
u16 mask = 0, expect = 0;
|
2018-09-15 15:21:06 +02:00
|
|
|
|
for (std::size_t i = 0; i < opcode_bitsize; i++) {
|
|
|
|
|
const std::size_t bit_position = opcode_bitsize - i - 1;
|
2018-04-21 02:49:05 +02:00
|
|
|
|
switch (bitstring[i]) {
|
|
|
|
|
case '0':
|
2019-11-08 21:08:07 +01:00
|
|
|
|
mask |= static_cast<u16>(1U << bit_position);
|
2018-04-21 02:49:05 +02:00
|
|
|
|
break;
|
|
|
|
|
case '1':
|
2019-11-08 21:08:07 +01:00
|
|
|
|
expect |= static_cast<u16>(1U << bit_position);
|
|
|
|
|
mask |= static_cast<u16>(1U << bit_position);
|
2018-04-21 02:49:05 +02:00
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
// Ignore
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
2019-10-24 06:57:19 +02:00
|
|
|
|
return std::make_pair(mask, expect);
|
2018-04-21 02:49:05 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
/// Creates a matcher that can match and parse instructions based on bitstring.
|
2019-10-24 06:57:19 +02:00
|
|
|
|
static constexpr auto GetMatcher(const char* const bitstring, Id op, Type type,
|
|
|
|
|
const char* const name) {
|
|
|
|
|
const auto [mask, expected] = GetMaskAndExpect(bitstring);
|
|
|
|
|
return Matcher(name, mask, expected, op, type);
|
2018-04-21 02:49:05 +02:00
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
static std::vector<Matcher> GetDecodeTable() {
|
|
|
|
|
std::vector<Matcher> table = {
|
|
|
|
|
#define INST(bitstring, op, type, name) Detail::GetMatcher(bitstring, op, type, name)
|
|
|
|
|
INST("111000110011----", Id::KIL, Type::Flow, "KIL"),
|
2018-06-09 05:46:10 +02:00
|
|
|
|
INST("111000101001----", Id::SSY, Type::Flow, "SSY"),
|
2018-10-16 22:11:26 +02:00
|
|
|
|
INST("111000101010----", Id::PBK, Type::Flow, "PBK"),
|
2018-06-02 21:22:55 +02:00
|
|
|
|
INST("111000100100----", Id::BRA, Type::Flow, "BRA"),
|
2019-06-25 03:25:38 +02:00
|
|
|
|
INST("111000100101----", Id::BRX, Type::Flow, "BRX"),
|
2018-10-16 22:11:26 +02:00
|
|
|
|
INST("1111000011111---", Id::SYNC, Type::Flow, "SYNC"),
|
2019-12-10 01:46:12 +01:00
|
|
|
|
INST("111000110100----", Id::BRK, Type::Flow, "BRK"),
|
2019-06-04 18:18:35 +02:00
|
|
|
|
INST("111000110000----", Id::EXIT, Type::Flow, "EXIT"),
|
2018-07-04 22:29:51 +02:00
|
|
|
|
INST("1111000011110---", Id::DEPBAR, Type::Synch, "DEPBAR"),
|
2019-08-10 04:50:21 +02:00
|
|
|
|
INST("0101000011011---", Id::VOTE, Type::Warp, "VOTE"),
|
2019-08-27 03:09:12 +02:00
|
|
|
|
INST("1110111100010---", Id::SHFL, Type::Warp, "SHFL"),
|
2019-11-03 03:44:46 +01:00
|
|
|
|
INST("0101000011111---", Id::FSWZADD, Type::Warp, "FSWZADD"),
|
2018-04-21 02:49:05 +02:00
|
|
|
|
INST("1110111111011---", Id::LD_A, Type::Memory, "LD_A"),
|
2018-10-20 03:48:21 +02:00
|
|
|
|
INST("1110111101001---", Id::LD_S, Type::Memory, "LD_S"),
|
|
|
|
|
INST("1110111101000---", Id::LD_L, Type::Memory, "LD_L"),
|
2018-06-06 05:46:23 +02:00
|
|
|
|
INST("1110111110010---", Id::LD_C, Type::Memory, "LD_C"),
|
2019-05-18 07:35:01 +02:00
|
|
|
|
INST("100-------------", Id::LD, Type::Memory, "LD"),
|
|
|
|
|
INST("1110111011010---", Id::LDG, Type::Memory, "LDG"),
|
2018-04-21 02:49:05 +02:00
|
|
|
|
INST("1110111111110---", Id::ST_A, Type::Memory, "ST_A"),
|
2018-10-20 03:48:21 +02:00
|
|
|
|
INST("1110111101011---", Id::ST_S, Type::Memory, "ST_S"),
|
|
|
|
|
INST("1110111101010---", Id::ST_L, Type::Memory, "ST_L"),
|
2019-05-18 07:51:12 +02:00
|
|
|
|
INST("101-------------", Id::ST, Type::Memory, "ST"),
|
2018-08-19 07:46:34 +02:00
|
|
|
|
INST("1110111011011---", Id::STG, Type::Memory, "STG"),
|
2020-01-26 01:03:02 +01:00
|
|
|
|
INST("11101101--------", Id::ATOM, Type::Memory, "ATOM"),
|
2020-01-16 08:00:52 +01:00
|
|
|
|
INST("11101100--------", Id::ATOMS, Type::Memory, "ATOMS"),
|
2019-04-30 04:27:15 +02:00
|
|
|
|
INST("1110111110100---", Id::AL2P, Type::Memory, "AL2P"),
|
2019-02-22 06:19:45 +01:00
|
|
|
|
INST("110000----111---", Id::TEX, Type::Texture, "TEX"),
|
2019-03-26 22:05:23 +01:00
|
|
|
|
INST("1101111010111---", Id::TEX_B, Type::Texture, "TEX_B"),
|
2019-02-22 06:19:45 +01:00
|
|
|
|
INST("1101111101001---", Id::TXQ, Type::Texture, "TXQ"),
|
2019-03-27 00:46:11 +01:00
|
|
|
|
INST("1101111101010---", Id::TXQ_B, Type::Texture, "TXQ_B"),
|
2019-02-22 06:19:45 +01:00
|
|
|
|
INST("1101-00---------", Id::TEXS, Type::Texture, "TEXS"),
|
2019-04-28 01:50:35 +02:00
|
|
|
|
INST("11011100--11----", Id::TLD, Type::Texture, "TLD"),
|
2019-05-14 20:47:58 +02:00
|
|
|
|
INST("1101-01---------", Id::TLDS, Type::Texture, "TLDS"),
|
2019-02-22 06:19:45 +01:00
|
|
|
|
INST("110010----111---", Id::TLD4, Type::Texture, "TLD4"),
|
2019-10-30 01:48:18 +01:00
|
|
|
|
INST("1101111011111---", Id::TLD4_B, Type::Texture, "TLD4_B"),
|
2019-12-18 02:51:51 +01:00
|
|
|
|
INST("11011111-0------", Id::TLD4S, Type::Texture, "TLD4S"),
|
2019-02-22 06:19:45 +01:00
|
|
|
|
INST("110111110110----", Id::TMML_B, Type::Texture, "TMML_B"),
|
|
|
|
|
INST("1101111101011---", Id::TMML, Type::Texture, "TMML"),
|
2019-11-08 14:04:15 +01:00
|
|
|
|
INST("11011110011110--", Id::TXD_B, Type::Texture, "TXD_B"),
|
|
|
|
|
INST("11011110001110--", Id::TXD, Type::Texture, "TXD"),
|
2019-04-27 07:07:18 +02:00
|
|
|
|
INST("11101011001-----", Id::SUST, Type::Image, "SUST"),
|
2019-09-18 03:38:01 +02:00
|
|
|
|
INST("11101011000-----", Id::SULD, Type::Image, "SULD"),
|
2019-07-18 02:03:53 +02:00
|
|
|
|
INST("1110101000------", Id::SUATOM, Type::Image, "SUATOM_D"),
|
2019-07-30 02:18:30 +02:00
|
|
|
|
INST("0101000010110---", Id::NOP, Type::Trivial, "NOP"),
|
2018-04-21 02:49:05 +02:00
|
|
|
|
INST("11100000--------", Id::IPA, Type::Trivial, "IPA"),
|
2018-10-07 04:17:31 +02:00
|
|
|
|
INST("1111101111100---", Id::OUT_R, Type::Trivial, "OUT_R"),
|
|
|
|
|
INST("1110111111010---", Id::ISBERD, Type::Trivial, "ISBERD"),
|
2019-12-10 01:46:12 +01:00
|
|
|
|
INST("1110111110011---", Id::MEMBAR, Type::Trivial, "MEMBAR"),
|
2018-12-24 05:23:00 +01:00
|
|
|
|
INST("01011111--------", Id::VMAD, Type::Video, "VMAD"),
|
|
|
|
|
INST("0101000011110---", Id::VSETP, Type::Video, "VSETP"),
|
2018-07-12 17:15:48 +02:00
|
|
|
|
INST("0011001-1-------", Id::FFMA_IMM, Type::Ffma, "FFMA_IMM"),
|
2018-04-21 02:49:05 +02:00
|
|
|
|
INST("010010011-------", Id::FFMA_CR, Type::Ffma, "FFMA_CR"),
|
|
|
|
|
INST("010100011-------", Id::FFMA_RC, Type::Ffma, "FFMA_RC"),
|
|
|
|
|
INST("010110011-------", Id::FFMA_RR, Type::Ffma, "FFMA_RR"),
|
|
|
|
|
INST("0100110001011---", Id::FADD_C, Type::Arithmetic, "FADD_C"),
|
|
|
|
|
INST("0101110001011---", Id::FADD_R, Type::Arithmetic, "FADD_R"),
|
|
|
|
|
INST("0011100-01011---", Id::FADD_IMM, Type::Arithmetic, "FADD_IMM"),
|
2018-07-12 19:00:31 +02:00
|
|
|
|
INST("000010----------", Id::FADD32I, Type::ArithmeticImmediate, "FADD32I"),
|
2018-04-21 02:49:05 +02:00
|
|
|
|
INST("0100110001101---", Id::FMUL_C, Type::Arithmetic, "FMUL_C"),
|
|
|
|
|
INST("0101110001101---", Id::FMUL_R, Type::Arithmetic, "FMUL_R"),
|
|
|
|
|
INST("0011100-01101---", Id::FMUL_IMM, Type::Arithmetic, "FMUL_IMM"),
|
2018-06-19 02:50:35 +02:00
|
|
|
|
INST("00011110--------", Id::FMUL32_IMM, Type::ArithmeticImmediate, "FMUL32_IMM"),
|
2018-06-09 05:25:22 +02:00
|
|
|
|
INST("0100110000010---", Id::IADD_C, Type::ArithmeticInteger, "IADD_C"),
|
|
|
|
|
INST("0101110000010---", Id::IADD_R, Type::ArithmeticInteger, "IADD_R"),
|
|
|
|
|
INST("0011100-00010---", Id::IADD_IMM, Type::ArithmeticInteger, "IADD_IMM"),
|
2018-08-23 21:46:59 +02:00
|
|
|
|
INST("010011001100----", Id::IADD3_C, Type::ArithmeticInteger, "IADD3_C"),
|
|
|
|
|
INST("010111001100----", Id::IADD3_R, Type::ArithmeticInteger, "IADD3_R"),
|
|
|
|
|
INST("0011100-1100----", Id::IADD3_IMM, Type::ArithmeticInteger, "IADD3_IMM"),
|
2018-06-12 18:24:10 +02:00
|
|
|
|
INST("0001110---------", Id::IADD32I, Type::ArithmeticIntegerImmediate, "IADD32I"),
|
2018-06-09 05:25:22 +02:00
|
|
|
|
INST("0100110000011---", Id::ISCADD_C, Type::ArithmeticInteger, "ISCADD_C"),
|
|
|
|
|
INST("0101110000011---", Id::ISCADD_R, Type::ArithmeticInteger, "ISCADD_R"),
|
|
|
|
|
INST("0011100-00011---", Id::ISCADD_IMM, Type::ArithmeticInteger, "ISCADD_IMM"),
|
2018-08-31 03:32:58 +02:00
|
|
|
|
INST("0100110000001---", Id::POPC_C, Type::ArithmeticInteger, "POPC_C"),
|
|
|
|
|
INST("0101110000001---", Id::POPC_R, Type::ArithmeticInteger, "POPC_R"),
|
|
|
|
|
INST("0011100-00001---", Id::POPC_IMM, Type::ArithmeticInteger, "POPC_IMM"),
|
2018-07-22 06:37:12 +02:00
|
|
|
|
INST("0100110010100---", Id::SEL_C, Type::ArithmeticInteger, "SEL_C"),
|
|
|
|
|
INST("0101110010100---", Id::SEL_R, Type::ArithmeticInteger, "SEL_R"),
|
2018-08-24 06:18:12 +02:00
|
|
|
|
INST("0011100-10100---", Id::SEL_IMM, Type::ArithmeticInteger, "SEL_IMM"),
|
2019-09-20 02:56:29 +02:00
|
|
|
|
INST("010100110100----", Id::ICMP_RC, Type::ArithmeticInteger, "ICMP_RC"),
|
|
|
|
|
INST("010110110100----", Id::ICMP_R, Type::ArithmeticInteger, "ICMP_R"),
|
|
|
|
|
INST("010010110100----", Id::ICMP_CR, Type::ArithmeticInteger, "ICMP_CR"),
|
2019-09-20 17:41:05 +02:00
|
|
|
|
INST("0011011-0100----", Id::ICMP_IMM, Type::ArithmeticInteger, "ICMP_IMM"),
|
2019-12-07 00:31:56 +01:00
|
|
|
|
INST("0101110000110---", Id::FLO_R, Type::ArithmeticInteger, "FLO_R"),
|
2019-11-08 14:04:15 +01:00
|
|
|
|
INST("0100110000110---", Id::FLO_C, Type::ArithmeticInteger, "FLO_C"),
|
|
|
|
|
INST("0011100-00110---", Id::FLO_IMM, Type::ArithmeticInteger, "FLO_IMM"),
|
2018-09-11 18:26:42 +02:00
|
|
|
|
INST("0101101111011---", Id::LEA_R2, Type::ArithmeticInteger, "LEA_R2"),
|
|
|
|
|
INST("0101101111010---", Id::LEA_R1, Type::ArithmeticInteger, "LEA_R1"),
|
|
|
|
|
INST("001101101101----", Id::LEA_IMM, Type::ArithmeticInteger, "LEA_IMM"),
|
|
|
|
|
INST("010010111101----", Id::LEA_RZ, Type::ArithmeticInteger, "LEA_RZ"),
|
|
|
|
|
INST("00011000--------", Id::LEA_HI, Type::ArithmeticInteger, "LEA_HI"),
|
2018-10-15 07:04:31 +02:00
|
|
|
|
INST("0111101-1-------", Id::HADD2_C, Type::ArithmeticHalf, "HADD2_C"),
|
|
|
|
|
INST("0101110100010---", Id::HADD2_R, Type::ArithmeticHalf, "HADD2_R"),
|
2018-10-15 07:07:16 +02:00
|
|
|
|
INST("0111101-0-------", Id::HADD2_IMM, Type::ArithmeticHalfImmediate, "HADD2_IMM"),
|
2018-10-15 07:04:31 +02:00
|
|
|
|
INST("0111100-1-------", Id::HMUL2_C, Type::ArithmeticHalf, "HMUL2_C"),
|
|
|
|
|
INST("0101110100001---", Id::HMUL2_R, Type::ArithmeticHalf, "HMUL2_R"),
|
2018-10-15 07:07:16 +02:00
|
|
|
|
INST("0111100-0-------", Id::HMUL2_IMM, Type::ArithmeticHalfImmediate, "HMUL2_IMM"),
|
2018-10-15 07:08:31 +02:00
|
|
|
|
INST("01110---1-------", Id::HFMA2_CR, Type::Hfma2, "HFMA2_CR"),
|
|
|
|
|
INST("01100---1-------", Id::HFMA2_RC, Type::Hfma2, "HFMA2_RC"),
|
|
|
|
|
INST("0101110100000---", Id::HFMA2_RR, Type::Hfma2, "HFMA2_RR"),
|
|
|
|
|
INST("01110---0-------", Id::HFMA2_IMM_R, Type::Hfma2, "HFMA2_R_IMM"),
|
2019-05-14 22:16:23 +02:00
|
|
|
|
INST("0111111-1-------", Id::HSETP2_C, Type::HalfSetPredicate, "HSETP2_C"),
|
|
|
|
|
INST("0101110100100---", Id::HSETP2_R, Type::HalfSetPredicate, "HSETP2_R"),
|
|
|
|
|
INST("0111111-0-------", Id::HSETP2_IMM, Type::HalfSetPredicate, "HSETP2_IMM"),
|
2018-10-15 07:10:15 +02:00
|
|
|
|
INST("0101110100011---", Id::HSET2_R, Type::HalfSet, "HSET2_R"),
|
2020-01-27 05:14:25 +01:00
|
|
|
|
INST("010110111010----", Id::FCMP_R, Type::Arithmetic, "FCMP_R"),
|
2018-04-21 02:49:05 +02:00
|
|
|
|
INST("0101000010000---", Id::MUFU, Type::Arithmetic, "MUFU"),
|
2018-06-01 06:03:23 +02:00
|
|
|
|
INST("0100110010010---", Id::RRO_C, Type::Arithmetic, "RRO_C"),
|
|
|
|
|
INST("0101110010010---", Id::RRO_R, Type::Arithmetic, "RRO_R"),
|
|
|
|
|
INST("0011100-10010---", Id::RRO_IMM, Type::Arithmetic, "RRO_IMM"),
|
2018-05-30 05:10:44 +02:00
|
|
|
|
INST("0100110010101---", Id::F2F_C, Type::Conversion, "F2F_C"),
|
|
|
|
|
INST("0101110010101---", Id::F2F_R, Type::Conversion, "F2F_R"),
|
|
|
|
|
INST("0011100-10101---", Id::F2F_IMM, Type::Conversion, "F2F_IMM"),
|
2018-06-05 01:05:12 +02:00
|
|
|
|
INST("0100110010110---", Id::F2I_C, Type::Conversion, "F2I_C"),
|
|
|
|
|
INST("0101110010110---", Id::F2I_R, Type::Conversion, "F2I_R"),
|
|
|
|
|
INST("0011100-10110---", Id::F2I_IMM, Type::Conversion, "F2I_IMM"),
|
2018-04-21 04:23:52 +02:00
|
|
|
|
INST("0100110010011---", Id::MOV_C, Type::Arithmetic, "MOV_C"),
|
|
|
|
|
INST("0101110010011---", Id::MOV_R, Type::Arithmetic, "MOV_R"),
|
|
|
|
|
INST("0011100-10011---", Id::MOV_IMM, Type::Arithmetic, "MOV_IMM"),
|
2018-10-07 04:17:31 +02:00
|
|
|
|
INST("1111000011001---", Id::MOV_SYS, Type::Trivial, "MOV_SYS"),
|
2018-06-19 02:50:35 +02:00
|
|
|
|
INST("000000010000----", Id::MOV32_IMM, Type::ArithmeticImmediate, "MOV32_IMM"),
|
2018-05-25 01:37:18 +02:00
|
|
|
|
INST("0100110001100---", Id::FMNMX_C, Type::Arithmetic, "FMNMX_C"),
|
|
|
|
|
INST("0101110001100---", Id::FMNMX_R, Type::Arithmetic, "FMNMX_R"),
|
|
|
|
|
INST("0011100-01100---", Id::FMNMX_IMM, Type::Arithmetic, "FMNMX_IMM"),
|
2018-07-04 22:25:48 +02:00
|
|
|
|
INST("0100110000100---", Id::IMNMX_C, Type::ArithmeticInteger, "IMNMX_C"),
|
|
|
|
|
INST("0101110000100---", Id::IMNMX_R, Type::ArithmeticInteger, "IMNMX_R"),
|
|
|
|
|
INST("0011100-00100---", Id::IMNMX_IMM, Type::ArithmeticInteger, "IMNMX_IMM"),
|
2018-06-07 06:58:12 +02:00
|
|
|
|
INST("0100110000000---", Id::BFE_C, Type::Bfe, "BFE_C"),
|
|
|
|
|
INST("0101110000000---", Id::BFE_R, Type::Bfe, "BFE_R"),
|
|
|
|
|
INST("0011100-00000---", Id::BFE_IMM, Type::Bfe, "BFE_IMM"),
|
2020-01-27 05:19:00 +01:00
|
|
|
|
INST("0101001111110---", Id::BFI_RC, Type::Bfi, "BFI_RC"),
|
2018-11-21 20:01:35 +01:00
|
|
|
|
INST("0011011-11110---", Id::BFI_IMM_R, Type::Bfi, "BFI_IMM_R"),
|
2018-06-17 19:26:11 +02:00
|
|
|
|
INST("0100110001000---", Id::LOP_C, Type::ArithmeticInteger, "LOP_C"),
|
|
|
|
|
INST("0101110001000---", Id::LOP_R, Type::ArithmeticInteger, "LOP_R"),
|
2019-04-08 19:39:12 +02:00
|
|
|
|
INST("0011100-01000---", Id::LOP_IMM, Type::ArithmeticInteger, "LOP_IMM"),
|
2018-06-17 18:49:34 +02:00
|
|
|
|
INST("000001----------", Id::LOP32I, Type::ArithmeticIntegerImmediate, "LOP32I"),
|
2018-08-22 09:02:18 +02:00
|
|
|
|
INST("0000001---------", Id::LOP3_C, Type::ArithmeticInteger, "LOP3_C"),
|
|
|
|
|
INST("0101101111100---", Id::LOP3_R, Type::ArithmeticInteger, "LOP3_R"),
|
|
|
|
|
INST("0011110---------", Id::LOP3_IMM, Type::ArithmeticInteger, "LOP3_IMM"),
|
2018-06-05 04:15:19 +02:00
|
|
|
|
INST("0100110001001---", Id::SHL_C, Type::Shift, "SHL_C"),
|
|
|
|
|
INST("0101110001001---", Id::SHL_R, Type::Shift, "SHL_R"),
|
|
|
|
|
INST("0011100-01001---", Id::SHL_IMM, Type::Shift, "SHL_IMM"),
|
|
|
|
|
INST("0100110000101---", Id::SHR_C, Type::Shift, "SHR_C"),
|
|
|
|
|
INST("0101110000101---", Id::SHR_R, Type::Shift, "SHR_R"),
|
|
|
|
|
INST("0011100-00101---", Id::SHR_IMM, Type::Shift, "SHR_IMM"),
|
2019-11-08 14:04:15 +01:00
|
|
|
|
INST("0101110011111---", Id::SHF_RIGHT_R, Type::Shift, "SHF_RIGHT_R"),
|
|
|
|
|
INST("0011100-11111---", Id::SHF_RIGHT_IMM, Type::Shift, "SHF_RIGHT_IMM"),
|
|
|
|
|
INST("0101101111111---", Id::SHF_LEFT_R, Type::Shift, "SHF_LEFT_R"),
|
|
|
|
|
INST("0011011-11111---", Id::SHF_LEFT_IMM, Type::Shift, "SHF_LEFT_IMM"),
|
2018-04-29 02:01:36 +02:00
|
|
|
|
INST("0100110011100---", Id::I2I_C, Type::Conversion, "I2I_C"),
|
|
|
|
|
INST("0101110011100---", Id::I2I_R, Type::Conversion, "I2I_R"),
|
2020-03-28 22:49:07 +01:00
|
|
|
|
INST("0011100-11100---", Id::I2I_IMM, Type::Conversion, "I2I_IMM"),
|
2018-04-29 02:01:36 +02:00
|
|
|
|
INST("0100110010111---", Id::I2F_C, Type::Conversion, "I2F_C"),
|
|
|
|
|
INST("0101110010111---", Id::I2F_R, Type::Conversion, "I2F_R"),
|
|
|
|
|
INST("0011100-10111---", Id::I2F_IMM, Type::Conversion, "I2F_IMM"),
|
2018-04-25 05:42:54 +02:00
|
|
|
|
INST("01011000--------", Id::FSET_R, Type::FloatSet, "FSET_R"),
|
|
|
|
|
INST("0100100---------", Id::FSET_C, Type::FloatSet, "FSET_C"),
|
|
|
|
|
INST("0011000---------", Id::FSET_IMM, Type::FloatSet, "FSET_IMM"),
|
|
|
|
|
INST("010010111011----", Id::FSETP_C, Type::FloatSetPredicate, "FSETP_C"),
|
|
|
|
|
INST("010110111011----", Id::FSETP_R, Type::FloatSetPredicate, "FSETP_R"),
|
|
|
|
|
INST("0011011-1011----", Id::FSETP_IMM, Type::FloatSetPredicate, "FSETP_IMM"),
|
|
|
|
|
INST("010010110110----", Id::ISETP_C, Type::IntegerSetPredicate, "ISETP_C"),
|
|
|
|
|
INST("010110110110----", Id::ISETP_R, Type::IntegerSetPredicate, "ISETP_R"),
|
|
|
|
|
INST("0011011-0110----", Id::ISETP_IMM, Type::IntegerSetPredicate, "ISETP_IMM"),
|
2018-06-09 22:56:50 +02:00
|
|
|
|
INST("010110110101----", Id::ISET_R, Type::IntegerSet, "ISET_R"),
|
|
|
|
|
INST("010010110101----", Id::ISET_C, Type::IntegerSet, "ISET_C"),
|
|
|
|
|
INST("0011011-0101----", Id::ISET_IMM, Type::IntegerSet, "ISET_IMM"),
|
2018-09-11 18:26:42 +02:00
|
|
|
|
INST("0101000010001---", Id::PSET, Type::PredicateSetRegister, "PSET"),
|
2018-05-19 18:41:14 +02:00
|
|
|
|
INST("0101000010010---", Id::PSETP, Type::PredicateSetPredicate, "PSETP"),
|
2018-09-09 06:46:19 +02:00
|
|
|
|
INST("010100001010----", Id::CSETP, Type::PredicateSetPredicate, "CSETP"),
|
2018-11-21 08:36:44 +01:00
|
|
|
|
INST("0011100-11110---", Id::R2P_IMM, Type::RegisterSetPredicate, "R2P_IMM"),
|
2019-12-20 21:41:27 +01:00
|
|
|
|
INST("0011100-11101---", Id::P2R_IMM, Type::RegisterSetPredicate, "P2R_IMM"),
|
2018-08-12 22:51:32 +02:00
|
|
|
|
INST("0011011-00------", Id::XMAD_IMM, Type::Xmad, "XMAD_IMM"),
|
|
|
|
|
INST("0100111---------", Id::XMAD_CR, Type::Xmad, "XMAD_CR"),
|
|
|
|
|
INST("010100010-------", Id::XMAD_RC, Type::Xmad, "XMAD_RC"),
|
|
|
|
|
INST("0101101100------", Id::XMAD_RR, Type::Xmad, "XMAD_RR"),
|
2018-04-21 02:49:05 +02:00
|
|
|
|
};
|
|
|
|
|
#undef INST
|
|
|
|
|
std::stable_sort(table.begin(), table.end(), [](const auto& a, const auto& b) {
|
|
|
|
|
// If a matcher has more bits in its mask it is more specific, so it
|
|
|
|
|
// should come first.
|
|
|
|
|
return std::bitset<16>(a.GetMask()).count() > std::bitset<16>(b.GetMask()).count();
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
return table;
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
2018-10-19 22:54:13 +02:00
|
|
|
|
} // namespace Tegra::Shader
|