[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAHirt9ib2LPXMbxb+UCJB1MsBnUuWNLb5+uyqcR5Wiw2fsJi6w@mail.gmail.com>
Date: Mon, 10 Apr 2023 22:22:39 +0800
From: Rui Wang <wangrui@...ngson.cn>
To: Xi Ruoyao <xry111@...111.site>
Cc: Huacai Chen <chenhuacai@...nel.org>,
WANG Xuerui <kernel@...0n.name>, loongarch@...ts.linux.dev,
linux-kernel@...r.kernel.org, loongson-kernel@...ts.loongnix.cn
Subject: Re: [PATCH] LoongArch: Improve memory ops
On Mon, Apr 10, 2023 at 8:54 PM Xi Ruoyao <xry111@...111.site> wrote:
> Regarding these functions: we have -ffreestanding which is preventing
> the compiler from optimizing for e.g. "memcpy(a, b, 8);" into a simple
> ld.d/st.d pair. A explicit compiler built-in usage like
>
> #define memcpy(a, b, c) __builtin_memcpy(a, b, c)
>
> would allow the compiler to do such kind of optimization. Will this
> improve the performance?
That's a good question. IIUC, the current compiler generates
inefficient code for constant-length memcpy, which may sacrifice
performance for compatibility, as not all hardware supports unaligned
memory access. We need a runtime CPU feature dispatch mechanism
similar to alternatives to improve the compiler. This is indeed a
problem that needs to be addressed.
Regards,
Rui
Powered by blists - more mailing lists