aboutsummaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers
diff options
context:
space:
mode:
authorBoyan Ding <[email protected]>2017-04-10 22:55:59 +0800
committerIlia Mirkin <[email protected]>2017-04-13 02:24:52 -0400
commitc32e150008dbae1da2a69031056ece7f7f7febb2 (patch)
treef1c484feb6776a357b0276066ac9aec2aa13c83c /src/gallium/drivers
parentd941ef38292dd86469a792c8359e0fc8c4fa154c (diff)
nvc0/ir: Emit OP_SHFL
v2: (Samuel Pitoiset) Add an assertion to check if the target is Kepler Make sure that asImm() is not NULL v3: (Ilia Mirkin) Check the range of immediate value of OP_SHFL Use the new setPDSTL API Signed-off-by: Boyan Ding <[email protected]> Reviewed-by: Ilia Mirkin <[email protected]>
Diffstat (limited to 'src/gallium/drivers')
-rw-r--r--src/gallium/drivers/nouveau/codegen/nv50_ir_emit_nvc0.cpp53
1 files changed, 53 insertions, 0 deletions
diff --git a/src/gallium/drivers/nouveau/codegen/nv50_ir_emit_nvc0.cpp b/src/gallium/drivers/nouveau/codegen/nv50_ir_emit_nvc0.cpp
index a578e947ec6..f4c39a168be 100644
--- a/src/gallium/drivers/nouveau/codegen/nv50_ir_emit_nvc0.cpp
+++ b/src/gallium/drivers/nouveau/codegen/nv50_ir_emit_nvc0.cpp
@@ -150,6 +150,8 @@ private:
void emitPIXLD(const Instruction *);
+ void emitSHFL(const Instruction *);
+
void emitVOTE(const Instruction *);
inline void defId(const ValueDef&, const int pos);
@@ -2531,6 +2533,54 @@ CodeEmitterNVC0::emitPIXLD(const Instruction *i)
}
void
+CodeEmitterNVC0::emitSHFL(const Instruction *i)
+{
+ const ImmediateValue *imm;
+
+ assert(targ->getChipset() >= NVISA_GK104_CHIPSET);
+
+ code[0] = 0x00000005;
+ code[1] = 0x88000000 | (i->subOp << 23);
+
+ emitPredicate(i);
+
+ defId(i->def(0), 14);
+ srcId(i->src(0), 20);
+
+ switch (i->src(1).getFile()) {
+ case FILE_GPR:
+ srcId(i->src(1), 26);
+ break;
+ case FILE_IMMEDIATE:
+ imm = i->getSrc(1)->asImm();
+ assert(imm && imm->reg.data.u32 < 0x20);
+ code[0] |= imm->reg.data.u32 << 26;
+ code[0] |= 1 << 5;
+ break;
+ default:
+ assert(!"invalid src1 file");
+ break;
+ }
+
+ switch (i->src(2).getFile()) {
+ case FILE_GPR:
+ srcId(i->src(2), 49);
+ break;
+ case FILE_IMMEDIATE:
+ imm = i->getSrc(2)->asImm();
+ assert(imm && imm->reg.data.u32 < 0x2000);
+ code[1] |= imm->reg.data.u32 << 10;
+ code[0] |= 1 << 6;
+ break;
+ default:
+ assert(!"invalid src2 file");
+ break;
+ }
+
+ setPDSTL(i, i->defExists(1) ? 1 : -1);
+}
+
+void
CodeEmitterNVC0::emitVOTE(const Instruction *i)
{
assert(i->src(0).getFile() == FILE_PREDICATE);
@@ -2839,6 +2889,9 @@ CodeEmitterNVC0::emitInstruction(Instruction *insn)
case OP_PIXLD:
emitPIXLD(insn);
break;
+ case OP_SHFL:
+ emitSHFL(insn);
+ break;
case OP_VOTE:
emitVOTE(insn);
break;