[Mesa-dev] [PATCH 1/9] gm107/ir: Emit third src 'bound' and optional predicate output of SHFL

Samuel Pitoiset samuel.pitoiset at gmail.com
Sat Apr 8 12:42:24 UTC 2017



On 04/08/2017 11:51 AM, Boyan Ding wrote:
> ---
>   .../drivers/nouveau/codegen/nv50_ir_emit_gm107.cpp | 23 ++++++++++++++++++----
>   1 file changed, 19 insertions(+), 4 deletions(-)
> 
> diff --git a/src/gallium/drivers/nouveau/codegen/nv50_ir_emit_gm107.cpp b/src/gallium/drivers/nouveau/codegen/nv50_ir_emit_gm107.cpp
> index 6903132efa..4a741bf45b 100644
> --- a/src/gallium/drivers/nouveau/codegen/nv50_ir_emit_gm107.cpp
> +++ b/src/gallium/drivers/nouveau/codegen/nv50_ir_emit_gm107.cpp
> @@ -966,11 +966,26 @@ CodeEmitterGM107::emitSHFL()
>         break;
>      }
>   
> -   /*XXX: what is this arg? hardcode immediate for now */
> -   emitField(0x22, 13, 0x1c03);
> -   type |= 2;
> +   switch (insn->src(2).getFile()) {
> +   case FILE_GPR:
> +      emitGPR(0x27, insn->src(2));
> +      break;
> +   case FILE_IMMEDIATE:
> +      emitIMMD(0x22, 13, insn->src(2));
> +      type |= 2;
> +      break;
> +   default:
> +      assert(!"invalid src2 file");
> +      break;
> +   }

This looks wrong to me. I think you need to check that src(2) exists 
because you might hit the assert for DFDX (and friends) which uses SHFL.

> +
> +   if (!insn->defExists(1))
> +      emitPRED(0x30);
> +   else {
> +      assert(insn->def(1).getFile() == FILE_PREDICATE);
> +      emitPRED(0x30, insn->def(1));
> +   }
>   
> -   emitPRED (0x30);
>      emitField(0x1e, 2, insn->subOp);
>      emitField(0x1c, 2, type);
>      emitGPR  (0x08, insn->src(0));
> 


More information about the mesa-dev mailing list