From mboxrd@z Thu Jan 1 00:00:00 1970 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 1164f8,ae5adb8385b73ccc,start X-Google-Attributes: gid1164f8,public From: jfc@mit.edu (John Carr) Subject: 21164 odd load timing Date: 1996/05/27 Message-ID: <4odecr$q08@senator-bedfellow.MIT.EDU>#1/1 X-Deja-AN: 157050379 organization: Massachusetts Institute Of Technology newsgroups: comp.sys.dec According to the 21164 instruction scheduling rules I have, it is OK to issue 2 loads in the same cycle regardless of relative address. However, experiments using rpcc for timing demonstrate that two consecutive ldq instructions which reference the same quadword take 9 cycles to execute. This is documented behavior if there is a cache miss (a second load to the same address is aborted and restarted), but I am certain that the loads should hit the dcache. Is this a chip bug? Undocumented feature? Documented feature which I overlooked? This is a test program which must be compiled with GNU C (it uses gcc's inline assembly feature). When run on a 21164 the two loads take a total of 9 cycles to issue (not counting latency to access the results). If the offset, 16, is adjusted to 23 (so that the two loads reference different words), the two loads execute in 1 or 2 cycles, as documented by DEC. The loads also run at full speed on a 21064. #include main(int argc, char *argv[]) { register unsigned int i; unsigned char c[40]; unsigned long before[10], after[10]; int val; /* Set the words being referenced. */ *(long *)&c[16] = ~0L; *(long *)&c[24] = 4; /* Issue a MB instruction, load the value just stored, and reference the register to make sure the load has completed. The operand is now in the cache. */ asm("mb;ldl %0,%1;bis %0,%0,%0" : "=r" (val) : "m" (c[16])); for (i = 0; i < 10; i++) { long l1, l2; asm volatile("rpcc %0;ldq_u %1,0(%4);ldq_u %2,3(%4);rpcc %3" : "=r" (before[i]), "=r" (l1), "=r" (l2), "=r" (after[i]): "r" (&c[16])); } printf("c[16] = %d\n", val); for (i = 0; i < 10; i++) printf("count[%d] = %lu\n", i, after[i] - before[i]); return 0; } -- John Carr (jfc@mit.edu)