[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Guile-commits] 165/437: Add simple test case to test argument and retur
From: |
Andy Wingo |
Subject: |
[Guile-commits] 165/437: Add simple test case to test argument and return values. |
Date: |
Mon, 2 Jul 2018 05:14:10 -0400 (EDT) |
wingo pushed a commit to branch lightning
in repository guile.
commit 3ee09ecc64ad49986260d9165011528e66503a82
Author: pcpa <address@hidden>
Date: Sun Dec 23 20:28:05 2012 -0200
Add simple test case to test argument and return values.
* check/call.ok, check/call.tst: New test cases to validate
simple typed argument and return values in function calls.
* check/lightning.c: Properly handle jit_movi of labels for
backward and forward code labels.
* check/Makefile.am: Update for new test case.
---
ChangeLog | 10 +++
check/Makefile.am | 3 +-
check/call.ok | 4 +
check/call.tst | 262 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
check/lightning.c | 5 +-
5 files changed, 282 insertions(+), 2 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index ccc1c37..5ab7d7c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,15 @@
2012-12-23 Paulo Andrade <address@hidden>
+ * check/call.ok, check/call.tst: New test cases to validate
+ simple typed argument and return values in function calls.
+
+ * check/lightning.c: Properly handle jit_movi of labels for
+ backward and forward code labels.
+
+ * check/Makefile.am: Update for new test case.
+
+2012-12-23 Paulo Andrade <address@hidden>
+
* check/carry.ok, check/carry.tst: New test case to validate
carry condition handling.
diff --git a/check/Makefile.am b/check/Makefile.am
index c632939..c1eaf6a 100644
--- a/check/Makefile.am
+++ b/check/Makefile.am
@@ -63,6 +63,7 @@ EXTRA_DIST = \
stack.tst stack.ok \
clobber.tst clobber.ok \
carry.tst carry.ok \
+ call.tst call.ok \
check.sh \
check.x87.sh \
check.arm.sh check.swf.sh \
@@ -83,7 +84,7 @@ base_TESTS = \
alu_com alu_neg \
fop_abs fop_sqrt \
varargs stack \
- clobber carry
+ clobber carry call
$(base_TESTS): check.sh
$(LN_S) $(srcdir)/check.sh $@
diff --git a/check/call.ok b/check/call.ok
new file mode 100644
index 0000000..cc119df
--- /dev/null
+++ b/check/call.ok
@@ -0,0 +1,4 @@
+forward
+backward
+forward
+backward
diff --git a/check/call.tst b/check/call.tst
new file mode 100644
index 0000000..50fcc05
--- /dev/null
+++ b/check/call.tst
@@ -0,0 +1,262 @@
+#define def_wi(i) \
+_w##i: \
+ prolog \
+ arg $arg##i \
+ getarg##i %r0 $arg##i \
+ retr %r0 \
+ epilog
+#define def_wf(f) \
+_w##f: \
+ prolog \
+ arg##f $arg##f \
+ getarg##f %f0 $arg##f \
+ truncr##f %r0 %f0 \
+ retr %r0 \
+ epilog
+#define def_fi(f, i) \
+f##i: \
+ prolog \
+ arg $arg##i \
+ getarg##i %r0 $arg##i \
+ extr##f %f0 %r0 \
+ retr##f %f0 \
+ epilog
+#define def_f(f) \
+f##f: \
+ prolog \
+ arg##f $arg##f \
+ getarg##f %f0 $arg##f \
+ retr##f %f0 \
+ epilog
+#define def_ff(f, g) \
+f##g: \
+ prolog \
+ arg##g $arg##g \
+ getarg##g %f0 $arg##g \
+ extr##g##f %f0 %f0 \
+ retr##f %f0 \
+ epilog
+
+.data 32
+fstr:
+.c "forward"
+bstr:
+.c "backward"
+
+.code
+ jmpi main
+
+ def_wi(_c)
+ def_wi(_uc)
+ def_wi(_s)
+ def_wi(_us)
+#if __WORDSIZE == 64
+ def_wi(_i)
+ def_wi(_ui)
+#endif
+ def_wf(_f)
+ def_wf(_d)
+ def_fi(_f, _c)
+ def_fi(_f, _uc)
+ def_fi(_f, _s)
+ def_fi(_f, _us)
+ def_fi(_f, _i)
+#if __WORDSIZE == 64
+ def_fi(_f, _ui)
+ def_fi(_f, _l)
+#endif
+ def_fi(_d, _c)
+ def_fi(_d, _uc)
+ def_fi(_d, _s)
+ def_fi(_d, _us)
+ def_fi(_d, _i)
+#if __WORDSIZE == 64
+ def_fi(_d, _ui)
+ def_fi(_d, _l)
+#endif
+ def_f(_f)
+ def_f(_d)
+ def_ff(_f, _d)
+ def_ff(_d, _f)
+
+main:
+ prolog
+
+#define _call_w(n, i, a, r) \
+ prepare \
+ pushargi a \
+ finishi _w##i \
+ retval %r0 \
+ extr##i %r0 %r0 \
+ beqi _w##i##_##n %r0 r \
+ calli @abort \
+_w##i##_##n:
+#define call_w(n, i, a, r) _call_w(n, i, a, r)
+#define _call_wf(n, f, a, r) \
+ prepare \
+ pushargi##f a \
+ finishi _w##f \
+ retval %r0 \
+ extr##f %f0 %r0 \
+ beqi##f _w##f##_##n %f0 r \
+ calli @abort \
+_w##f##_##n:
+#define call_wf(n, f, a, r) _call_wf(n, f, a, r)
+#define _call_fi(n, f, i, a, r) \
+ prepare \
+ pushargi a \
+ finishi f##i \
+ retval##f %f0 \
+ beqi##f f##i##n %f0 r \
+ calli @abort \
+f##i##n:
+#define call_fi(n, f, i, a, r) _call_fi(n, f, i, a, r)
+#define _call_f(n, f, a, r) \
+ prepare \
+ pushargi##f a \
+ finishi f##f \
+ retval##f %f0 \
+ beqi##f f##f##n %f0 r \
+ calli @abort \
+f##f##n:
+#define call_f(n, f, a, r) _call_f(n, f, a, r)
+#define _call_ff(n, f, g, a, r) \
+ prepare \
+ pushargi##g a \
+ finishi f##g \
+ retval##f %f0 \
+ beqi##f f##g##n %f0 r \
+ calli @abort \
+f##g##n:
+#define call_ff(n, f, g, a, r) _call_ff(n, f, g, a, r)
+
+#define c7f 0x7f
+#define c80 0x80
+#define c81 0x81
+#define cff 0xff
+#define s7f 0x7fff
+#define s80 0x8000
+#define s81 0x8001
+#define i7f 0x7fffffff
+#define i80 0x80000000
+#define i81 0x80000001
+#define iff 0xffffffff
+#define l7f 0x7fffffffffffffff
+#define l80 0x8000000000000000
+#define l81 0x8000000000000001
+#define f7f 127.0
+#define f80 -128.0
+#define f81 -127.0
+#define uf80 128.0
+#define uf81 127.0
+#if __WORDSIZE == 32
+# define wc80 0xffffff80
+# define wc81 0xffffff81
+# define ws80 0xffff8000
+# define ws81 0xffff8001
+#else
+# define wc80 0xffffffffffffff80
+# define wc81 0xffffffffffffff81
+# define ws80 0xffffffffffff8000
+# define ws81 0xffffffffffff8001
+# define wi80 0xffffffff80000000
+# define wi81 0xffffffff80000001
+#endif
+
+ call_w(__LINE__, _c, c7f, c7f)
+ call_w(__LINE__, _c, c80, wc80)
+ call_w(__LINE__, _c, c81, wc81)
+ call_w(__LINE__, _uc, c7f, c7f)
+ call_w(__LINE__, _uc, c80, c80)
+ call_w(__LINE__, _uc, c81, c81)
+ call_w(__LINE__, _s, s7f, s7f)
+ call_w(__LINE__, _s, s80, ws80)
+ call_w(__LINE__, _s, s81, ws81)
+ call_w(__LINE__, _us, s7f, s7f)
+ call_w(__LINE__, _us, s80, s80)
+ call_w(__LINE__, _us, s81, s81)
+#if __WORDSIZE == 64
+ call_w(__LINE__, _i, i7f, i7f)
+ call_w(__LINE__, _i, i80, wi80)
+ call_w(__LINE__, _i, i81, wi81)
+ call_w(__LINE__, _ui, i7f, i7f)
+ call_w(__LINE__, _ui, i80, i80)
+ call_w(__LINE__, _ui, i81, i81)
+#endif
+ call_wf(__LINE__, _f, c7f, f7f)
+ call_wf(__LINE__, _f, wc80, f80)
+ call_wf(__LINE__, _f, wc81, f81)
+ call_wf(__LINE__, _d, c7f, f7f)
+ call_wf(__LINE__, _d, wc80, f80)
+ call_wf(__LINE__, _d, wc81, f81)
+ call_fi(__LINE__, _f, _c, c7f, f7f)
+ call_fi(__LINE__, _f, _c, c80, f80)
+ call_fi(__LINE__, _f, _uc, c7f, f7f)
+ call_fi(__LINE__, _f, _uc, c80, uf80)
+ call_fi(__LINE__, _f, _s, c7f, f7f)
+ call_fi(__LINE__, _f, _s, c80, uf80)
+ call_fi(__LINE__, _f, _us, c7f, f7f)
+ call_fi(__LINE__, _f, _us, c80, uf80)
+ call_fi(__LINE__, _f, _i, c7f, f7f)
+ call_fi(__LINE__, _f, _i, c80, uf80)
+#if __WORDSIZE == 64
+ call_fi(__LINE__, _f, _ui, c7f, f7f)
+ call_fi(__LINE__, _f, _ui, c80, uf80)
+ call_fi(__LINE__, _f, _l, c7f, f7f)
+ call_fi(__LINE__, _f, _l, c80, uf80)
+#endif
+ call_fi(__LINE__, _d, _c, c7f, f7f)
+ call_fi(__LINE__, _d, _c, c80, f80)
+ call_fi(__LINE__, _d, _uc, c7f, f7f)
+ call_fi(__LINE__, _d, _uc, c80, uf80)
+ call_fi(__LINE__, _d, _s, c7f, f7f)
+ call_fi(__LINE__, _d, _s, c80, uf80)
+ call_fi(__LINE__, _d, _us, c7f, f7f)
+ call_fi(__LINE__, _d, _us, c80, uf80)
+ call_fi(__LINE__, _d, _i, c7f, f7f)
+ call_fi(__LINE__, _d, _i, c80, uf80)
+#if __WORDSIZE == 64
+ call_fi(__LINE__, _d, _ui, c7f, f7f)
+ call_fi(__LINE__, _d, _ui, c80, uf80)
+ call_fi(__LINE__, _d, _l, c7f, f7f)
+ call_fi(__LINE__, _d, _l, c80, uf80)
+#endif
+ call_f(__LINE__, _f, f7f, f7f)
+ call_f(__LINE__, _d, f7f, f7f)
+ call_ff(__LINE__, _f, _d, f80, f80)
+ call_ff(__LINE__, _d, _f, f81, f81)
+
+ movi %r0 forward
+ callr %r0
+
+ calli iforward
+
+ ret
+ epilog
+
+backward:
+ prolog
+ prepare
+ pushargi bstr
+ finishi @puts
+ ret
+ epilog
+
+forward:
+ prolog
+ prepare
+ pushargi fstr
+ finishi @puts
+ movi %r0 backward
+ callr %r0
+ ret
+ epilog
+
+iforward:
+ prolog
+ prepare
+ pushargi fstr
+ finishi @puts
+ calli backward
+ ret
+ epilog
diff --git a/check/lightning.c b/check/lightning.c
index a336f94..665fcd1 100644
--- a/check/lightning.c
+++ b/check/lightning.c
@@ -1291,8 +1291,11 @@ movi(void)
default:
ungetch(ch);
label = get_label(skip_none);
- if (label->kind == label_kind_code_forward)
+ if (label->kind == label_kind_code ||
+ label->kind == label_kind_code_forward) {
mov_forward((void *)jit_movi(r0, 0), label);
+ return;
+ }
value = label->value;
break;
}
- [Guile-commits] 109/437: more fixes to fp branches, (continued)
- [Guile-commits] 109/437: more fixes to fp branches, Andy Wingo, 2018/07/02
- [Guile-commits] 136/437: Update code to build and pass test cases in the arm port., Andy Wingo, 2018/07/02
- [Guile-commits] 124/437: Also reset alloca_slack after jit_prolog in i386., Andy Wingo, 2018/07/02
- [Guile-commits] 154/437: Correct test cases to work with x87 in ix86., Andy Wingo, 2018/07/02
- [Guile-commits] 148/437: Add better ppc support code, but still not functional., Andy Wingo, 2018/07/02
- [Guile-commits] 153/437: Make it clear stdarg like abstraction is not supported., Andy Wingo, 2018/07/02
- [Guile-commits] 76/437: fix several load/store patterns for x86-64., Andy Wingo, 2018/07/02
- [Guile-commits] 81/437: fix stack alignment for Apple 32-bit ABI, Andy Wingo, 2018/07/02
- [Guile-commits] 98/437: always set and replace lightning_frag, Andy Wingo, 2018/07/02
- [Guile-commits] 166/437: Correct extra regressions found by the call.tst test case., Andy Wingo, 2018/07/02
- [Guile-commits] 165/437: Add simple test case to test argument and return values.,
Andy Wingo <=
- [Guile-commits] 158/437: Add new test case to check stack integrity on complex stack frames., Andy Wingo, 2018/07/02
- [Guile-commits] 150/437: Add jit_ellipis and remove jit_prepare argument., Andy Wingo, 2018/07/02
- [Guile-commits] 108/437: fix x86_64 jit_bner_{f,d}, Andy Wingo, 2018/07/02
- [Guile-commits] 122/437: Correct ALU add and sub operations with 64 bit immediate operands., Andy Wingo, 2018/07/02
- [Guile-commits] 119/437: Correct branches and several ALU operations with 64 immediates, Andy Wingo, 2018/07/02
- [Guile-commits] 135/437: Correct implementation problems on ix86., Andy Wingo, 2018/07/02
- [Guile-commits] 169/437: Correct wrong and confusing reverse float comparison logic, Andy Wingo, 2018/07/02
- [Guile-commits] 139/437: Implement sqrt codes in mips., Andy Wingo, 2018/07/02
- [Guile-commits] 134/437: Correct make distcheck., Andy Wingo, 2018/07/02
- [Guile-commits] 156/437: Simplify listing of test cases with alternate jit generation options, Andy Wingo, 2018/07/02