|
From: Stephen M. <sm...@al...> - 2012-10-19 17:34:36
|
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 |