]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
Only enable the cache rotation optimization for gcc 4.2 and later.
authorBart Van Assche <bvanassche@acm.org>
Tue, 10 Jun 2008 06:32:49 +0000 (06:32 +0000)
committerBart Van Assche <bvanassche@acm.org>
Tue, 10 Jun 2008 06:32:49 +0000 (06:32 +0000)
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@8212

exp-drd/drd_bitmap.h

index 969ea1e1ec48381a97b25103eb0aea00340fd1cd..4f510c8315286430814c15cc259b52870732acfd 100644 (file)
@@ -204,12 +204,19 @@ static struct bitmap2* bm2_make_exclusive(struct bitmap* const bm,
 
 /** Rotate elements cache[0..n-1] such that the element at position n-1 is
  *  moved to position 0. This allows to speed up future cache lookups.
+ *
+ *  @note Apparently gcc 4.2 compiles this code correctly, but gcc 4.1 not.
  */
 static __inline__
 void bm_cache_rotate(struct bm_cache_elem cache[], const int n)
 {
+#if __GNUC__ >= 4 && __GNUC_MINOR__ >= 2
   struct bm_cache_elem t;
 
+#if 0
+  tl_assert(2 <= n && n <= 8);
+#endif
+
   t = cache[0];
   if (n > 1)
     cache[0] = cache[1];
@@ -226,6 +233,7 @@ void bm_cache_rotate(struct bm_cache_elem cache[], const int n)
   if (n > 7)
     cache[6] = cache[7];
   cache[n - 1] = t;
+#endif
 }
 
 static __inline__