This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [PATCH] powerpc: Use aligned stores in memset
- From: Steven Munroe <munroesj at linux dot vnet dot ibm dot com>
- To: Florian Weimer <fweimer at redhat dot com>
- Cc: Rajalakshmi Srinivasaraghavan <raji at linux dot vnet dot ibm dot com>, libc-alpha at sourceware dot org
- Date: Tue, 12 Sep 2017 15:24:58 -0500
- Subject: Re: [PATCH] powerpc: Use aligned stores in memset
- Authentication-results: sourceware.org; auth=none
- References: <1503033107-20047-1-git-send-email-raji@linux.vnet.ibm.com> <b8fd7e0c-8108-a808-a9a2-0c2df8961275@redhat.com> <e04fa334-d4e1-0660-ec26-024e97024761@linux.vnet.ibm.com> <e7daca03-3e86-8cdf-9d42-4e7effb02c63@redhat.com> <d7115391-1e52-5ecb-dce6-57895aaed268@redhat.com> <1505223476.12360.14.camel@oc7878010663> <87wp54vwk4.fsf@mid.deneb.enyo.de> <1505225800.12360.28.camel@oc7878010663> <fcf15935-1cbe-7e2b-5364-366b0c52e3f6@redhat.com> <1505244094.12360.36.camel@oc7878010663> <a0d85c27-2623-fb2b-29b9-516e5498bd53@redhat.com>
- Reply-to: munroesj at linux dot vnet dot ibm dot com
On Tue, 2017-09-12 at 21:45 +0200, Florian Weimer wrote:
> On 09/12/2017 09:21 PM, Steven Munroe wrote:
> > On Tue, 2017-09-12 at 19:04 +0200, Florian Weimer wrote:
> >> On 09/12/2017 04:16 PM, Steven Munroe wrote:
> >>> On Tue, 2017-09-12 at 16:08 +0200, Florian Weimer wrote:
> >>>> * Steven Munroe:
> >>>>
> >>>>>> This means that GCC introduced an unaligned store, no matter how memset
> >>>>>> was implemented.
> >>>>>>
> >>>>> C will do what ever the programmer wants. We can not stop that.
> >>>>
> >>>> That's not true. If some specification says that for POWER, mem* must
> >>>> behave in a certain way, and the GCC/glibc combiniation does not do
> >>>> that, that's a bug on POWER.
> >>>>
> >>> What is the bug that you think we are not fixing?
> >>
> >> memset, as called by the C programmer, still uses unaligned stores.
>
> Please look at my example and its disassembly.
>
> > We are not going to version every loop that might contain stores based
> > on speculation that someone who does not know what they are doing might
> > access Cache Inhibited storage.
>
> You need to remove optimizations from GCC which expand memset calls
> using other instructions if those expansions do not compensate for the
> possibility of unaligned stores.
>
No, the programmer should use -fno-builtin-memset if that programmer
knows he is accessing cache inhibited space.
To be clear this is not new, cache coherent and cache inhibited storage
have been in the PowerISA from the beginning.
So why all the fuss now?