summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/nouveau/codegen/nv50_ir_target_nvc0.cpp
diff options
context:
space:
mode:
authorSamuel Pitoiset <samuel.pitoiset@gmail.com>2016-09-14 16:42:45 +0200
committerSamuel Pitoiset <samuel.pitoiset@gmail.com>2016-09-29 21:20:30 +0200
commit85132c7453230960f34cfe7b7b7fcaaab158d79f (patch)
tree875384da56aa9026285da6d7a20bb8d99c38e195 /src/gallium/drivers/nouveau/codegen/nv50_ir_target_nvc0.cpp
parent652874754a0afd0aefa16dd65afcf85842885945 (diff)
downloadexternal_mesa3d-85132c7453230960f34cfe7b7b7fcaaab158d79f.zip
external_mesa3d-85132c7453230960f34cfe7b7b7fcaaab158d79f.tar.gz
external_mesa3d-85132c7453230960f34cfe7b7b7fcaaab158d79f.tar.bz2
nv50/ir: add preliminary support for SHLADD
This instruction is available since SM20 (Fermi) and allow to do (a << b) + c in one shot. In some situations, IMAD should be replaced by SHLADD when b is a power of 2, and ADD+SHL should be replaced by SHLADD as well. Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com> Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
Diffstat (limited to 'src/gallium/drivers/nouveau/codegen/nv50_ir_target_nvc0.cpp')
-rw-r--r--src/gallium/drivers/nouveau/codegen/nv50_ir_target_nvc0.cpp11
1 files changed, 9 insertions, 2 deletions
diff --git a/src/gallium/drivers/nouveau/codegen/nv50_ir_target_nvc0.cpp b/src/gallium/drivers/nouveau/codegen/nv50_ir_target_nvc0.cpp
index f75e395..8606065 100644
--- a/src/gallium/drivers/nouveau/codegen/nv50_ir_target_nvc0.cpp
+++ b/src/gallium/drivers/nouveau/codegen/nv50_ir_target_nvc0.cpp
@@ -105,6 +105,7 @@ static const struct opProperties _initProps[] =
{ OP_MAX, 0x3, 0x3, 0x0, 0x0, 0x2, 0x2 },
{ OP_MIN, 0x3, 0x3, 0x0, 0x0, 0x2, 0x2 },
{ OP_MAD, 0x7, 0x0, 0x0, 0x8, 0x6, 0x2 | 0x8 }, // special c[] constraint
+ { OP_SHLADD, 0x5, 0x0, 0x0, 0x0, 0x4, 0x6 },
{ OP_MADSP, 0x0, 0x0, 0x0, 0x0, 0x6, 0x2 },
{ OP_ABS, 0x0, 0x0, 0x0, 0x0, 0x1, 0x0 },
{ OP_NEG, 0x0, 0x1, 0x0, 0x0, 0x1, 0x0 },
@@ -158,13 +159,13 @@ void TargetNVC0::initOpInfo()
{
// ADD, MUL, MAD, FMA, AND, OR, XOR, MAX, MIN, SET_AND, SET_OR, SET_XOR,
// SET, SELP, SLCT
- 0x0670ca00, 0x0000003f, 0x00000000, 0x00000000
+ 0x0ce0ca00, 0x0000007e, 0x00000000, 0x00000000
};
static const uint32_t shortForm[(OP_LAST + 31) / 32] =
{
// ADD, MUL, MAD, FMA, AND, OR, XOR, MAX, MIN
- 0x0670ca00, 0x00000000, 0x00000000, 0x00000000
+ 0x0ce0ca00, 0x00000000, 0x00000000, 0x00000000
};
static const operation noDest[] =
@@ -451,6 +452,12 @@ TargetNVC0::isModSupported(const Instruction *insn, int s, Modifier mod) const
if (s == 0)
return insn->src(1).mod.neg() ? false : true;
break;
+ case OP_SHLADD:
+ if (s == 1)
+ return false;
+ if (insn->src(s ? 0 : 2).mod.neg())
+ return false;
+ break;
default:
return false;
}