nvc0/ir: Allow 0/1 immediate value as source of OP_VOTE
authorBoyan Ding <boyan.j.ding@gmail.com>
Mon, 10 Apr 2017 14:56:01 +0000 (22:56 +0800)
committerIlia Mirkin <imirkin@alum.mit.edu>
Thu, 13 Apr 2017 06:24:59 +0000 (02:24 -0400)
commit2a3c4c6bc31f300ef8a6a793a4cdeded66f6f778
treebf2bc8baf09b2e53fd8b5e914d6e5cc90d8f92e1
parentf1252996f5e067401c285eff7ae1eea837a107e5
nvc0/ir: Allow 0/1 immediate value as source of OP_VOTE

Implementation of readFirstInvocationARB() on nvidia hardware needs a
ballotARB(true) used to decide the first active thread. This expressed
in gm107 asm as (supposing output is $r0):
vote any $r0 0x1 0x1

To model the always true input, which corresponds to the second 0x1
above, we make OP_VOTE accept immediate value 0/1 and emit "0x1" and
"not 0x1" in the src field respectively.

v2: Make sure that asImm() is not NULL (Samuel Pitoiset)

v3: (Ilia Mirkin)
Make the handling more symmetric with predicate version in gm107
Use i->getSrc(s)

Signed-off-by: Boyan Ding <boyan.j.ding@gmail.com>
Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
src/gallium/drivers/nouveau/codegen/nv50_ir_emit_gk110.cpp
src/gallium/drivers/nouveau/codegen/nv50_ir_emit_gm107.cpp
src/gallium/drivers/nouveau/codegen/nv50_ir_emit_nvc0.cpp