On 09/06/2011 08:50 PM, malc wrote:
> Correct me if i'm wrong, previously the code worked like this:
> 
> mov tmp, 0
> sub tmp, 1
> sar r, r, tmp
> 
> Still UB as far as TCG is concerned but since no immediates are involved
> things worked, now, with constant folding, we are asked to sar by -1 
> directly.

You are exactly correct.

That's why I thought my patch to re-arrange the order of operations
and only perform the subtraction inside the %cl != 0 test was a good
idea.  No point in performing the shift if we're not going to use the
result.

> I did that when first hit this problem, but decided not to push it.

I think pushing it is a good idea.  Just because the result is not
defined, according to tcg/README, is no reason to SIGILL.


r~

Reply via email to