From: Eliot M. <mo...@cs...> - 2025-07-13 21:49:07
|
On 7/13/2025 4:52 PM, Florian Krohm wrote: > What is the semantics of Iop_Left32 and friends? > > In libvex_ir.h it says: \x -> x | -x > which is not descriptive at all. > I could simply copy that formula over and use in the constant folding checker. > But by doing so it is impossible to find any bugs - be it in VEX's fold_expr or in the checker program. So I want to > write my own implementation of that IROp. > Can't do without a spec... > > I took a guess and thought that "left" perhaps meant to left-propagate the left-most "1" bit. E.g. 00000101 --> 11111101 > But that's not it.. In fact for every odd integer the result has all bits set. This appears to take the least significant 1 bit and propagate it to the left. Seems related to x & -x, which isolates the least significant 1 bit. Regards - Eliot Moss |