qemu-devel
[Top][All Lists]
Advanced

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

Re: [PATCH 09/21] target/xtensa: add DFP option, registers and opcodes


From: Richard Henderson
Subject: Re: [PATCH 09/21] target/xtensa: add DFP option, registers and opcodes
Date: Wed, 8 Jul 2020 17:19:07 -0700
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.8.0

On 7/8/20 10:37 AM, Max Filippov wrote:
> On Wed, Jul 8, 2020 at 9:25 AM Richard Henderson
> <richard.henderson@linaro.org> wrote:
>>
>> On 7/6/20 4:47 PM, Max Filippov wrote:
>>> +float64 HELPER(add_d)(CPUXtensaState *env, float64 a, float64 b)
>>> +{
>>> +    set_use_first_nan(true, &env->fp_status);
>>> +    return float64_add(a, b, &env->fp_status);
>>> +}
>>> +
>>>  float32 HELPER(add_s)(CPUXtensaState *env, float32 a, float32 b)
>>>  {
>>> +    set_use_first_nan(env->config->use_first_nan, &env->fp_status);
>>>      return float32_add(a, b, &env->fp_status);
>>>  }
>>
>> I think you can do better than to set the use_first_nan flag before every
>> operation.
> 
> And it was better, until I found that the rules for float64 are a
> bit... peculiar.

Do I read that right,

> @@ -99,6 +103,7 @@
>      XCHAL_OPTION(XCHAL_HAVE_CP, XTENSA_OPTION_COPROCESSOR) | \
>      XCHAL_OPTION(XCHAL_HAVE_BOOLEANS, XTENSA_OPTION_BOOLEAN) | \
>      XCHAL_OPTION(XCHAL_HAVE_FP, XTENSA_OPTION_FP_COPROCESSOR) | \
> +    XCHAL_OPTION(XCHAL_HAVE_DFP, XTENSA_OPTION_DFP_COPROCESSOR) | \
>      XCHAL_OPTION(XCHAL_HAVE_RELEASE_SYNC, XTENSA_OPTION_MP_SYNCHRO) | \
>      XCHAL_OPTION(XCHAL_HAVE_S32C1I, XTENSA_OPTION_CONDITIONAL_STORE) | \
>      XCHAL_OPTION(((XCHAL_HAVE_S32C1I && XCHAL_HW_VERSION >= 230000) || \
> @@ -515,6 +520,7 @@
>      .ndepc = (XCHAL_XEA_VERSION >= 2), \
>      .inst_fetch_width = XCHAL_INST_FETCH_WIDTH, \
>      .max_insn_size = XCHAL_MAX_INSTRUCTION_SIZE, \
> +    .use_first_nan = !XCHAL_HAVE_DFP, \
>      EXCEPTIONS_SECTION, \
>      INTERRUPTS_SECTION, \
>      TLB_SECTION, \

means that if DFP is present, float64 has use_first_nan, but float32 does not?!?

What in the world is going on?

>> E.g. the translator could remember the previous setting within the TB, only
>> changing when necessary.  E.g. if env->config->use_first_nan, then set it
>> during reset and never change it again.  Similarly if DFP is not enabled.
> 
> This thought crossed my mind too, but then set_use_first_nan only
> sets one variable in the float_status and gets inlined.
> Is it worth the trouble?

You have a point that the operation I'm trying to avoid is trivial, and
probably not worth much.  But I had hoped that a given cpu would stick with one
method and not change it.


r~



reply via email to

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