From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 48698 invoked by alias); 6 Apr 2017 01:38:23 -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 48677 invoked by uid 89); 6 Apr 2017 01:38:22 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.2 required=5.0 tests=AWL,BAYES_00,FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,SPF_PASS autolearn=ham version=3.3.2 spammy=distrust, heh X-HELO: mail-pg0-f41.google.com Received: from mail-pg0-f41.google.com (HELO mail-pg0-f41.google.com) (74.125.83.41) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 06 Apr 2017 01:38:21 +0000 Received: by mail-pg0-f41.google.com with SMTP id 21so20763583pgg.1 for ; Wed, 05 Apr 2017 18:38:22 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=lldeRwebOOslI3qf2pv+qJZJ52QR4hhBvF2+zA339qk=; b=SN7u2xSIEIjCO5iqlnFRIiggFAEdo5hGY8/8i3lOG0qbzjcwQ/Pgco3UFuRYoZp7Xt PO91eLVh+md2C0K6A7Tu8liMP7Ej8R8DOIN18UGkSNCVhSzCiZ85+N+ybTxmB/Unwwsa OiErGt7x/AZxn9C6WmmYgTLCaemvr5WYlSiCMM6wAnd8r+d4VeTLzt2ssOBF+h+3FX/9 9WR8dMBO3zhhtUpxV0jsuE/InHCmcW6Md0HSuWqalCbZkPtcgzgFB1zqbg4aR1fXiEPu CXDmMz5G7LVaWWWAvcv2v9DEG5IWwYG+Zm3PBRxC0pVjN0mS82Yu9jJM/T1ADdhQwJIq Tmng== X-Gm-Message-State: AFeK/H2Pl+akYhoWkxR5oUGt9dwFwAvjiaGJdx/Pb3jfqL986GCghj8Kp1IjDlkSsfe6KQ== X-Received: by 10.99.104.69 with SMTP id d66mr2562774pgc.93.1491442700809; Wed, 05 Apr 2017 18:38:20 -0700 (PDT) Received: from bubble.grove.modra.org (CPE-58-160-71-80.tyqh2.lon.bigpond.net.au. [58.160.71.80]) by smtp.gmail.com with ESMTPSA id w28sm95689pge.25.2017.04.05.18.38.19 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 05 Apr 2017 18:38:20 -0700 (PDT) Received: by bubble.grove.modra.org (Postfix, from userid 1000) id D0F01C7678; Thu, 6 Apr 2017 11:08:15 +0930 (ACST) Date: Thu, 06 Apr 2017 01:38:00 -0000 From: Alan Modra To: Sandra Loosemore Cc: gcc-patches@gcc.gnu.org Subject: Re: [DOC PATCH] PowerPC extended asm example Message-ID: <20170406013815.GI16711@bubble.grove.modra.org> References: <20170331133021.GH4983@bubble.grove.modra.org> <58E03B5B.9010804@codesourcery.com> <20170404121450.GF16711@bubble.grove.modra.org> <58E50F20.1020802@codesourcery.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <58E50F20.1020802@codesourcery.com> User-Agent: Mutt/1.5.24 (2015-08-30) X-IsSubscribed: yes X-SW-Source: 2017-04/txt/msg00259.txt.bz2 On Wed, Apr 05, 2017 at 09:37:04AM -0600, Sandra Loosemore wrote: > On 04/04/2017 06:14 AM, Alan Modra wrote: > >Revised patch. > > > >[snip] > >+@smallexample > >+static void > >+dgemv_kernel_4x4 (long n, const double *ap, long lda, > >+ const double *x, double *y, double alpha) > >+@{ > >+ double *a0; > >+ double *a1; > >+ double *a2; > >+ double *a3; > >+ > >+ __asm__ > >+ ( > >+ "lxvd2x 34, 0, %10 \n\t" // x0, x1 > >+ "lxvd2x 35, %11, %10 \n\t" // x2, x3 > >+ "xxspltd 32, %x9, 0 \n\t" // alpha, alpha > >+ "sldi %6, %13, 3 \n\t" // lda * sizeof (double) > >+ "xvmuldp 34, 34, 32 \n\t" // x0 * alpha, x1 * alpha > >+ "xvmuldp 35, 35, 32 \n\t" // x2 * alpha, x3 * alpha > >+ "add %4, %3, %6 \n\t" // a0 = ap, a1 = a0 + lda > >+ "add %6, %6, %6 \n\t" // 2 * lda > >+ "xxspltd 32, 34, 0 \n\t" // x0 * alpha, x0 * alpha > >+ "xxspltd 33, 34, 1 \n\t" // x1 * alpha, x1 * alpha > >+ "xxspltd 34, 35, 0 \n\t" // x2 * alpha, x2 * alpha > >+ "xxspltd 35, 35, 1 \n\t" // x3 * alpha, x3 * alpha > >+ "add %5, %3, %6 \n\t" // a2 = a0 + 2 * lda > >+ "add %6, %4, %6 \n\t" // a3 = a1 + 2 * lda > >+ ... > >+ "#n=%1 ap=%8=%12 lda=%13 x=%7=%10 y=%0=%2 alpha=%9 o16=%11\n" > >+ "#a0=%3 a1=%4 a2=%5 a3=%6" > >+ : > >+ "+m" (*y), > >+ "+r" (n), // 1 > >+ "+b" (y), // 2 > >+ "=b" (a0), // 3 > >+ "=b" (a1), // 4 > >+ "=&b" (a2), // 5 > >+ "=&b" (a3) // 6 > >+ : > >+ "m" (*x), > >+ "m" (*ap), > >+ "d" (alpha), // 9 > >+ "r" (x), // 10 > >+ "b" (16), // 11 > >+ "3" (ap), // 12 > >+ "4" (lda) // 13 > >+ : > >+ "cr0", > >+ "vs32","vs33","vs34","vs35","vs36","vs37", > >+ "vs40","vs41","vs42","vs43","vs44","vs45","vs46","vs47" > >+ ); > >+@} > >+@end smallexample > > Hmmm. My main objection to this version is that it's unintelligible to > anyone who can't parse PowerPC assembly language without the help of an > architecture manual, and that's probably the majority of readers. Heh, even I have trouble parsing some powerpc assembly! That's why there are a few lines of text describing what the assembly code does. I am concerned that the 14 lines of assembly shown make the example too big, but it's harder to describe code that isn't shown than to describe something under the nose of the reader. > I'm now wondering if it would be better to have a series of small examples > showing these tricks individually instead of one giant example that tries to > illustrate multiple things? Possibly, but this example comes after many others. If people have waded this far into the asm section of the manual they shouldn't have too much trouble understanding the concepts here. Also, there's value in a real-world example. Maybe that's just me. I'm not someone who tends to read manuals first, preferring to dive right in then go back to a manual later for some detail that can't be easily deduced. In fact, I have a distrust of manuals.. ;) This isn't a criticism of the gcc manual, but other documents I've read over the years are often just plain wrong. I've even been the *author* of technical documentation that had errors, some by yours truly, and some introduced by a "technical writer" who edited my input to make it read better, in the process accidentally changing something that made the details incorrect. I'm sure others have had the same experience. So I like *and trust* code snippets taken from working code more than made up examples created for documentation. -- Alan Modra Australia Development Lab, IBM