aboutsummaryrefslogtreecommitdiff
path: root/helgrind/tests
diff options
context:
space:
mode:
Diffstat (limited to 'helgrind/tests')
-rw-r--r--helgrind/tests/annotate_hbefore.c10
-rw-r--r--helgrind/tests/tc07_hbl1.c9
-rw-r--r--helgrind/tests/tc08_hbl2.c9
-rw-r--r--helgrind/tests/tc11_XCHG.c9
4 files changed, 37 insertions, 0 deletions
diff --git a/helgrind/tests/annotate_hbefore.c b/helgrind/tests/annotate_hbefore.c
index 74cf9d86c..9f3636cd3 100644
--- a/helgrind/tests/annotate_hbefore.c
+++ b/helgrind/tests/annotate_hbefore.c
@@ -285,6 +285,16 @@ UWord do_acasW ( UWord* addr, UWord expected, UWord nyu )
return success;
}
+#elif defined(VGA_tilegx)
+
+/* return 1 if success, 0 if failure */
+UWord do_acasW(UWord* addr, UWord expected, UWord nyu )
+{
+ /* Load the compare value into special register 0x2780 */
+ __insn_mtspr(0x2780, expected);
+ return __insn_cmpexch(addr, nyu);
+}
+
#endif
void atomic_incW ( UWord* w )
diff --git a/helgrind/tests/tc07_hbl1.c b/helgrind/tests/tc07_hbl1.c
index be62337db..c66b8ec1f 100644
--- a/helgrind/tests/tc07_hbl1.c
+++ b/helgrind/tests/tc07_hbl1.c
@@ -16,6 +16,7 @@
#undef PLAT_arm64_linux
#undef PLAT_s390x_linux
#undef PLAT_mips32_linux
+#undef PLAT_tilegx_linux
#if defined(__APPLE__) && defined(__i386__)
# define PLAT_x86_darwin 1
@@ -37,6 +38,8 @@
# define PLAT_s390x_linux 1
#elif defined(__linux__) && defined(__mips__)
# define PLAT_mips32_linux 1
+#elif defined(__linux__) && defined(__tilegx__)
+# define PLAT_tilegx_linux 1
#endif
#if defined(PLAT_amd64_linux) || defined(PLAT_x86_linux) \
@@ -103,6 +106,12 @@
: /*out*/ : /*in*/ "r"(&(_lval)) \
: /*trash*/ "$8", "$9", "$10", "cc", "memory" \
)
+#elif defined(PLAT_tilegx_linux)
+# define INC(_lval,_lqual) \
+ if (sizeof(_lval) == 4) \
+ __insn_fetchadd(&(_lval), 1); \
+ else if(sizeof(_lval) == 8) \
+ __insn_fetchadd(&(_lval), 1)
#else
# error "Fix Me for this platform"
#endif
diff --git a/helgrind/tests/tc08_hbl2.c b/helgrind/tests/tc08_hbl2.c
index 2b720a8f6..dde93e8a1 100644
--- a/helgrind/tests/tc08_hbl2.c
+++ b/helgrind/tests/tc08_hbl2.c
@@ -33,6 +33,7 @@
#undef PLAT_s390x_linux
#undef PLAT_mips32_linux
#undef PLAT_mips64_linux
+#undef PLAT_tilegx_linux
#if defined(__APPLE__) && defined(__i386__)
# define PLAT_x86_darwin 1
@@ -58,6 +59,8 @@
#else
# define PLAT_mips32_linux 1
#endif
+#elif defined(__linux__) && defined(__tilegx__)
+# define PLAT_tilegx_linux 1
#endif
@@ -123,6 +126,12 @@
: /*out*/ : /*in*/ "r"(&(_lval)) \
: /*trash*/ "t0", "t1", "memory" \
)
+#elif defined(PLAT_tilegx_linux)
+# define INC(_lval,_lqual) \
+ if (sizeof(_lval) == 4) \
+ __insn_fetchadd(&(_lval), 1); \
+ else if(sizeof(_lval) == 8) \
+ __insn_fetchadd(&(_lval), 1)
#else
# error "Fix Me for this platform"
#endif
diff --git a/helgrind/tests/tc11_XCHG.c b/helgrind/tests/tc11_XCHG.c
index 50e285309..481f91639 100644
--- a/helgrind/tests/tc11_XCHG.c
+++ b/helgrind/tests/tc11_XCHG.c
@@ -18,6 +18,7 @@
#undef PLAT_arm_linux
#undef PLAT_s390x_linux
#undef PLAT_mips32_linux
+#undef PLAT_tilegx_linux
#if defined(__APPLE__) && defined(__i386__)
# define PLAT_x86_darwin 1
@@ -39,6 +40,8 @@
# define PLAT_s390x_linux 1
#elif defined(__linux__) && defined(__mips__)
# define PLAT_mips32_linux 1
+#elif defined(__linux__) && defined(__tilegx__)
+# define PLAT_tilegx_linux 1
#endif
@@ -115,6 +118,12 @@
# define XCHG_M_R_with_redundant_LOCK(_addr,_lval) \
XCHG_M_R(_addr,_lval)
+#elif defined(PLAT_tilegx_linux)
+# define XCHG_M_R(_addr,_lval) \
+ _lval = __insn_exch4(&_addr, _lval)
+
+# define XCHG_M_R_with_redundant_LOCK(_addr,_lval) \
+ XCHG_M_R(_addr, _lval)
#else
# error "Unsupported architecture"