[Mesa-dev] [PATCH 2/3] lp_bld_arit: Fix lp_build_sgn.

Jose Fonseca jfonseca at vmware.com
Tue May 15 14:39:18 PDT 2012


----- Original Message -----
> On Wed, May 09, 2012 at 10:01:37AM -0700, Jose Fonseca wrote:
> > Something else is not right here, as
> > 
> >   lp_build_const_vec(bld->gallivm, type, -1.0)
> > 
> > and
> > 
> >   lp_build_const_int_vec(bld->gallivm, type, -1)
> > 
> > should produce the same output for unnormalized signed integer
> > types.
> > 
> > Which means the error is likely somewhere else:
> > - lp_build_const_vec is buggy
> 
>       elem = LLVMConstInt(elem_type, val*dscale + 0.5, 0);
> 
> (int)(-0.5) == 0, not -1

Ah. Thanks. It should  be fixed now.

BTW the lp_build_sgn change broke lp_build_sgn, normalized / fixed point integers, which is handled by the same case as signed integers. I've fixed that too, and added a comment to make this clear.

Jose


More information about the mesa-dev mailing list