|
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 beif (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
[Prev in Thread] | Current Thread | [Next in Thread] |