On Mon, 2023-11-13 at 07:09 +0000, Tamar Christina wrote:
> In the case of e.g. longaarch64 It looks like the target actually has an 
> fcopysign
> Instruction, so wouldn't this rewriting by simplify-rtx be a de-optimization?

Yes it seems a de-optimization on LoongArch.  For this micro-benchmark:

int main()
{
        #pragma GCC unroll(100)
        for (int i = 0; i < 1000000000; i++) {
                float x = -1, a = 1.23456;
                asm volatile ("":"+f"(a));
#ifdef DISALLOW_COPYSIGN_OPTIMIZATION
                asm("":"+f"(x));
#endif
                a = __builtin_copysignf(a, x);
                asm(""::"f"(a));
        }
}

If DISALLOW_COPYSIGN_OPTIMIZATION is defined, the result is faster for
0.23 seconds.

I'll submit another patch to disable this.

-- 
Xi Ruoyao <xry...@xry111.site>
School of Aerospace Science and Technology, Xidian University

Reply via email to