Usenet comp.sys.dec (1990-2013)
 help / color / mirror / Atom feed
* 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

* Re: Request for help with Alpha OSF C compiler (instruction scheduling)
  1993-08-10 23:36 Request for help with Alpha OSF C compiler (instruction scheduling)  CSHL
@ 1993-08-11  2:13 ` Richard Kenner
  1993-08-11 21:42 ` Gail L. Grant
  1 sibling, 0 replies; 4+ messages in thread
From: Richard Kenner @ 1993-08-11  2:13 UTC (permalink / raw)


In article <249bdeINN98a@phage.cshl.org> wchang@phage.cshl.org ( CSHL) writes:
>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.  

GCC certainly ought to be able to get it right, though I haven't
tried that particular case since I'd need a larger code fragment.


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

* 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

* Re: Request for help with Alpha OSF C compiler (instruction scheduling)
  1993-08-10 23:36 Request for help with Alpha OSF C compiler (instruction scheduling)  CSHL
  1993-08-11  2:13 ` Richard Kenner
@ 1993-08-11 21:42 ` Gail L. Grant
  1 sibling, 0 replies; 4+ messages in thread
From: Gail L. Grant @ 1993-08-11 21:42 UTC (permalink / raw)



In article <249bdeINN98a@phage.cshl.org>, wchang@phage.cshl.org ( CSHL) writes:
|>
|>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).
|>
the GEM c compiler comes with OSF/1 version 1.3.  it is a part of the
Compiler Enhancements subset CMPDEVENH130 in the 'Development Enhancements
for OSF/1 AXP Systems ( Rev 111 )' - product 4 in the OSF V1.3 kit.

you invoke it with cc -migrate.  see the documentation for details.

g.
--
============================================================================
Gail L. Grant - "Live free or WISH you had" - (415)853-6564 grant@pa.dec.com
                                              WORK phone #
Opinions expressed are my own, OBVIOUSLY not those of my employer.


^ 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-10 23:36 Request for help with Alpha OSF C compiler (instruction scheduling)  CSHL
1993-08-11  2:13 ` Richard Kenner
1993-08-11 21:42 ` Gail L. Grant
  -- strict thread matches above, loose matches on Subject: below --
1993-08-11 13:11  CSHL

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