Usenet comp.os.linux.alpha (1997-2013)
 help / color / mirror / Atom feed
From: Alex Rhomberg <rhomberg@ife.ee.ethz.ch>
Subject: Re: optimized (or optimizable) C programming?
Date: 1999/10/05	[thread overview]
Message-ID: <37FA0D1B.BF58B3D4@ife.ee.ethz.ch> (raw)
In-Reply-To: rz71zb9vs06.fsf@corton.inria.fr

Robert Harley wrote:
> 
> Alex Rhomberg <rhomberg@ife.ee.ethz.ch> writes:
> > void test2 (double *fmat_lin, const double *x, const double *dhdX0_lin)
> 
> If you know that fmat_lin doesn't overlap with the others you can mark
> it with  __restrict in ccc and in the latest gcc.

> #define RESTRICT __restrict

> void test2
>   ( double * RESTRICT fmat_lin, const double *x, const double *dhdX0_lin ) {

This doesn't seem to make a difference:

=cut thistest.c

void scatter( double * __restrict dforce, double * df_el, int *nodeI)
{
  int thisnode;
  int jE_node;
  for (jE_node = 0; jE_node < 8; jE_node++) /* scatter internal force*/
  {
    thisnode = nodeI[jE_node]*3;/*will be replaced by pointers*/
    dforce[thisnode+0] -= df_el[jE_node*3+0];
    dforce[thisnode+1] -= df_el[jE_node*3+1];
    dforce[thisnode+2] -= df_el[jE_node*3+2];
  }
}

=cut commands

ccc -fast -std1 -c thistest.c -o ttt.o # both -std1 and __restrict
should tell the                    
                                       # compiler that inputs don't
overlap
objdump -rd ttt.o | more

=cut part of output, annotated
  9c:   00 00 88 8e     ldt     $f20,0(t7)
  a0:   d0 ff b1 8e     ldt     $f21,-48(a1)    
  a4:   34 14 95 5a     subt    $f20,$f21,$f20   #first wait for $f21
  a8:   00 00 88 9e     stt     $f20,0(t7)       #wait for  fadd latency
  ac:   08 00 c8 8e     ldt     $f22,8(t7)
  b0:   d8 ff f1 8e     ldt     $f23,-40(a1)
  b4:   36 14 d7 5a     subt    $f22,$f23,$f22   #sleep(2)
  b8:   08 00 c8 9e     stt     $f22,8(t7)       #drink_coffee

=cut comment
It gets better if I restrict ALL the parameters

- Alex



  reply	other threads:[~1999-10-05  4:00 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1999-10-04  4:00 optimized (or optimizable) C programming? Alex Rhomberg
1999-10-04  4:00 ` Greg Lindahl
1999-10-05  4:00 ` Robert Harley
1999-10-05  4:00   ` Alex Rhomberg [this message]
1999-10-05  4:00     ` ccc code wierdness Alex Rhomberg
read-only archive

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox