On Fri Sep 13, 2024 at 2:13 PM AEST, Harsh Prateek Bora wrote:
> ppc_excp_apply_ail has multiple if-checks for ail which is un-necessary.
> Combine them as appropriate.
>
> Signed-off-by: Harsh Prateek Bora <harshpb@linux.ibm.com>
This looks okay. I was kind of trying to make the reserved cases
separate from the non-reserved, but in hindsight I don't think it
really improved things and the comment is enough in each case.
Reviewed-by: Nicholas Piggin <npiggin@gmail.com>
> ---
> target/ppc/excp_helper.c | 10 ++--------
> 1 file changed, 2 insertions(+), 8 deletions(-)
>
> diff --git a/target/ppc/excp_helper.c b/target/ppc/excp_helper.c
> index 4eeeedff5b..a8bd537a18 100644
> --- a/target/ppc/excp_helper.c
> +++ b/target/ppc/excp_helper.c
> @@ -324,10 +324,7 @@ static void ppc_excp_apply_ail(PowerPCCPU *cpu, int excp, target_ulong msr,
> }
>
> ail = (env->spr[SPR_LPCR] & LPCR_AIL) >> LPCR_AIL_SHIFT;
> - if (ail == 0) {
> - return;
> - }
> - if (ail == 1) {
> + if (ail == 0 || ail == 1) {
> /* AIL=1 is reserved, treat it like AIL=0 */
> return;
> }
> @@ -351,10 +348,7 @@ static void ppc_excp_apply_ail(PowerPCCPU *cpu, int excp, target_ulong msr,
> } else {
> ail = (env->spr[SPR_LPCR] & LPCR_AIL) >> LPCR_AIL_SHIFT;
> }
> - if (ail == 0) {
> - return;
> - }
> - if (ail == 1 || ail == 2) {
> + if (ail == 0 || ail == 1 || ail == 2) {
> /* AIL=1 and AIL=2 are reserved, treat them like AIL=0 */
> return;
> }