Re: [PATCH v2 3/5] target/s390x: Fix cc_calc_sla_64() missing overflows

2022-01-12 Thread Ilya Leoshkevich
On Wed, 2022-01-12 at 16:45 +0100, David Hildenbrand wrote: > > > If the sign is false, the shifted bits (mask) have to be 0. > > > If the sign bit is true, the shifted bits (mask) have to be set. > > > > IIUC this logic handles sign bit + "shift - 1" bits. So if the last > > shifted bit is

Re: [PATCH v2 3/5] target/s390x: Fix cc_calc_sla_64() missing overflows

2022-01-12 Thread David Hildenbrand
>> If the sign is false, the shifted bits (mask) have to be 0. >> If the sign bit is true, the shifted bits (mask) have to be set. > > IIUC this logic handles sign bit + "shift - 1" bits. So if the last > shifted bit is different, the overflow is not detected. Ah, right, because of the - 1ULL

Re: [PATCH v2 3/5] target/s390x: Fix cc_calc_sla_64() missing overflows

2022-01-12 Thread Ilya Leoshkevich
On Wed, 2022-01-12 at 09:59 +0100, David Hildenbrand wrote: > On 12.01.22 05:39, Ilya Leoshkevich wrote: > > An overflow occurs for SLAG when at least one shifted bit is not > > equal > > to sign bit. Therefore, we need to check that `shift + 1` bits are > > neither all 0s nor all 1s. The current

Re: [PATCH v2 3/5] target/s390x: Fix cc_calc_sla_64() missing overflows

2022-01-12 Thread David Hildenbrand
On 12.01.22 05:39, Ilya Leoshkevich wrote: > An overflow occurs for SLAG when at least one shifted bit is not equal > to sign bit. Therefore, we need to check that `shift + 1` bits are > neither all 0s nor all 1s. The current code checks only `shift` bits, > missing some overflows. Right,

[PATCH v2 3/5] target/s390x: Fix cc_calc_sla_64() missing overflows

2022-01-11 Thread Ilya Leoshkevich
An overflow occurs for SLAG when at least one shifted bit is not equal to sign bit. Therefore, we need to check that `shift + 1` bits are neither all 0s nor all 1s. The current code checks only `shift` bits, missing some overflows. Fixes: cbe24bfa91d2 ("target-s390: Convert SHIFT, ROTATE SINGLE")