Re: Cannot optimize 64bit Linux code



legrape@xxxxxxxxx wrote:

I am porting a piece of C code to 64bit on Linux. I am using 64bit
integers. It is a floating point intensive code and when I compile
(gcc) on 64 bit machine, I don't see any runtime improvement when
optimizing -O3. If I construct a small program I can get significant
(>4x) speed improvement using -O3 versus -g. If I compile on a 32 bit
machine, it runs 5x faster on the 64 bit machine than does the 64bit
compiled code.

It seems like something is inhibiting the optimization. Someone on
comp.lang.fortran suggested it might be an alignment problem. I am
trying to go through and eliminate all 32 bit integers righ now (this
is a pretty large hunk of code). But thought I would survey this
group, in case it is something naive I am missing.

Any opinion is welcomed. I really need this to run up to speed, and I
need the big address space. Thanks in advance.

This group may not be the best option. Maybe you should try a Linux or
GCC group?

If the same code and compilation commands produce such runtime
difference then perhaps the 64 bit version of the compiler and it's
runtime libraries, as well as perhaps the system runtime libraries are
not yet exploiting all the optimisations possible. Did you try giving
gcc the permission to use intrinsics and SSE? Alignment could well be a
problem though gcc *should* have chosen the best alignment for the
target, unless you specified otherwise. Are there any aspects to your
code (like choice of data types, compiler specific pragmas, struct
padding) that are perhaps selected for 32 bit systems and thus less
than optimal under 64 bit?

Did you try with the Intel compiler? If it produces better code then
that is a piece of evidence indicative, perhaps, that gcc isn't
emitting good code.

.



Relevant Pages

  • Re: Whats the story with the "end of XP"?
    ... Support gives them access to the larger body ... The same compiler suite may be "best" in both ... In the case of ByteCraft compilers, you are truly expert in your field, you work closely and rapidly with customers if there are any issues, and you have top class testing and quality control. ... understanding the inner workings of a relatively simple compiler like GCC ...
    (comp.arch.embedded)
  • [RFC][PATCH-2.6] Clean up and merge compiler-*.h
    ... the kernel headers in include/linux to include/linux-abi. ... * Common definitions for all gcc versions go here. ... -/* Some compiler specific definitions are overwritten here ...
    (Linux-Kernel)
  • Re: LPC900/80C51 Compiler Toolchain
    ... >> supported by GCC, and so they invest. ... > if they already have their in-house compiler. ... one of the main companies in the Symbian consortium ... vendor to provide a good compiler for Atmel AVRs and eventually became ...
    (comp.arch.embedded)
  • Lib X11 compile problem /Xlib.h:3573: error: syntax error before "_X_SENTINEL"
    ... checking for gcc... ... checking for C compiler default output file name... ... checking how to recognise dependent libraries... ...
    (comp.os.linux.x)
  • make error compiling sysbench for MySQL
    ... checking for gcc... ... checking for C compiler default output file name... ... checking libaio.h usability... ... checking libaio.h presence... ...
    (linux.redhat)