From mboxrd@z Thu Jan 1 00:00:00 1970 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 1164f8,4ad4dd43d4959149 X-Google-Attributes: gid1164f8,public X-Google-ArrivalTime: 1993-08-11 06:23:06 PST Path: gmd.de!newsserver.jvnc.net!newsserver.cshl.org!newsserver.cshl.org!not-for-mail From: wchang@phage.cshl.org ( CSHL) Newsgroups: comp.sys.dec Subject: Request for help with Alpha OSF C compiler (instruction scheduling) Date: 11 Aug 1993 09:11:05 -0400 Organization: Cold Spring Harbor Lab, NY Distribution: world Message-ID: <24ar59INNe80@phage.cshl.org> NNTP-Posting-Host: phage.cshl.org Summary: cc -O2 ignores pipeline issues? 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