From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (qmail 29050 invoked from network); 22 Mar 1999 06:06:29 -0000 Received: from mail.redhat.com (199.183.24.239) by lists.redhat.com with SMTP; 22 Mar 1999 06:06:29 -0000 Received: from paralleldata.com (smtp.paralleldata.com [38.153.145.2]) by mail.redhat.com (8.8.7/8.8.7) with ESMTP id AAA21354 for ; Mon, 22 Mar 1999 00:54:16 -0500 Received: by paralleldata.com from localhost (router,SLMail V2.5); Sun, 21 Mar 1999 23:57:21 -0600 Received: by paralleldata.com from paralleldata.com (209.196.80.12::mail daemon; unverified,SLMail V2.5); Sun, 21 Mar 1999 23:57:19 -0600 Sender: "Wsb" Message-ID: <36F5DA6B.9A846133@paralleldata.com> Date: Sun, 21 Mar 1999 23:51:39 -0600 From: "Wes Bauske" Organization: Parallel Data Systems X-Mailer: Mozilla 4.07 [en] (X11; I; Linux 2.0.36 i686) MIME-Version: 1.0 To: axp-list@redhat.com Subject: Re: XP1000 and Linux References: <278EEF4F1348D211940600A0C95BCF7F1F01AC@yellow-fin.alpha-processor.com> <36F5D151.58FA7D47@paralleldata.com> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Wes Bauske wrote: > > > I patched my gas with Richard's update. It does > accept wh64 opcodes now. I'll see about updating > the asm with it for the 8 way unrolled case. I > do have a comment about how gcc unrolls loops. > It may or may not be useful. In general, when I > hand code unrolled loops, what I thought was the > standard way to do this is apparently NOT how gcc > does it. The general form of unrolls I use in C: > > for(i=0; i < n-unroll+1; i+=unroll) { > a[i]=b[i]; > . > . > . > a[i+unroll-1]=b[i+unroll-1]; > } > > nleft=n%unroll; > if(nleft > 0) > for(i=n-nleft; i < n; i++) a[i]=b[i]; > > It seems gcc inserts compares inside the main loop > to see when to leave it after each piece of the unroll > which seems like a waste of energy to me. > > Isn't the above form more efficient cpu-wise?? > Seems so since it doesn't waste any cycles checking > when to quit in the loop you really care about. > An example of the main loop difference with the above technique vs what gcc generates: gcc: $L24: ldt $f1,0($2) addl $9,1,$9 cmple $9,$4,$1 stt $f1,0($3) beq $1,$L22 ldt $f1,8($2) addl $9,1,$9 cmple $9,$4,$1 stt $f1,8($3) beq $1,$L22 ldt $f1,16($2) addl $9,1,$9 cmple $9,$4,$1 stt $f1,16($3) beq $1,$L22 ldt $f1,24($2) addl $9,1,$9 cmple $9,$4,$1 stt $f1,24($3) beq $1,$L22 ldt $f1,32($2) addl $9,1,$9 cmple $9,$4,$1 stt $f1,32($3) beq $1,$L22 ldt $f1,40($2) addl $9,1,$9 cmple $9,$4,$1 stt $f1,40($3) beq $1,$L22 ldt $f1,48($2) addl $9,1,$9 cmple $9,$4,$1 stt $f1,48($3) beq $1,$L22 ldt $f1,56($2) addq $2,64,$2 addl $9,1,$9 cmple $9,$4,$1 stt $f1,56($3) addq $3,64,$3 bne $1,$L24 My example method: (assume for the example, that the value in $4 is a multiple of 8) $L24: wh64 ($3) ldt $f1,0($2) ldt $f2,8($2) ldt $f3,16($2) ldt $f4,24($2) ldt $f5,32($2) ldt $f6,40($2) ldt $f7,48($2) ldt $f8,56($2) stt $f1,0($3) stt $f2,8($3) stt $f3,16($3) stt $f4,24($3) stt $f5,32($3) stt $f6,40($3) stt $f7,48($3) addq $2,64,$2 addl $9,8,$9 cmple $9,$4,$1 stt $f8,56($3) addq $3,64,$3 bne $1,$L24 Bottom opcodes may have better order. It's basically the bottom of the gcc code. Also, depending on memory latency, you can start the stt's before you get all the ldt's done, assuming you can do both an stt and an ldt in the same cycle. Seems that should perform quite a bit better than the gcc loop. Can gcc be setup to do this?? If you seriously want to use wh64, you need to do a pre-process loop to handle the non-64 byte boundary at the front, and a post-process loop to handle the end. Just some thoughts. Wes