qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH v6 8/9] target-mips: Add nan2008 flavor of <CEIL


From: Leon Alrae
Subject: Re: [Qemu-devel] [PATCH v6 8/9] target-mips: Add nan2008 flavor of <CEIL|CVT|FLOOR|ROUND|TRUNC>.<L|W>.<S|D>
Date: Tue, 31 May 2016 15:13:14 +0100
User-agent: Mutt/1.5.21 (2010-09-15)

On Mon, May 16, 2016 at 04:12:44PM +0200, Aleksandar Markovic wrote:
> From: Aleksandar Markovic <address@hidden>
> 
> New set of helpers for handling nan2008-syle versions of instructions
> <CEIL|CVT|FLOOR|ROUND|TRUNC>.<L|W>.<S|D>, for Mips R6.
> 
> All involved instructions have float operand and integer result. Their
> core functionality is implemented via invocations of appropriate SoftFloat
> functions. The problematic cases are when the operand is a NaN, and also
> when the operand (float) is out of the range of the result.
> 
> Here one can distinguish three cases:
> 
> CASE MIPS-A: (FCR31.NAN2008 == 1)
> 
>    1. Operand is a NaN, result should be 0;
>    2. Operand is larger than INT_MAX, result should be INT_MAX;
>    2. Operand is smaller than INT_MIN, result should be INT_MIN.
> 
> CASE MIPS-B: (FCR31.NAN2008 == 0)
> 
>    1. Operand is a NaN, result should be INT_MAX;
>    2. Operand is larger than INT_MAX, result should be INT_MAX;
>    2. Operand is smaller than INT_MIN, result should be INT_MAX.
> 
> CASE SOFTFLOAT:
> 
>    1. Operand is a NaN, result is INT_MAX;
>    2. Operand is larger than INT_MAX, result is INT_MAX;
>    2. Operand is smaller than INT_MIN, result is INT_MIN.
> 
> It is interesting that neither MIPS-A nor MIPS-B desired behaviors
> are in this sense identical to correspondent SoftFloat behavior.
> 
> Current implementation of <CEIL|CVT|FLOOR|ROUND|TRUNC>.<L|W>.<S|D>
> implements case MIPS-B. This patch relates to case MIPS-A. For case
> MIPS-A, only return value for NaN-operands should be corrected after
> appropriate SoftFloat library function is called.
> 
> Related MSA instructions FTRUNC_S and FTINT_S already handle well
> all cases, in the fashion similar to the code from this patch.
> 
> Signed-off-by: Aleksandar Markovic <address@hidden>
> ---
>  target-mips/helper.h    |  18 +--
>  target-mips/op_helper.c | 369 
> +++++++++++++++++++++++++++++++++++++++++++++---
>  target-mips/translate.c | 122 +++++++++++++---
>  3 files changed, 461 insertions(+), 48 deletions(-)

Reviewed-by: Leon Alrae <address@hidden>



reply via email to

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