summaryrefslogtreecommitdiff
path: root/packages/boost/files/arm-intrinsics.patch
blob: 860b6df67c363462cd9976172cbac8799ae42260 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
diff -Nurd boost_1_36_0.orig/boost/detail/atomic_count_sync.hpp boost_1_36_0.arm/boost/detail/atomic_count_sync.hpp
--- boost_1_36_0.orig/boost/detail/atomic_count_sync.hpp	2007-11-23 12:03:14.000000000 -0500
+++ boost_1_36_0.arm/boost/detail/atomic_count_sync.hpp	2008-09-09 13:15:21.000000000 -0400
@@ -29,17 +29,46 @@
 
     void operator++()
     {
+#ifdef __ARM_ARCH_7A__
+       int v1, tmp;
+       asm volatile ("1:                 \n\t"
+                     "ldrex   %0, %1     \n\t"
+                     "add     %0 ,%0, #1 \n\t"
+                     "strex   %2, %0, %1 \n\t"
+                     "cmp     %2, #0     \n\t"
+                     "bne     1b         \n\t"
+                     : "=&r" (v1), "+Q"(value_), "=&r"(tmp)
+                    );
+#else
         __sync_add_and_fetch( &value_, 1 );
+#endif
     }
 
     long operator--()
     {
+#ifdef __ARM_ARCH_7A__
+       int v1, tmp;
+       asm volatile ("1:                 \n\t"
+                     "ldrex   %0, %1     \n\t"
+                     "sub     %0 ,%0, #1 \n\t"
+                     "strex   %2, %0, %1 \n\t"
+                     "cmp     %2, #0     \n\t"
+                     "bne     1b         \n\t"
+                     : "=&r" (v1), "+Q"(value_), "=&r"(tmp)
+                    );
+       return value_;
+#else
         return __sync_add_and_fetch( &value_, -1 );
+#endif
     }
 
     operator long() const
     {
+#if __ARM_ARCH_7A__
+        return value_;
+#else
         return __sync_fetch_and_add( &value_, 0 );
+#endif
     }
 
 private:
Binary files boost_1_36_0.orig/boost/detail/.atomic_count_sync.hpp.swp and boost_1_36_0.arm/boost/detail/.atomic_count_sync.hpp.swp differ