|
From: <sv...@va...> - 2011-06-09 12:31:32
|
Author: tom
Date: 2011-06-09 13:26:42 +0100 (Thu, 09 Jun 2011)
New Revision: 11809
Log:
Use the precomputed sets_min_1 value consistently when masking
off bits from an address to find which cache set it is in.
Modified:
trunk/cachegrind/cg_sim.c
trunk/callgrind/sim.c
Modified: trunk/cachegrind/cg_sim.c
===================================================================
--- trunk/cachegrind/cg_sim.c 2011-06-08 20:55:29 UTC (rev 11808)
+++ trunk/cachegrind/cg_sim.c 2011-06-09 12:26:42 UTC (rev 11809)
@@ -139,7 +139,7 @@
\
/* Second case: word straddles two lines. */ \
/* Nb: this is a fast way of doing ((set1+1) % L.sets) */ \
- } else if (((set1 + 1) & (L.sets-1)) == set2) { \
+ } else if (((set1 + 1) & (L.sets_min_1)) == set2) { \
set = &(L.tags[set1 * L.assoc]); \
if (tag == set[0]) { \
goto block2; \
Modified: trunk/callgrind/sim.c
===================================================================
--- trunk/callgrind/sim.c 2011-06-08 20:55:29 UTC (rev 11808)
+++ trunk/callgrind/sim.c 2011-06-09 12:26:42 UTC (rev 11809)
@@ -286,7 +286,7 @@
/* Access straddles two lines. */
/* Nb: this is a fast way of doing ((set1+1) % c->sets) */
- else if (((set1 + 1) & (c->sets-1)) == set2) {
+ else if (((set1 + 1) & (c->sets_min_1)) == set2) {
UWord tag2 = (a+size-1) >> c->tag_shift;
/* the call updates cache structures as side effect */
@@ -390,7 +390,7 @@
/* Access straddles two lines. */
/* Nb: this is a fast way of doing ((set1+1) % c->sets) */
- else if (((set1 + 1) & (c->sets-1)) == set2) {
+ else if (((set1 + 1) & (c->sets_min_1)) == set2) {
UWord tag2 = (a+size-1) & c->tag_mask;
/* the call updates cache structures as side effect */
@@ -735,7 +735,7 @@
\
/* Second case: word straddles two lines. */ \
/* Nb: this is a fast way of doing ((set1+1) % L.sets) */ \
- } else if (((set1 + 1) & (L.sets-1)) == set2) { \
+ } else if (((set1 + 1) & (L.sets_min_1)) == set2) { \
Int miss1=0, miss2=0; /* 0: L1 hit, 1:L1 miss, 2:LL miss */ \
set = &(L.tags[set1 * L.assoc]); \
use_mask = L.line_start_mask[a & L.line_size_mask]; \
|