________________________________________ From: Richard Henderson [rth7...@gmail.com] on behalf of Richard Henderson [r...@twiddle.net] Sent: Thursday, June 27, 2013 8:20 PM To: Petar Jovanovic Cc: Petar Jovanovic; qemu-devel@nongnu.org; aurel...@aurel32.net Subject: Re: [Qemu-devel] [PATCH] target-mips: fix mipsdsp_trunc16_sat16_round
On 06/17/2013 03:39 PM, Petar Jovanovic wrote: > - int64_t temp; > - > - temp = (int32_t)a + 0x00008000; > + uint16_t temp; > > - if (a > (int)0x7fff8000) { > - temp = 0x7FFFFFFF; > + if (a > 0x7FFF7FFF) { > + temp = 0x7FFF; > set_DSPControl_overflow_flag(1, 22, env); > + } else { > + temp = ((a + 0x8000) >> 16) & 0xFFFF; > This doesn't look right either, as it doesn't properly check for overflow of > negative values. What overflow of negative values? Can you please list the values for which the result would not be correct? Thanks. Petar