Re: [PATCH for-6.2 06/34] target/arm: Fix 48-bit saturating shifts

2021-07-16 Thread Peter Maydell
On Fri, 16 Jul 2021 at 17:34, Richard Henderson wrote: > > On 7/13/21 6:36 AM, Peter Maydell wrote: > > -return (1ULL << 47) - (src >= 0); > > +return sextract64((1ULL << 47) - (src >= 0), 0, 48); > > Clearer as > >return src >= 0 ? MAKE_64BIT_MASK(0, 47) : MAKE_64BIT_MASK(47, 17); Ye

Re: [PATCH for-6.2 06/34] target/arm: Fix 48-bit saturating shifts

2021-07-16 Thread Richard Henderson
On 7/13/21 6:36 AM, Peter Maydell wrote: -return (1ULL << 47) - (src >= 0); +return sextract64((1ULL << 47) - (src >= 0), 0, 48); Clearer as return src >= 0 ? MAKE_64BIT_MASK(0, 47) : MAKE_64BIT_MASK(47, 17); ? Otherwise, Reviewed-by: Richard Henderson r~

[PATCH for-6.2 06/34] target/arm: Fix 48-bit saturating shifts

2021-07-13 Thread Peter Maydell
In do_sqrshl48_d() and do_uqrshl48_d() we got some of the edge cases wrong and failed to saturate correctly: (1) In do_sqrshl48_d() we used the same code that do_shrshl_bhs() does to obtain the saturated most-negative and most-positive 48-bit signed values for the large-shift-left case. This give