summaryrefslogtreecommitdiff
path: root/mach_dep.c
diff options
context:
space:
mode:
authorIlya Kurdyukov <ilyakurdyukov@altlinux.org>2022-01-13 10:01:13 +0300
committerIvan Maidanski <ivmai@mail.ru>2022-01-13 10:04:20 +0300
commit2cc754be36bd2560a3e6f468f5039cf00e4230d1 (patch)
tree30cec886c4590e7e05d322f7036e84d13cb6ce38 /mach_dep.c
parent8c549d3d80f4c80c0bdf411c6c6f121226bffb4b (diff)
downloadbdwgc-2cc754be36bd2560a3e6f468f5039cf00e4230d1.tar.gz
Fix stb asm instruction placement in E2K get_stack_index
(fix of commit 9ddbbae8e) Issue #411 (bdwgc). The stb and rbranch instructions in get_stack_index() must be packed into the same VLIW command (because MLOCK must be activated by stb from the same VLIW command; "rbranch X" is short for "ibranch X? %%MLOCK"). * mach_dep.c [E2K] (VLIW_CMD_BRACES_PREFIX): Define macro; undefine it near undef of get_stack_index. * mach_dep.c [E2K] (get_stack_index): Group stb and rbranch into one VLIW command; prefix "{" and "}" with VLIW_CMD_BRACES_PREFIX (to workaround asm code generation issue in clang-9); remove FIXME.
Diffstat (limited to 'mach_dep.c')
-rw-r--r--mach_dep.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/mach_dep.c b/mach_dep.c
index abefbc2c..6a4db79a 100644
--- a/mach_dep.c
+++ b/mach_dep.c
@@ -35,6 +35,12 @@
# define VA_SIZE 48
# define E2K_PSHTP_SIZE 12
+# if defined(__clang__)
+# define VLIW_CMD_BRACES_PREFIX "%" /* a workaround for clang-9 */
+# else
+# define VLIW_CMD_BRACES_PREFIX /* empty */
+# endif
+
# define get_stack_index(ps_ptr) \
do { \
word psp_lo, psp_hi; \
@@ -47,9 +53,10 @@
"rrd %%pshtp, %1\n\t" \
"rrd %%psp.lo, %2\n\t" \
"rrd %%psp.hi, %3\n\t" \
- /* FIXME: start next VLIW command */ \
- "stb %4, 0, %0, mas = 2\n\t" \
- "rbranch 1b\n" \
+ VLIW_CMD_BRACES_PREFIX "{\n\t" \
+ " stb %4, 0, %0, mas = 2\n\t" \
+ " rbranch 1b\n\t" \
+ VLIW_CMD_BRACES_PREFIX "}" \
: "=&r" (val), "=&r" (pshtp), \
"=&r" (psp_lo), "=&r" (psp_hi) \
: "r" (&tmp)); \
@@ -103,6 +110,7 @@
return NULL;
}
+# undef VLIW_CMD_BRACES_PREFIX
# undef get_stack_index
#endif /* E2K */