Right, for scalar value, magnitude is the same as absolute value. We should use RNDZ here. Thanks for the valuable comments.
Xionghu, no need to send a new version I will fix it and push the patch. Thanks. On Fri, Jan 16, 2015 at 03:21:48AM +0000, Song, Ruiling wrote: > llvm manual page says llvm.trunc share exactly same behavior with libm trunc: > "Semantics of llvm.trunc: > This function returns the same values as the libm trunc functions would, and > handles error conditions in the same way." > > So, I think magnitude shows same meaning with absolute value here. Generally > magnitude means the length of a vector, so it is non-negative. > > > -----Original Message----- > > From: Zhigang Gong [mailto:[email protected]] > > Sent: Friday, January 16, 2015 10:45 AM > > To: Song, Ruiling; Luo, Xionghu; [email protected] > > Cc: Luo, Xionghu > > Subject: RE: [Beignet] [PATCH v2] fix llvm.trunc.float instruction bug. > > > > Should be RNDD, please see the difference between the two definitions > > below: > > > > Libm trunk(): > > These functions round x to the nearest integer not larger in *absolute* > > value. > > > > Llvm.trunc: > > The ‘llvm.trunc.*‘ intrinsics returns the operand rounded to the nearest > > integer not larger in magnitude than the operand. > > > > > > > -----Original Message----- > > > From: Beignet [mailto:[email protected]] On Behalf > > > Of Song, Ruiling > > > Sent: Friday, January 16, 2015 10:36 AM > > > To: Luo, Xionghu; [email protected] > > > Cc: Luo, Xionghu > > > Subject: Re: [Beignet] [PATCH v2] fix llvm.trunc.float instruction bug. > > > > > > Should be RNDZ. The llvm.trunc is same as libm trunc(), which means > > > rounding toward zero. > > > > > > > -----Original Message----- > > > > From: Beignet [mailto:[email protected]] On > > > > Behalf Of [email protected] > > > > Sent: Thursday, January 15, 2015 7:05 PM > > > > To: [email protected] > > > > Cc: Luo, Xionghu > > > > Subject: [Beignet] [PATCH v2] fix llvm.trunc.float instruction bug. > > > > > > > > From: Luo <[email protected]> > > > > > > > > float to float trunc should use RNDU IR instruction. > > > > > > > > v2: fix typo. should be RNDD instead of RNDU. > > > > Signed-off-by: Luo <[email protected]> > > > > --- > > > > backend/src/llvm/llvm_gen_backend.cpp | 4 +--- > > > > 1 file changed, 1 insertion(+), 3 deletions(-) > > > > > > > > diff --git a/backend/src/llvm/llvm_gen_backend.cpp > > > > b/backend/src/llvm/llvm_gen_backend.cpp > > > > index 53dec0a..ee5b6a3 100644 > > > > --- a/backend/src/llvm/llvm_gen_backend.cpp > > > > +++ b/backend/src/llvm/llvm_gen_backend.cpp > > > > @@ -3310,11 +3310,9 @@ error: > > > > ir::Type srcType = getType(ctx, llvmSrcType); > > > > GBE_ASSERT(srcType == dstType); > > > > > > > > - const ir::Register tmp = ctx.reg(getFamily(ir::TYPE_S32)); > > > > const ir::Register dst = this->getRegister(&I); > > > > const ir::Register src = > > this->getRegister(I.getOperand(0)); > > > > - ctx.CVT(ir::TYPE_S32, srcType, tmp, src); > > > > - ctx.CVT(dstType, ir::TYPE_S32, dst, tmp); > > > > + ctx.RNDD(dstType, dst, src); > > > > } > > > > break; > > > > case Intrinsic::copysign: > > > > -- > > > > 1.9.1 > > > > > > > > _______________________________________________ > > > > Beignet mailing list > > > > [email protected] > > > > http://lists.freedesktop.org/mailman/listinfo/beignet > > > _______________________________________________ > > > Beignet mailing list > > > [email protected] > > > http://lists.freedesktop.org/mailman/listinfo/beignet > > _______________________________________________ > Beignet mailing list > [email protected] > http://lists.freedesktop.org/mailman/listinfo/beignet _______________________________________________ Beignet mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/beignet
