[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <8aeb6d8dc4cbe8c992b69d75d8953d59b71a2c38.camel@xry111.site>
Date: Mon, 10 Apr 2023 22:36:26 +0800
From: Xi Ruoyao <xry111@...111.site>
To: Rui Wang <wangrui@...ngson.cn>
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, 2023-04-10 at 22:22 +0800, Rui Wang wrote:
> 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.
Hmm, yep, GCC does not take the advantage of -mstrict-align expanding
memcpy etc. I'll add it into my TODO list for GCC 14.
--
Xi Ruoyao <xry111@...111.site>
School of Aerospace Science and Technology, Xidian University
Powered by blists - more mailing lists