]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
Use the precomputed sets_min_1 value consistently when masking
authorTom Hughes <tom@compton.nu>
Thu, 9 Jun 2011 12:26:42 +0000 (12:26 +0000)
committerTom Hughes <tom@compton.nu>
Thu, 9 Jun 2011 12:26:42 +0000 (12:26 +0000)
off bits from an address to find which cache set it is in.

git-svn-id: svn://svn.valgrind.org/valgrind/trunk@11809

cachegrind/cg_sim.c
callgrind/sim.c

index 0b8a1d7c96d1752fe954d1e45120164779702e18..d465bb3a8482a24c16f176010529b79f9dfe92a0 100644 (file)
@@ -139,7 +139,7 @@ void cachesim_##L##_doref(Addr a, UChar size, ULong* m1, ULong *mL)         \
                                                                             \
    /* 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;                                                       \
index 60b2987cccec7109125587d93e9fbb2338c8dedc..26f14bee89a70218f911dce36ff33ddebcc7a593 100644 (file)
@@ -286,7 +286,7 @@ static CacheResult cachesim_ref(cache_t2* c, Addr a, UChar size)
 
     /* 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 @@ CacheResult cachesim_ref_wb(cache_t2* c, RefType ref, Addr a, UChar size)
 
     /* 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 @@ static CacheModelResult cacheuse##_##L##_doRead(Addr a, UChar size)         \
                                                                             \
    /* 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];                  \