|
From: <sv...@va...> - 2014-03-18 23:03:08
|
Author: sewardj
Date: Tue Mar 18 23:02:59 2014
New Revision: 13878
Log:
Make Helgrind test cases build on arm64-linux.
Modified:
trunk/helgrind/tests/annotate_hbefore.c
trunk/helgrind/tests/tc07_hbl1.c
trunk/helgrind/tests/tc08_hbl2.c
trunk/helgrind/tests/tc11_XCHG.c
Modified: trunk/helgrind/tests/annotate_hbefore.c
==============================================================================
--- trunk/helgrind/tests/annotate_hbefore.c (original)
+++ trunk/helgrind/tests/annotate_hbefore.c Tue Mar 18 23:02:59 2014
@@ -167,6 +167,39 @@
return success;
}
+#elif defined(VGA_arm64)
+
+// arm64
+/* return 1 if success, 0 if failure */
+UWord do_acasW ( UWord* addr, UWord expected, UWord nyu )
+{
+ UWord old, success;
+ UWord block[2] = { (UWord)addr, nyu };
+
+ /* Fetch the old value, and set the reservation */
+ __asm__ __volatile__ (
+ "ldxr %0, [%1]" "\n"
+ : /*out*/ "=r"(old)
+ : /*in*/ "r"(addr)
+ );
+
+ /* If the old value isn't as expected, we've had it */
+ if (old != expected) return 0;
+
+ /* otherwise try to stuff the new value in */
+ __asm__ __volatile__(
+ "ldr x4, [%1, #0]" "\n\t"
+ "ldr x5, [%1, #8]" "\n\t"
+ "stxr w6, x5, [x4, #0]" "\n\t"
+ "eor %0, x6, #1" "\n\t"
+ : /*out*/ "=r"(success)
+ : /*in*/ "r"(&block[0])
+ : /*trash*/ "x4","x5","x6","memory"
+ );
+ assert(success == 0 || success == 1);
+ return success;
+}
+
#elif defined(VGA_s390x)
// s390x
Modified: trunk/helgrind/tests/tc07_hbl1.c
==============================================================================
--- trunk/helgrind/tests/tc07_hbl1.c (original)
+++ trunk/helgrind/tests/tc07_hbl1.c Tue Mar 18 23:02:59 2014
@@ -13,6 +13,7 @@
#undef PLAT_ppc32_linux
#undef PLAT_ppc64_linux
#undef PLAT_arm_linux
+#undef PLAT_arm64_linux
#undef PLAT_s390x_linux
#undef PLAT_mips32_linux
@@ -28,8 +29,10 @@
# define PLAT_ppc32_linux 1
#elif defined(__linux__) && defined(__powerpc__) && defined(__powerpc64__)
# define PLAT_ppc64_linux 1
-#elif defined(__linux__) && defined(__arm__)
+#elif defined(__linux__) && defined(__arm__) && !defined(__aarch64__)
# define PLAT_arm_linux 1
+#elif defined(__linux__) && defined(__aarch64__) && !defined(__arm__)
+# define PLAT_arm64_linux 1
#elif defined(__linux__) && defined(__s390x__)
# define PLAT_s390x_linux 1
#elif defined(__linux__) && defined(__mips__)
@@ -64,6 +67,18 @@
: /*out*/ : /*in*/ "r"(&(_lval)) \
: /*trash*/ "r8", "r9", "cc", "memory" \
);
+#elif defined(PLAT_arm64_linux)
+# define INC(_lval,_lqual) \
+ __asm__ __volatile__( \
+ "1:\n" \
+ " ldxr w8, [%0, #0]\n" \
+ " add w8, w8, #1\n" \
+ " stxr w9, w8, [%0, #0]\n" \
+ " cmp w9, #0\n" \
+ " bne 1b\n" \
+ : /*out*/ : /*in*/ "r"(&(_lval)) \
+ : /*trash*/ "x8", "x9", "cc", "memory" \
+ );
#elif defined(PLAT_s390x_linux)
# define INC(_lval,_lqual) \
__asm__ __volatile__( \
Modified: trunk/helgrind/tests/tc08_hbl2.c
==============================================================================
--- trunk/helgrind/tests/tc08_hbl2.c (original)
+++ trunk/helgrind/tests/tc08_hbl2.c Tue Mar 18 23:02:59 2014
@@ -29,6 +29,7 @@
#undef PLAT_ppc32_linux
#undef PLAT_ppc64_linux
#undef PLAT_arm_linux
+#undef PLAT_arm64_linux
#undef PLAT_s390x_linux
#undef PLAT_mips32_linux
#undef PLAT_mips64_linux
@@ -45,8 +46,10 @@
# define PLAT_ppc32_linux 1
#elif defined(__linux__) && defined(__powerpc__) && defined(__powerpc64__)
# define PLAT_ppc64_linux 1
-#elif defined(__linux__) && defined(__arm__)
+#elif defined(__linux__) && defined(__arm__) && !defined(__aarch64__)
# define PLAT_arm_linux 1
+#elif defined(__linux__) && defined(__aarch64__) && !defined(__arm__)
+# define PLAT_arm64_linux 1
#elif defined(__linux__) && defined(__s390x__)
# define PLAT_s390x_linux 1
#elif defined(__linux__) && defined(__mips__)
@@ -86,6 +89,18 @@
: /*out*/ : /*in*/ "r"(&(_lval)) \
: /*trash*/ "r8", "r9", "cc", "memory" \
);
+#elif defined(PLAT_arm64_linux)
+# define INC(_lval,_lqual) \
+ __asm__ __volatile__( \
+ "1:\n" \
+ " ldxr w8, [%0, #0]\n" \
+ " add w8, w8, #1\n" \
+ " stxr w9, w8, [%0, #0]\n" \
+ " cmp w9, #0\n" \
+ " bne 1b\n" \
+ : /*out*/ : /*in*/ "r"(&(_lval)) \
+ : /*trash*/ "x8", "x9", "cc", "memory" \
+ );
#elif defined(PLAT_s390x_linux)
# define INC(_lval,_lqual) \
__asm__ __volatile__( \
Modified: trunk/helgrind/tests/tc11_XCHG.c
==============================================================================
--- trunk/helgrind/tests/tc11_XCHG.c (original)
+++ trunk/helgrind/tests/tc11_XCHG.c Tue Mar 18 23:02:59 2014
@@ -31,8 +31,10 @@
# define PLAT_ppc32_linux 1
#elif defined(__linux__) && defined(__powerpc__) && defined(__powerpc64__)
# define PLAT_ppc64_linux 1
-#elif defined(__linux__) && defined(__arm__)
+#elif defined(__linux__) && defined(__arm__) && !defined(__aarch64__)
# define PLAT_arm_linux 1
+#elif defined(__linux__) && defined(__aarch64__) && !defined(__arm__)
+# define PLAT_arm64_linux 1
#elif defined(__linux__) && defined(__s390x__)
# define PLAT_s390x_linux 1
#elif defined(__linux__) && defined(__mips__)
@@ -91,7 +93,7 @@
XCHG_M_R(_addr,_lval)
#elif defined(PLAT_ppc32_linux) || defined(PLAT_ppc64_linux) \
- || defined(PLAT_arm_linux)
+ || defined(PLAT_arm_linux) || defined(PLAT_arm64_linux)
# if defined(HAVE_BUILTIN_ATOMIC)
# define XCHG_M_R(_addr,_lval) \
do { \
|