From: Robert Harley <Robert.Harley@inria.fr>
To: axp-list@redhat.com
Subject: 21164 speed definitive answer
Date: Thu, 17 Dec 1998 14:12:28 +0100 (MET) [thread overview]
Message-ID: <199812171312.OAA30693@pauillac.inria.fr> (raw)
Thorsten Koch (koch@zib.de) wrote:
>Hello,
>
>thanks for the answers to my question. In fact I had allready
>read the documentation, but measuring with the rpcc failed to find a
>instruction sequence that needed less than 1 cycle/instruction.
Try this:
==============================================================================
#ifndef __alpha
#error Use an Alpha!
#endif
#include <stdio.h>
typedef unsigned int u32;
typedef unsigned long u64;
/*-- main ------------------------------------------------------------------*/
#define BLA() \
asm volatile ( \
"addt %2,%3,%0
addq $1,$2,$3
mult %4,%5,%1
addq $4,$5,$6" \
: "=f"(f3), "=f"(f6) \
: "f"(f1), "f"(f2), "f"(f4), "f"(f5) \
: "$1", "$2", "$3", "$4", "$5", "$6" \
)
#define ITERS (1000UL)
int main(int argc, char *argv[]) {
u32 cycles, minimum;
u64 c0, c1, i, total;
double f1,f2,f3,f4,f5,f6;
minimum = -1U;
total = 0UL;
f1 = f2 = f4 = f5 = 0.0;
for (i = 0UL; i < ITERS; ++i) {
asm volatile (".align 4; rpcc %0" : "=r"(c0));
BLA();
BLA();
BLA();
BLA();
asm volatile ("rpcc %0" : "=r"(c1));
cycles = (u32)(c1-c0+(c1>>32)-(c0>>32));
if (cycles < minimum) minimum = cycles;
total += (u64)cycles;
} /* end for */
printf( "Average cycles = %g, minimum = %u.\n"
, (double)total/(double)ITERS, minimum
);
return 0;
} /* end main */
==============================================================================
I get:
corton.inria.fr-bla/221 > egcs -O3 bla.c
corton.inria.fr-bla/222 > ./a.out
Average cycles = 4.024, minimum = 4.
The code looks like:
corton.inria.fr-bla/223 > egcs -O3 bla.c -S
corton.inria.fr-bla/224 > cat bla.s
[...]
.align 4; rpcc $8
addt $f12,$f13,$f10
addq $1,$2,$3
mult $f14,$f15,$f11
addq $4,$5,$6
addt $f12,$f13,$f10
addq $1,$2,$3
mult $f14,$f15,$f11
addq $4,$5,$6
addt $f12,$f13,$f10
addq $1,$2,$3
mult $f14,$f15,$f11
addq $4,$5,$6
addt $f12,$f13,$f10
addq $1,$2,$3
mult $f14,$f15,$f11
addq $4,$5,$6
rpcc $7
[...]
Bye,
Rob.
next reply other threads:[~1998-12-17 13:22 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
1998-12-17 13:12 Robert Harley [this message]
1998-12-17 12:24 ` 21164 speed definitive answer Matti Aarnio
1998-12-17 15:16 ` Thorsten Koch
-- strict thread matches above, loose matches on Subject: below --
1998-12-17 15:28 Robert Harley
1998-12-17 10:02 Thorsten Koch
1998-12-17 17:23 ` Oscar Levi
1998-12-21 8:20 ` Thorsten Koch
read-only archive
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox