Usenet comp.sys.dec (1990-2013)
 help / color / mirror / Atom feed
* Request for help with Alpha OSF C compiler (instruction scheduling)
@ 1993-08-11 13:11  CSHL
  0 siblings, 0 replies; 4+ messages in thread
From:  CSHL @ 1993-08-11 13:11 UTC (permalink / raw)


I am implementing a very tight innermost loop consisting of six integer
"MAX" operations, 20 instructions altogether.  While the C compiler produced
very tight code, using conditional-moves for "MAX", it apparently does
not optimize instruction scheduling.  For example, it compiles

  if (a>b) b=a;
  if (c>d) d=c;
to
  cmple a,b,$0
  cmoveq $0,a,b
  cmple c,d,$0
  cmoveq $0,c,d

which disrupts the pipeline (instruction latency plus register $0 bottleneck)
and causes 50% performance degradation.  I had to rewrite the C code as

  x=(a>b);
  y=(c>d);
  if (x) b=a;
  if (y) d=c;

to get the Alpha to perform near its spec.  Even then, the compiler still
improperly rearranged some instructions.  I had to undo this in the assembly
output of cc, after the loop was unrolled 4x4 = 16 times!  Also, cc -O2
does not seem to use all available registers.

If anyone knows how I can obtain a different compiler (GEM?), or an
instruction scheduler, I would appreciate very much the information.
The program instr-sched.c at gatekeeper.dec.com does not do I/O, otherwise
it might solve my problem.  I am using an AXP 4000/610 server running 
OSF/1 V1.2 (Rev. 10).

Thanks in advance,


William Chang

Cold Spring Harbor Laboratory
100 Bungtown Road, Cold Spring Harbor, NY 11724

516-367-8866 -4229(fax)
Email: wchang@cshl.org


^ permalink raw reply	[flat|nested] 4+ messages in thread
* Request for help with Alpha OSF C compiler (instruction scheduling)
@ 1993-08-10 23:36  CSHL
  1993-08-11  2:13 ` Richard Kenner
  1993-08-11 21:42 ` Gail L. Grant
  0 siblings, 2 replies; 4+ messages in thread
From:  CSHL @ 1993-08-10 23:36 UTC (permalink / raw)
  Cc: wchang

I am implementing a very tight innermost loop consisting of six integer
"MAX" operations, 20 instructions altogether.  While the C compiler produced
very tight code, using conditional-moves for "MAX", it apparently does
not optimize instruction scheduling.  For example, it compiles

  if (a>b) b=a;
  if (c>d) d=c;
to
  cmple a,b,$0
  cmoveq $0,a,b
  cmple c,d,$0
  cmoveq $0,c,d

which disrupts the pipeline (instruction latency plus register $0 bottleneck)
and causes 50% performance degradation.  I had to rewrite the C code as

  x=(a>b);
  y=(c>d);
  if (x) b=a;
  if (y) d=c;

to get the Alpha to perform near its spec.  Even then, the compiler still
improperly rearranged some instructions.  I had to undo this in the assembly
output of cc, after the loop was unrolled 4x4 = 16 times!  Also, cc -O2
does not seem to use all available registers.

If anyone knows how I can obtain a different compiler (GEM?), or an
instruction scheduler, I would appreciate very much the information.
The program instr-sched.c at gatekeeper.dec.com does not do I/O, otherwise
it might solve my problem.  I am using an AXP 4000/610 server running 
OSF/1 V1.2 (Rev. 10).

Thanks in advance,


William Chang

Cold Spring Harbor Laboratory
100 Bungtown Road, Cold Spring Harbor, NY 11724

516-367-8866 -4229(fax)
Email: wchang@cshl.org


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~1993-08-11 21:42 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
1993-08-11 13:11 Request for help with Alpha OSF C compiler (instruction scheduling)  CSHL
  -- strict thread matches above, loose matches on Subject: below --
1993-08-10 23:36  CSHL
1993-08-11  2:13 ` Richard Kenner
1993-08-11 21:42 ` Gail L. Grant

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