From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (qmail 24973 invoked from network); 17 Dec 1998 13:22:23 -0000 Received: from mail.redhat.com (199.183.24.239) by lists.redhat.com with SMTP; 17 Dec 1998 13:22:23 -0000 Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by mail.redhat.com (8.8.7/8.8.7) with ESMTP id IAA27876 for ; Thu, 17 Dec 1998 08:12:29 -0500 Received: from pauillac.inria.fr (pauillac.inria.fr [128.93.11.35]) by concorde.inria.fr (8.8.7/8.8.7) with ESMTP id OAA19046 for ; Thu, 17 Dec 1998 14:12:28 +0100 (MET) Received: (from harley@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id OAA30693 for axp-list@redhat.com; Thu, 17 Dec 1998 14:12:28 +0100 (MET) Date: Thu, 17 Dec 1998 14:12:28 +0100 (MET) From: Robert Harley Message-Id: <199812171312.OAA30693@pauillac.inria.fr> To: axp-list@redhat.com Subject: 21164 speed definitive answer 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 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.