This is the mail archive of the
gcc-testresults@gcc.gnu.org
mailing list for the GCC project.
sgi cc and gcc
- To: gcc-testresults at gcc dot gnu dot org, gcc at gcc dot gnu dot org
- Subject: sgi cc and gcc
- From: David Bourguignon <David dot Bourguignon at imag dot fr>
- Date: Tue, 31 Jul 2001 13:15:18 +0200
- Organization: iMAGIS
Hi all,
I've got strange performance results on two different platforms: one with sgi cc
and a mips processor and one with gnu gcc and an intel processor.
I was looking for the difference between two alternative constructs (see code
below). My benchmark consisted in calling *_add() many times.
Here is the time elapsed for each construct:
Vec2d
sgi cc: 15.018956
gcc: 46.187340
Vec2ds
sgi cc: 47.569683
gcc: 22.387057
I knew that sgi cc was unable to perform ISO C 1999 inline optimization, so the
difference between the two compilers is understandable for Vec2ds. What is more
surprising is the difference for Vec2d: it seems that gcc don't know how to
optimize functions taking arrays in parameters.
Do you have a better explanation ?
(If you are interested I can send you the code for the entire benchmark).
Thank you in advance,
David.
/******************************************************************************/
#ifdef __sgi
#define __inline__ static __inline
#else
#define __inline__ static inline
#endif
typedef double Vec2d[4];
typedef const double const_Vec2d[4];
typedef struct _Vec2ds Vec2ds;
struct _Vec2ds {
double x, y;
};
__inline__ void vec2d_add(Vec2d v, const_Vec2d a, const_Vec2d b) {
v[0] = a[0] + b[0];
v[1] = a[1] + b[1];
}
__inline__ Vec2ds *
vec2ds_add(Vec2ds *v, const Vec2ds *a, const Vec2ds *b) {
v->x = a->x + b->x;
v->y = a->y + b->y;
return (v);
}
/******************************************************************************/
--
iMAGIS project, GRAVIR lab
INRIA Rhône-Alpes, 655 avenue de l'Europe
38330 Montbonnot Saint Martin, France
http://www-imagis.imag.fr/~David.Bourguignon/index.gb.html