target/ppc: fix setting of CR flags in bcdcfsq
commita3d67f3e5d5bfe480eeb83d24546191b681b7c38
authorLuis Pires <luis.pires@eldorado.org.br>
Mon, 23 Aug 2021 15:02:35 +0000 (23 12:02 -0300)
committerDavid Gibson <david@gibson.dropbear.id.au>
Wed, 29 Sep 2021 09:37:39 +0000 (29 19:37 +1000)
tree38fe501ecc44d7866f844afa54a7d3d22e1060d8
parentf640afec1a14e99d561f7da93e3fc8a5e1206384
target/ppc: fix setting of CR flags in bcdcfsq

According to the ISA, CR should be set based on the source value, and
not on the packed decimal result.
The way this was implemented would cause GT, LT and EQ to be set
incorrectly when the source value was too large and the 31 least
significant digits of the packed decimal result ended up being all zero.
This would happen for source values of +/-10^31, +/-10^32, etc.

The new implementation fixes this and also skips the result calculation
altogether in case of src overflow.

Signed-off-by: Luis Pires <luis.pires@eldorado.org.br>
Message-Id: <20210823150235.35759-1-luis.pires@eldorado.org.br>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
target/ppc/int_helper.c