qemu-devel
[Top][All Lists]
Advanced

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

Re: [RFC PATCH] softfloat: use QEMU_FLATTEN to avoid mistaken isra inlin


From: Paolo Bonzini
Subject: Re: [RFC PATCH] softfloat: use QEMU_FLATTEN to avoid mistaken isra inlining
Date: Thu, 25 May 2023 15:30:22 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.10.0

On 5/23/23 16:33, Richard Henderson wrote:

The tests are poorly ordered, testing many unlikely things before the most likely thing (normal).  A better ordering would be

     if (likely(tp##_is_normal(arg))) {
     } else if (tp##_is_zero(arg)) {
     } else if (tp##_is_zero_or_denormal(arg)) {
     } else if (tp##_is_infinity(arg)) {
     } else {
         // nan case
     }

Might also benefit from a is_finite (true if zero or normal or denormal) predicate, to do

if (tp##_is_finite(arg)) {
    if (!tp##_is_zero_or_denormal(arg)) {
       // normal
    } else if (tp##_is_zero(arg)) {
    } else {
       // denormal
    }
} else if (tp##_is_infinity(arg)) {
} else {
    // nan
}

since is_normal is a bit more complex and inefficient than the others. The compiler should easily reuse the result of masking away the sign bit.

Paolo




reply via email to

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