[Mesa-dev] [PATCH] tgsi: Add a conditional move inststruction

Zack Rusin zackr at vmware.com
Thu Apr 4 08:39:45 PDT 2013


> > Erm, unsigned < 0 doesn't make sense.
> 
> Ah indeed!
> 
> > Definitely what the description says:
> > static void
> > micro_ucmp(union tgsi_exec_channel *dst,
> >            const union tgsi_exec_channel *src0,
> >            const union tgsi_exec_channel *src1,
> >            const union tgsi_exec_channel *src2)
> > {
> >    dst->u[0] = src0->u[0] ? src1->u[0] : src2->u[0];
> >    dst->u[1] = src0->u[1] ? src1->u[1] : src2->u[1];
> >    dst->u[2] = src0->u[2] ? src1->u[2] : src2->u[2];
> >    dst->u[3] = src0->u[3] ? src1->u[3] : src2->u[3];
> > }
> > 
> > or
> > 
> >    case TGSI_OPCODE_UCMP:
> >    case TGSI_OPCODE_CMP:
> >       FOR_EACH_DST_ENABLED_CHANNEL(0, c, tgsi) {
> >          src0 = fetchSrc(0, c);
> >          src1 = fetchSrc(1, c);
> >          src2 = fetchSrc(2, c);
> >          if (src1 == src2)
> >             mkMov(dst0[c], src1);
> >          else
> >             mkCmp(OP_SLCT, (srcTy == TYPE_F32) ? CC_LT(less than 0) :
> > CC_NE(not equal 0),
> >                   srcTy, dst0[c], src1, src2, src0);
> >       }
> > 
> 
> But odd enough, the implementations I happend to look at seemed to do "foo >=
> 0":

Yea, like I mentioned it's pretty broken. Sometimes it's implemented as UCMP, sometimes it's implemented as MOVC.
It seems to be used only as MOVC. 
It feels silly writing this, but we should probably make UCMP act like UCMP and add MOVC and use it when we need a MOVC.

z


More information about the mesa-dev mailing list