* cc vs cc -migrate on Digital Unix
@ 1996-06-18 4:00 James Bonfield
1996-06-20 4:00 ` Burkhard Neidecker-Lutz
` (3 more replies)
0 siblings, 4 replies; 5+ messages in thread
From: James Bonfield @ 1996-06-18 4:00 UTC (permalink / raw)
I've been trying to work out the difference between cc and cc -migrate.
They seem to produce suprisingly different code than each other. As an
example here's a simple byte swapping routine.
#define swap_int4(src, dst) \
do { \
((char *)&(dst))[0] = ((char *) &(src))[3];\
((char *)&(dst))[1] = ((char *) &(src))[2];\
((char *)&(dst))[2] = ((char *) &(src))[1];\
((char *)&(dst))[3] = ((char *) &(src))[0];\
} while (0)
static void swap4(int *src, int *dst, int N)
{
for(; N; N--, src++, dst++)
swap_int4(*src, *dst);
}
#define TEST_SIZE 250000
int main() {
int buf_src[TEST_SIZE];
int buf_dst[TEST_SIZE];
int i;
for (i = 0; i < 100; i++) {
swap4(buf_src, buf_dst, TEST_SIZE);
}
return 0;
}
Compiling and running this with both cc and cc -migrate gives the following
results.
Command Time, best of 3 runs (150Mhz DEC 3000/500)
==================================================================
cc -O4 10.5 user 0.1 system
cc -O4 -migrate 3.6 user 0.0 system
That's an enormous difference. Rewriting the above macro as below yields
further results.
#define swap_int4(src, dst) \
do { \
dst = ((src & 0x000000ff) << 24) + \
((src & 0x0000ff00) << 8) + \
((src & 0x00ff0000) >> 8) + \
((src & 0xff000000) >> 24); \
} while (0)
Command Time, best of 3 runs (150Mhz DEC 3000/500)
==================================================================
cc -O4 3.7 user 0.1 system
cc -O4 -migrate 3.0 user 0.1 system
Looks like it's a better macro for both programs and cc has now got around
that terrible performance hit. cc -migrate still has the edge.
I then noticed that the "do {...} while (0)" construct wasn't so useful in the
new macro as it's 1 C statement anyway, so I changed the macro again to the
following and recompiled.
#define swap_int4(src, dst) \
dst = ((src & 0x000000ff) << 24) + \
((src & 0x0000ff00) << 8) + \
((src & 0x00ff0000) >> 8) + \
((src & 0xff000000) >> 24);
Command Time, best of 3 runs (150Mhz DEC 3000/500)
==================================================================
cc -O4 3.3 user 0.1 system
cc -O4 -migrate 3.0 user 0.0 system
So it appears that having a "do {...} while (0)" around a statement causes a
penalty for optimising with cc, but none for cc -migrate.
At the end of this it appears that cc -migrate is definitely the superior
compiler. Why does using this flag change things so much!? I suspect that cc
-migrate is actually an entirely different compiling engine. If it's really
better (obviously my benchmarks are one specialist and trivial case) why isn't
it the default system? I haven't got gcc compiled up on my system and I
haven't got the real c89 either so I haven't compared these.
Trying gcc on Solaris and cc on Irix I find that all these pieces of source
compile and optimise to give the same efficiency.
Any suggestions on which compiler to use for real production software?
Cheers,
James
--
James Bonfield (jkb@mrc-lmb.cam.ac.uk) Tel: 01223 402499 Fax: 01223 412282
Medical Research Council - Laboratory of Molecular Biology,
Hills Road, Cambridge, CB2 2QH, England.
Also see Staden Package WWW site at http://www.mrc-lmb.cam.ac.uk/pubseq/
^ permalink raw reply [flat|nested] 5+ messages in thread* Re: cc vs cc -migrate on Digital Unix
1996-06-18 4:00 cc vs cc -migrate on Digital Unix James Bonfield
@ 1996-06-20 4:00 ` Burkhard Neidecker-Lutz
1996-06-20 4:00 ` Petri Kaukasoina
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: Burkhard Neidecker-Lutz @ 1996-06-20 4:00 UTC (permalink / raw)
In article <4q6pvi$s5m@lyra.csx.cam.ac.uk> jkb@mrc-lmb.cam.ac.uk (James Bonfield) writes:
>
>I've been trying to work out the difference between cc and cc -migrate.
>At the end of this it appears that cc -migrate is definitely the superior
>compiler. Why does using this flag change things so much!? I suspect that cc
>-migrate is actually an entirely different compiling engine.
Yes. They invoke totally different compilers.
>why isn't it the default system?
Under Digital Unix V4.0 it is the default. There are historical reasons
for this.
>Any suggestions on which compiler to use for real production software?
For development, I use both (and GCC as well), just to see what happens
or because different compilers look at different errors (heck, I even
use Saber C aka Centerline on my MIPS box). For production releases
on the Alpha I usually compile once with "cc" (ACC) and once with
"cc -migrate" (GEM C) and pick the better one, because there are some
weird cases where ACC is better than GEM C.
Burkhard Neidecker-Lutz
EUROMEDIA - Distributed Multimedia Archives for Cooperative TV Production
CEC Karlsruhe , European Applied Research Center, Digital Equip. Corp.
email: neideck@kar.dec.com
^ permalink raw reply [flat|nested] 5+ messages in thread* Re: cc vs cc -migrate on Digital Unix
1996-06-18 4:00 cc vs cc -migrate on Digital Unix James Bonfield
1996-06-20 4:00 ` Burkhard Neidecker-Lutz
@ 1996-06-20 4:00 ` Petri Kaukasoina
1996-06-20 4:00 ` Jeff Donsbach
1996-06-20 4:00 ` Kevin Oberman
3 siblings, 0 replies; 5+ messages in thread
From: Petri Kaukasoina @ 1996-06-20 4:00 UTC (permalink / raw)
James Bonfield <jkb@mrc-lmb.cam.ac.uk> wrote:
>At the end of this it appears that cc -migrate is definitely the superior
>compiler.
Yes. 'cc -migrate -O' makes faster code than 'cc -O'.
>I suspect that cc
>-migrate is actually an entirely different compiling engine.
cc is the "DEC OSF/1 C compiler" and cc -migrate is the "DEC C
compilation environment" according to the man page.
>I haven't got gcc compiled up on my system and I
>haven't got the real c89 either so I haven't compared these.
'gcc -O' makes even slower code than 'cc -O'.
>Any suggestions on which compiler to use for real production software?
For heavy number crunching please try 'cc -migrate -O -non_shared -om'.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: cc vs cc -migrate on Digital Unix
1996-06-18 4:00 cc vs cc -migrate on Digital Unix James Bonfield
1996-06-20 4:00 ` Burkhard Neidecker-Lutz
1996-06-20 4:00 ` Petri Kaukasoina
@ 1996-06-20 4:00 ` Jeff Donsbach
1996-06-20 4:00 ` Kevin Oberman
3 siblings, 0 replies; 5+ messages in thread
From: Jeff Donsbach @ 1996-06-20 4:00 UTC (permalink / raw)
James Bonfield (jkb@mrc-lmb.cam.ac.uk) wrote:
As you surmised, cc -migrate is an entirely different compiler based on the
GEM optimizer technology. The default compiler (just cc) is the old compiler
technology carried over from the Mips/Ultrix days.
: If it's really better (obviously my benchmarks are one specialist
: and trivial case) why isn't it the default system?
It is in Digital Unix 4.0.
-Jeff
--
=========================
Jeff Donsbach Digital Equipment Corporation, Software Partner Engineering
200 Forest St., MRO1-2/K5, Marlborough, MA 01752-3011
Internet Email: donsbach@fluid.mro.dec.com "10 bucks is 10 bucks" - Geddy Lee
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: cc vs cc -migrate on Digital Unix
1996-06-18 4:00 cc vs cc -migrate on Digital Unix James Bonfield
` (2 preceding siblings ...)
1996-06-20 4:00 ` Jeff Donsbach
@ 1996-06-20 4:00 ` Kevin Oberman
3 siblings, 0 replies; 5+ messages in thread
From: Kevin Oberman @ 1996-06-20 4:00 UTC (permalink / raw)
In article <4q6pvi$s5m@lyra.csx.cam.ac.uk>
jkb@mrc-lmb.cam.ac.uk (James Bonfield) writes:
> I've been trying to work out the difference between cc and cc -migrate.
> They seem to produce suprisingly different code than each other. As an
> example here's a simple byte swapping routine.
> [Testing information deleted]
> At the end of this it appears that cc -migrate is definitely the superior
> compiler. Why does using this flag change things so much!? I suspect that cc
> -migrate is actually an entirely different compiling engine. If it's really
> better (obviously my benchmarks are one specialist and trivial case) why isn't
> it the default system? I haven't got gcc compiled up on my system and I
> haven't got the real c89 either so I haven't compared these.
>
> Trying gcc on Solaris and cc on Irix I find that all these pieces of source
> compile and optimise to give the same efficiency.
cc is the old MIPS C compiler. cc -migrate is the new GEM
compiler. GEM is almost always far superior to the MIPS compiler and,
as you guessed, a completely different engine.
As to the issue of why it's not default... it is as of V4.0. The
problem is that cc -migrate is licensed differently and is not
included in the base software for DU. So, if you had not installed cc
-migrate and its license, you could not have rebuilt the kernel. I
understand that V4.0 will include cc -migrate in the base kit.
--
R. Kevin Oberman
Energy Sciences Network (ESnet)
Lawrence Berkeley National Laboratory (LBNL)
E-mail: oberman@es.net
Phone: +1 510 486-8634
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~1996-06-20 4:00 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
1996-06-18 4:00 cc vs cc -migrate on Digital Unix James Bonfield
1996-06-20 4:00 ` Burkhard Neidecker-Lutz
1996-06-20 4:00 ` Petri Kaukasoina
1996-06-20 4:00 ` Jeff Donsbach
1996-06-20 4:00 ` Kevin Oberman
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox