|
From: Lok K. Y. <lo...@sy...> - 2012-10-19 19:40:09
|
Can you please help me understand the problem a bit more by answering the following questions? 1. Where is addition being used in CTZ - and especially expensiveCTZ. From the code, I only see subtraction being used. 2. Why is PCast used for CTZ (and subsequently for BSF) if all of the upper bits are 0 as long as the operand is non-zero? That is, why not and the PCast with 0x1E since 31 is the maximum output value. 3. In the case of BSF, what about PCast( BSF(va) <= BSF(a) )? Enjoy, Lok ________________________________________ From: Stephen McCamant [sm...@al...] Sent: Friday, October 19, 2012 1:34 PM To: Julian Seward Cc: val...@li... Subject: Re: [Valgrind-developers] bsfl and pmovmskb validity bit propagation PJL> bsfl validity bit propagation is imprecise PJL> https://bugs.kde.org/show_bug.cgi?id=308626 >>>>> "Julian" == Julian Seward <js...@ac...> writes: Julian> Have a look at commented out verbose_Clz32() at the end of Julian> guest_ppc_toIR.c. It might be useful (as a source of ideas). Julian> It relies on the fact that Memcheck tracks definedness exactly Julian> correctly for left shifts, right shifts, and, or and not. The propagation part of that, which just uses bitwise operations, should be completely precise. However my intuition would be that the bitcount part, which uses addition, would sometimes introduce imprecision even if you make Memcheck use the more precise carry-aware translation. For Patrick's example it would probably go OK because the undefinedness would be eliminated during the propagation. Another approach that had occurred to me would be to make the "lower bound" value where all the undefined bits are replaced by zero, and the "upper bound" value where they're replaced by one, and run Ctz on both of them. The case where the results are the same is the important one where it's completely defined. (However this still isn't completely precise: for instance consider Ctz8(010?0?0?) = 00000??0.) -- Stephen ------------------------------------------------------------------------------ Everyone hates slow websites. So do we. Make your web apps faster with AppDynamics Download AppDynamics Lite for free today: http://p.sf.net/sfu/appdyn_sfd2d_oct _______________________________________________ Valgrind-developers mailing list Val...@li... https://lists.sourceforge.net/lists/listinfo/valgrind-developers |