From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 68318 invoked by alias); 20 Dec 2018 09:51:31 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Received: (qmail 68299 invoked by uid 89); 20 Dec 2018 09:51:29 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.2 spammy=Hx-languages-length:1738 X-HELO: gate.crashing.org Received: from gate.crashing.org (HELO gate.crashing.org) (63.228.1.57) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 20 Dec 2018 09:51:27 +0000 Received: from gate.crashing.org (localhost.localdomain [127.0.0.1]) by gate.crashing.org (8.14.1/8.14.1) with ESMTP id wBK9pM53027433; Thu, 20 Dec 2018 03:51:23 -0600 Received: (from segher@localhost) by gate.crashing.org (8.14.1/8.14.1/Submit) id wBK9pJ3g027416; Thu, 20 Dec 2018 03:51:19 -0600 Date: Thu, 20 Dec 2018 09:51:00 -0000 From: Segher Boessenkool To: Aaron Sawdey Cc: GCC Patches , David Edelsohn , Bill Schmidt Subject: Re: [PATCH][rs6000] avoid using unaligned vsx or lxvd2x/stxvd2x for memcpy/memmove inline expansion Message-ID: <20181220095119.GP3803@gate.crashing.org> References: <0a17416b-57a0-99e7-2e7e-90a63da66fe6@linux.ibm.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <0a17416b-57a0-99e7-2e7e-90a63da66fe6@linux.ibm.com> User-Agent: Mutt/1.4.2.3i X-IsSubscribed: yes X-SW-Source: 2018-12/txt/msg01445.txt.bz2 On Wed, Dec 19, 2018 at 01:53:05PM -0600, Aaron Sawdey wrote: > Because of POWER9 dd2.1 issues with certain unaligned vsx instructions > to cache inhibited memory, here is a patch that keeps memmove (and memcpy) > inline expansion from doing unaligned vector or using vector load/store > other than lvx/stvx. More description of the issue is here: > > https://patchwork.ozlabs.org/patch/814059/ > > OK for trunk if bootstrap/regtest ok? Okay, but see below. > 2018-12-19 Aaron Sawdey > > * config/rs6000/rs6000-string.c (expand_block_move): Don't use > unaligned vsx and avoid lxvd2x/stxvd2x. > (gen_lvx_v4si_move): New function. > +static rtx > +gen_lvx_v4si_move (rtx dest, rtx src) > +{ > + rtx rv = NULL; > + if (MEM_P (dest)) > + { > + gcc_assert (!MEM_P (src)); > + gcc_assert (GET_MODE (src) == V4SImode); > + rv = gen_altivec_stvx_v4si_internal (dest, src); > + } > + else if (MEM_P (src)) > + { > + gcc_assert (!MEM_P (dest)); > + gcc_assert (GET_MODE (dest) == V4SImode); > + rv = gen_altivec_lvx_v4si_internal (dest, src); > + } > + else > + gcc_unreachable (); > + > + return rv; > +} This is extraordinarily clumsy :-) Maybe something like: static rtx gen_lvx_v4si_move (rtx dest, rtx src) { gcc_assert (!(MEM_P (dest) && MEM_P (src)); gcc_assert (GET_MODE (dest) == V4SImode && GET_MODE (src) == V4SImode); if (MEM_P (dest)) return gen_altivec_stvx_v4si_internal (dest, src); else if (MEM_P (src)) return gen_altivec_lvx_v4si_internal (dest, src); else gcc_unreachable (); } (Or do you allow VOIDmode for src as well?) Anyway, at least get rid of the useless extra variable. Thanks! Segher From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 40290 invoked by alias); 20 Dec 2018 10:51:39 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Received: (qmail 37782 invoked by uid 89); 20 Dec 2018 10:51:39 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=unavailable version=3.3.2 spammy= X-HELO: eggs.gnu.org Received: from eggs.gnu.org (HELO eggs.gnu.org) (208.118.235.92) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 20 Dec 2018 10:51:37 +0000 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gZvvQ-0003OO-8S for gcc-patches@gcc.gnu.org; Thu, 20 Dec 2018 05:51:36 -0500 Received: from gate.crashing.org ([63.228.1.57]:46379) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gZvvP-0003Kp-89 for gcc-patches@gcc.gnu.org; Thu, 20 Dec 2018 05:51:32 -0500 Received: from gate.crashing.org (localhost.localdomain [127.0.0.1]) by gate.crashing.org (8.14.1/8.14.1) with ESMTP id wBK9pM53027433; Thu, 20 Dec 2018 03:51:23 -0600 Received: (from segher@localhost) by gate.crashing.org (8.14.1/8.14.1/Submit) id wBK9pJ3g027416; Thu, 20 Dec 2018 03:51:19 -0600 Date: Thu, 20 Dec 2018 11:16:00 -0000 From: Segher Boessenkool To: Aaron Sawdey Cc: GCC Patches , David Edelsohn , Bill Schmidt Subject: Re: [PATCH][rs6000] avoid using unaligned vsx or lxvd2x/stxvd2x for memcpy/memmove inline expansion Message-ID: <20181220095119.GP3803@gate.crashing.org> References: <0a17416b-57a0-99e7-2e7e-90a63da66fe6@linux.ibm.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <0a17416b-57a0-99e7-2e7e-90a63da66fe6@linux.ibm.com> User-Agent: Mutt/1.4.2.3i X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x [fuzzy] X-Received-From: 63.228.1.57 X-IsSubscribed: yes X-SW-Source: 2018-12/txt/msg01452.txt.bz2 Message-ID: <20181220111600.oF_fTPKYm16lKw63WRYPzD6bab5GyJWBU4748A1bymw@z> On Wed, Dec 19, 2018 at 01:53:05PM -0600, Aaron Sawdey wrote: > Because of POWER9 dd2.1 issues with certain unaligned vsx instructions > to cache inhibited memory, here is a patch that keeps memmove (and memcpy) > inline expansion from doing unaligned vector or using vector load/store > other than lvx/stvx. More description of the issue is here: > > https://patchwork.ozlabs.org/patch/814059/ > > OK for trunk if bootstrap/regtest ok? Okay, but see below. > 2018-12-19 Aaron Sawdey > > * config/rs6000/rs6000-string.c (expand_block_move): Don't use > unaligned vsx and avoid lxvd2x/stxvd2x. > (gen_lvx_v4si_move): New function. > +static rtx > +gen_lvx_v4si_move (rtx dest, rtx src) > +{ > + rtx rv = NULL; > + if (MEM_P (dest)) > + { > + gcc_assert (!MEM_P (src)); > + gcc_assert (GET_MODE (src) == V4SImode); > + rv = gen_altivec_stvx_v4si_internal (dest, src); > + } > + else if (MEM_P (src)) > + { > + gcc_assert (!MEM_P (dest)); > + gcc_assert (GET_MODE (dest) == V4SImode); > + rv = gen_altivec_lvx_v4si_internal (dest, src); > + } > + else > + gcc_unreachable (); > + > + return rv; > +} This is extraordinarily clumsy :-) Maybe something like: static rtx gen_lvx_v4si_move (rtx dest, rtx src) { gcc_assert (!(MEM_P (dest) && MEM_P (src)); gcc_assert (GET_MODE (dest) == V4SImode && GET_MODE (src) == V4SImode); if (MEM_P (dest)) return gen_altivec_stvx_v4si_internal (dest, src); else if (MEM_P (src)) return gen_altivec_lvx_v4si_internal (dest, src); else gcc_unreachable (); } (Or do you allow VOIDmode for src as well?) Anyway, at least get rid of the useless extra variable. Thanks! Segher