qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH] target-ppc: Bug: VSX Convert to Integer Should


From: Peter Maydell
Subject: Re: [Qemu-devel] [PATCH] target-ppc: Bug: VSX Convert to Integer Should Truncate
Date: Sun, 23 Mar 2014 18:21:29 +0000

On 23 March 2014 18:02, Tom Musta <address@hidden> wrote:
> diff --git a/target-ppc/fpu_helper.c b/target-ppc/fpu_helper.c
> index e7f3295..ccfc5cc 100644
> --- a/target-ppc/fpu_helper.c
> +++ b/target-ppc/fpu_helper.c
> @@ -2558,10 +2558,14 @@ void helper_##op(CPUPPCState *env, uint32_t opcode)   
>                        \
>              fload_invalid_op_excp(env, POWERPC_EXCP_FP_VXCVI, 0);            
> \
>              xt.tfld = rnan;                                                  
> \
>          } else {                                                             
> \
> +            /* force round to zero mode (truncation) */                      
> \
> +            set_float_rounding_mode(float_round_to_zero, &env->fp_status);   
> \
>              xt.tfld = stp##_to_##ttp(xb.sfld, &env->fp_status);              
> \
>              if (env->fp_status.float_exception_flags & float_flag_invalid) { 
> \
>                  fload_invalid_op_excp(env, POWERPC_EXCP_FP_VXCVI, 0);        
> \
>              }                                                                
> \

If we raise a CPU exception here (via helper_raise_exception_err())
we'll longjmp out of here and never restore the rounding mode. So
the restoring of the rounding mode needs to happen before we
check for exceptions here.

> +            /* restore rounding mode from FPSCR */                           
> \
> +            fpscr_set_rounding_mode(env);                                    
> \
>          }                                                                    
> \
>      }                                                                        
> \
>                                                                               
> \

thanks
-- PMM



reply via email to

[Prev in Thread] Current Thread [Next in Thread]