summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/nouveau/codegen
diff options
context:
space:
mode:
authorBoyan Ding <[email protected]>2017-04-10 22:56:00 +0800
committerIlia Mirkin <[email protected]>2017-04-13 02:24:55 -0400
commitf1252996f5e067401c285eff7ae1eea837a107e5 (patch)
tree470205693f3124acec3e274ae856e22868f08219 /src/gallium/drivers/nouveau/codegen
parentc32e150008dbae1da2a69031056ece7f7f7febb2 (diff)
gk110/ir: Emit OP_SHFL
v2: Make sure that asImm() is not NULL (Samuel Pitoiset) v3: Check the range of immediate in OP_SHFL (Ilia Mirkin) Signed-off-by: Boyan Ding <[email protected]> Reviewed-by: Ilia Mirkin <[email protected]>
Diffstat (limited to 'src/gallium/drivers/nouveau/codegen')
-rw-r--r--src/gallium/drivers/nouveau/codegen/nv50_ir_emit_gk110.cpp56
1 files changed, 56 insertions, 0 deletions
diff --git a/src/gallium/drivers/nouveau/codegen/nv50_ir_emit_gk110.cpp b/src/gallium/drivers/nouveau/codegen/nv50_ir_emit_gk110.cpp
index 1121ae09123..2a6c773ba25 100644
--- a/src/gallium/drivers/nouveau/codegen/nv50_ir_emit_gk110.cpp
+++ b/src/gallium/drivers/nouveau/codegen/nv50_ir_emit_gk110.cpp
@@ -135,6 +135,8 @@ private:
void emitFlow(const Instruction *);
+ void emitSHFL(const Instruction *);
+
void emitVOTE(const Instruction *);
void emitSULDGB(const TexInstruction *);
@@ -1566,6 +1568,57 @@ CodeEmitterGK110::emitFlow(const Instruction *i)
}
void
+CodeEmitterGK110::emitSHFL(const Instruction *i)
+{
+ const ImmediateValue *imm;
+
+ code[0] = 0x00000002;
+ code[1] = 0x78800000 | (i->subOp << 1);
+
+ emitPredicate(i);
+
+ defId(i->def(0), 2);
+ srcId(i->src(0), 10);
+
+ switch (i->src(1).getFile()) {
+ case FILE_GPR:
+ srcId(i->src(1), 23);
+ break;
+ case FILE_IMMEDIATE:
+ imm = i->getSrc(1)->asImm();
+ assert(imm && imm->reg.data.u32 < 0x20);
+ code[0] |= imm->reg.data.u32 << 23;
+ code[0] |= 1 << 31;
+ break;
+ default:
+ assert(!"invalid src1 file");
+ break;
+ }
+
+ switch (i->src(2).getFile()) {
+ case FILE_GPR:
+ srcId(i->src(2), 42);
+ break;
+ case FILE_IMMEDIATE:
+ imm = i->getSrc(2)->asImm();
+ assert(imm && imm->reg.data.u32 < 0x2000);
+ code[1] |= imm->reg.data.u32 << 5;
+ code[1] |= 1;
+ break;
+ default:
+ assert(!"invalid src2 file");
+ break;
+ }
+
+ if (!i->defExists(1))
+ code[1] |= 7 << 19;
+ else {
+ assert(i->def(1).getFile() == FILE_PREDICATE);
+ defId(i->def(1), 51);
+ }
+}
+
+void
CodeEmitterGK110::emitVOTE(const Instruction *i)
{
assert(i->src(0).getFile() == FILE_PREDICATE);
@@ -2642,6 +2695,9 @@ CodeEmitterGK110::emitInstruction(Instruction *insn)
case OP_CCTL:
emitCCTL(insn);
break;
+ case OP_SHFL:
+ emitSHFL(insn);
+ break;
case OP_VOTE:
emitVOTE(insn);
break;