[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Guile-commits] 102/437: add ldst test
From: |
Andy Wingo |
Subject: |
[Guile-commits] 102/437: add ldst test |
Date: |
Mon, 2 Jul 2018 05:13:53 -0400 (EDT) |
wingo pushed a commit to branch lightning
in repository guile.
commit 5ea118e8a93fb8204a537bccd5e5a9f1b98128b0
Author: Paolo Bonzini <address@hidden>
Date: Wed Jul 28 23:28:30 2010 +0200
add ldst test
2010-07-28 Paolo Bonzini <address@hidden>
* tests/Makefile.am: Add ldst test.
* tests/Makefile.in: Regenerate.
* tests/ldst.c: New.
* tests/ldst.ok: New.
---
ChangeLog | 7 +++
tests/Makefile.am | 6 +--
tests/Makefile.in | 19 ++++++--
tests/ldst.c | 140 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
tests/ldst.ok | 0
5 files changed, 164 insertions(+), 8 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 9c7f4b9..550d75d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,12 @@
2010-07-28 Paolo Bonzini <address@hidden>
+ * tests/Makefile.am: Add ldst test.
+ * tests/Makefile.in: Regenerate.
+ * tests/ldst.c: New.
+ * tests/ldst.ok: New.
+
+2010-07-28 Paolo Bonzini <address@hidden>
+
* THANKS: Add Paulo Cesar Pereira de Andrade.
* doc/porting.texi: Fix ordering of arguments in jit_stxi.
* lightning/i386/core-32.h (jit_replace): Remove cmp argument.
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 0df0a03..1d27834 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -2,12 +2,12 @@ AM_CPPFLAGS = -I$(top_builddir) -I$(top_srcdir)
-I$(top_srcdir)/lightning/$(cpu)
check_PROGRAMS = fibit incr printf printf2 rpn fib fibdelay \
add bp testfp funcfp rpnfp modi ldxi divi movi ret \
- allocai push-pop sete 3to2
+ allocai push-pop sete 3to2 ldst
noinst_DATA = fibit.ok incr.ok printf.ok printf2.ok rpn.ok \
fib.ok fibdelay.ok testfp.ok funcfp.ok rpnfp.ok add.ok \
bp.ok modi.ok ldxi.ok divi.ok movi.ok ret.ok \
- allocai.ok push-pop.ok sete.ok 3to2.ok
+ allocai.ok push-pop.ok sete.ok 3to2.ok ldst.ok
EXTRA_DIST = $(noinst_DATA) run-test
@@ -18,7 +18,7 @@ endif
if REGRESSION_TESTING
TESTS = fib fibit fibdelay incr printf printf2 rpn add bp \
testfp funcfp rpnfp modi ldxi divi movi ret allocai \
- push-pop sete 3to2
+ push-pop sete 3to2 ldst
TESTS_ENVIRONMENT=$(srcdir)/run-test
endif
diff --git a/tests/Makefile.in b/tests/Makefile.in
index a1be53c..8918679 100644
--- a/tests/Makefile.in
+++ b/tests/Makefile.in
@@ -40,7 +40,7 @@ check_PROGRAMS = fibit$(EXEEXT) incr$(EXEEXT) printf$(EXEEXT)
\
add$(EXEEXT) bp$(EXEEXT) testfp$(EXEEXT) funcfp$(EXEEXT) \
rpnfp$(EXEEXT) modi$(EXEEXT) ldxi$(EXEEXT) divi$(EXEEXT) \
movi$(EXEEXT) ret$(EXEEXT) allocai$(EXEEXT) push-pop$(EXEEXT) \
- sete$(EXEEXT) 3to2$(EXEEXT)
+ sete$(EXEEXT) 3to2$(EXEEXT) ldst$(EXEEXT)
@address@hidden = fib$(EXEEXT) fibit$(EXEEXT) \
@REGRESSION_TESTING_TRUE@ fibdelay$(EXEEXT) incr$(EXEEXT) \
@REGRESSION_TESTING_TRUE@ printf$(EXEEXT) printf2$(EXEEXT) \
@@ -50,7 +50,8 @@ check_PROGRAMS = fibit$(EXEEXT) incr$(EXEEXT) printf$(EXEEXT)
\
@REGRESSION_TESTING_TRUE@ ldxi$(EXEEXT) divi$(EXEEXT) \
@REGRESSION_TESTING_TRUE@ movi$(EXEEXT) ret$(EXEEXT) \
@REGRESSION_TESTING_TRUE@ allocai$(EXEEXT) push-pop$(EXEEXT) \
address@hidden@ sete$(EXEEXT) 3to2$(EXEEXT)
address@hidden@ sete$(EXEEXT) 3to2$(EXEEXT) \
address@hidden@ ldst$(EXEEXT)
subdir = tests
DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
@@ -104,6 +105,10 @@ incr_SOURCES = incr.c
incr_OBJECTS = incr.$(OBJEXT)
incr_LDADD = $(LDADD)
@address@hidden = $(top_builddir)/opcode/libdisass.a
+ldst_SOURCES = ldst.c
+ldst_OBJECTS = ldst.$(OBJEXT)
+ldst_LDADD = $(LDADD)
address@hidden@ldst_DEPENDENCIES = $(top_builddir)/opcode/libdisass.a
ldxi_SOURCES = ldxi.c
ldxi_OBJECTS = ldxi.$(OBJEXT)
ldxi_LDADD = $(LDADD)
@@ -159,10 +164,10 @@ COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES)
$(AM_CPPFLAGS) \
CCLD = $(CC)
LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
SOURCES = 3to2.c add.c allocai.c bp.c divi.c fib.c fibdelay.c fibit.c \
- funcfp.c incr.c ldxi.c modi.c movi.c printf.c printf2.c \
+ funcfp.c incr.c ldst.c ldxi.c modi.c movi.c printf.c printf2.c \
push-pop.c ret.c rpn.c rpnfp.c sete.c testfp.c
DIST_SOURCES = 3to2.c add.c allocai.c bp.c divi.c fib.c fibdelay.c \
- fibit.c funcfp.c incr.c ldxi.c modi.c movi.c printf.c \
+ fibit.c funcfp.c incr.c ldst.c ldxi.c modi.c movi.c printf.c \
printf2.c push-pop.c ret.c rpn.c rpnfp.c sete.c testfp.c
DATA = $(noinst_DATA)
ETAGS = etags
@@ -276,7 +281,7 @@ AM_CPPFLAGS = -I$(top_builddir) -I$(top_srcdir)
-I$(top_srcdir)/lightning/$(cpu)
noinst_DATA = fibit.ok incr.ok printf.ok printf2.ok rpn.ok \
fib.ok fibdelay.ok testfp.ok funcfp.ok rpnfp.ok add.ok \
bp.ok modi.ok ldxi.ok divi.ok movi.ok ret.ok \
- allocai.ok push-pop.ok sete.ok 3to2.ok
+ allocai.ok push-pop.ok sete.ok 3to2.ok ldst.ok
EXTRA_DIST = $(noinst_DATA) run-test
@address@hidden = $(top_builddir)/opcode/libdisass.a
@@ -348,6 +353,9 @@ funcfp$(EXEEXT): $(funcfp_OBJECTS) $(funcfp_DEPENDENCIES)
incr$(EXEEXT): $(incr_OBJECTS) $(incr_DEPENDENCIES)
@rm -f incr$(EXEEXT)
$(LINK) $(incr_OBJECTS) $(incr_LDADD) $(LIBS)
+ldst$(EXEEXT): $(ldst_OBJECTS) $(ldst_DEPENDENCIES)
+ @rm -f ldst$(EXEEXT)
+ $(LINK) $(ldst_OBJECTS) $(ldst_LDADD) $(LIBS)
ldxi$(EXEEXT): $(ldxi_OBJECTS) $(ldxi_DEPENDENCIES)
@rm -f ldxi$(EXEEXT)
$(LINK) $(ldxi_OBJECTS) $(ldxi_LDADD) $(LIBS)
@@ -398,6 +406,7 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @address@hidden/$(DEPDIR)/address@hidden@
@AMDEP_TRUE@@am__include@ @address@hidden/$(DEPDIR)/address@hidden@
@AMDEP_TRUE@@am__include@ @address@hidden/$(DEPDIR)/address@hidden@
address@hidden@@am__include@ @address@hidden/$(DEPDIR)/address@hidden@
@AMDEP_TRUE@@am__include@ @address@hidden/$(DEPDIR)/address@hidden@
@AMDEP_TRUE@@am__include@ @address@hidden/$(DEPDIR)/address@hidden@
@AMDEP_TRUE@@am__include@ @address@hidden/$(DEPDIR)/address@hidden@
diff --git a/tests/ldst.c b/tests/ldst.c
new file mode 100644
index 0000000..3113102
--- /dev/null
+++ b/tests/ldst.c
@@ -0,0 +1,140 @@
+/* Written by Paulo Cesar Pereira de Andrade, address@hidden */
+
+#include <stdio.h>
+#include <stddef.h>
+#include <lightning.h>
+#include <sys/types.h>
+
+#define CHECK_FLOAT 1
+
+typedef struct types {
+ char c;
+ unsigned char uc;
+ short s;
+ unsigned short us;
+ int i;
+ unsigned int ui;
+ long l;
+ unsigned long ul;
+ float f;
+ double d;
+ void *p;
+} types_t;
+
+typedef void (*pvv_t)(void);
+
+pvv_t pvv;
+types_t t0, t1;
+jit_insn code[4096];
+
+#define warn(format, ...) \
+ fprintf(stderr, "%s:%d: " format "\n", __func__, (int) __LINE__
,#__VA_ARGS__)
+
+#if __WORDSIZE == 64
+# define LONG_VALUE 0x7fffffffffffffff
+#else
+# define LONG_VALUE 0x7fffffff
+#endif
+void
+check1(void)
+{
+ if (t0.c != t1.c) warn("0x%x 0x%x", t0.c, t1.c);
+ if (t0.uc != t1.uc) warn("0x%x 0x%x", t0.uc,
t1.uc);
+ if (t0.s != t1.s) warn("0x%x 0x%x", t0.s, t1.s);
+ if (t0.us != t1.us) warn("0x%x 0x%x", t0.us,
t1.us);
+ if (t0.i != t1.i) warn("0x%x 0x%x", t0.i, t1.i);
+ if (t0.ui != t1.ui) warn("0x%x 0x%x", t0.ui,
t1.ui);
+ if (t0.l != t1.l) warn("0x%lx 0x%lx", t0.l, t1.l);
+ if (t0.ul != t1.ul) warn("0x%lx 0x%lx", t0.ul,
t1.ul);
+#if CHECK_FLOAT
+ if (t0.f != t1.f) warn("%f %f", t0.f, t1.f);
+ if (t0.d != t1.d) warn("%f %f", t0.d, t1.d);
+#endif
+ if (t0.p != t1.p) warn("0x%p 0x%p", t0.p, t1.p);
+}
+check0(void)
+{
+ if (t0.c != 0x7f) warn("0x%x", t0.c);
+ if (t0.uc != 0x7f) warn("0x%x", t0.uc);
+ if (t0.s != 0x7fff) warn("0x%x", t0.s);
+ if (t0.us != 0x7fff) warn("0x%x", t0.us);
+ if (t0.i != 0x7fffffff) warn("0x%x", t0.i);
+ if (t0.ui != 0x7fffffff) warn("0x%x", t0.ui);
+ if (t0.l != LONG_VALUE) warn("0x%lx", t0.l);
+ if (t0.ul != LONG_VALUE) warn("0x%lx", t0.ul);
+#if CHECK_FLOAT
+ if (t0.f != 0.5f) warn("%f", t0.f);
+ if (t0.d != 1.5) warn("%f", t0.d);
+
+#endif
+ if (t0.p != (void*)0xdeadbeef) warn("0x%p", t0.p);
+}
+void
+test(V0, V1, R0, F0)
+{
+ jit_movi_p ( V0, &t0);
+ jit_movi_p ( V1, &t1);
+ jit_movi_i ( R0, 0x7f);
+ jit_stxi_c (offsetof(types_t, c), V0, R0);
+ jit_stxi_uc(offsetof(types_t, uc), V0, R0);
+ jit_movi_i ( R0, 0x7fff);
+ jit_stxi_s(offsetof(types_t, s), V0, R0);
+ jit_stxi_us(offsetof(types_t, us), V0, R0);
+ jit_movi_i ( R0, 0x7fffffff);
+ jit_stxi_i (offsetof(types_t, i), V0, R0);
+ jit_stxi_ui(offsetof(types_t, ui), V0, R0);
+ jit_movi_l ( R0, LONG_VALUE);
+ jit_stxi_l (offsetof(types_t, l), V0, R0);
+ jit_stxi_ul(offsetof(types_t, ul), V0, R0);
+#if CHECK_FLOAT
+ jit_movi_f ( F0, 0.5f);
+ jit_stxi_f (offsetof(types_t, f), V0, F0);
+ jit_movi_d ( F0, 1.5);
+ jit_stxi_d (offsetof(types_t, d), V0, F0);
+#endif
+ jit_movi_p ( R0, 0xdeadbeef);
+ jit_stxi_p (offsetof(types_t, p), V0, R0);
+ jit_calli (check0);
+
+ jit_ldxi_c ( R0, V0, offsetof(types_t, c));
+ jit_stxi_c (offsetof(types_t, c), V1, R0);
+ jit_ldxi_uc( R0, V0, offsetof(types_t, uc));
+ jit_stxi_uc(offsetof(types_t, uc), V1, R0);
+ jit_ldxi_s ( R0, V0, offsetof(types_t, s));
+ jit_stxi_s (offsetof(types_t, s), V1, R0);
+ jit_ldxi_us( R0, V0, offsetof(types_t, us));
+ jit_stxi_us(offsetof(types_t, us), V1, R0);
+ jit_ldxi_i ( R0, V0, offsetof(types_t, i));
+ jit_stxi_i (offsetof(types_t, i), V1, R0);
+ jit_ldxi_ui( R0, V0, offsetof(types_t, ui));
+ jit_stxi_ui(offsetof(types_t, ui), V1, R0);
+ jit_ldxi_l ( R0, V0, offsetof(types_t, l));
+ jit_stxi_l (offsetof(types_t, l), V1, R0);
+ jit_ldxi_ul( R0, V0, offsetof(types_t, ul));
+ jit_stxi_ul(offsetof(types_t, ul), V1, R0);
+#if CHECK_FLOAT
+ jit_ldxi_f ( F0, V0, offsetof(types_t, f));
+ jit_stxi_f (offsetof(types_t, f), V1, F0);
+ jit_ldxi_d ( F0, V0, offsetof(types_t, d));
+ jit_stxi_d (offsetof(types_t, d), V1, F0);
+#endif
+ jit_ldxi_p ( R0, V0, offsetof(types_t, p));
+ jit_stxi_p (offsetof(types_t, p), V1, R0);
+ jit_calli (check1);
+}
+
+int
+main(int argc, char *argv[])
+{
+ jit_set_ip(code);
+ jit_prolog(0);
+ test(JIT_V0, JIT_V1, JIT_R0, JIT_FPR0);
+ jit_ret();
+
+ jit_flush_code(code, jit_get_ip().ptr);
+
+ pvv = (pvv_t)code;
+ (*pvv)();
+
+ return (0);
+}
diff --git a/tests/ldst.ok b/tests/ldst.ok
new file mode 100644
index 0000000..e69de29
- [Guile-commits] 44/437: merge some bugfixes, give right meaning to jit_retval_[fd], (continued)
- [Guile-commits] 44/437: merge some bugfixes, give right meaning to jit_retval_[fd], Andy Wingo, 2018/07/02
- [Guile-commits] 106/437: ldst test update, Andy Wingo, 2018/07/02
- [Guile-commits] 114/437: Change JIT_REXTMP to not clobber 6th argument., Andy Wingo, 2018/07/02
- [Guile-commits] 88/437: move JIT_R1/JIT_R2 to R10/R11 for the x86_64 backend, Andy Wingo, 2018/07/02
- [Guile-commits] 133/437: Correct integer multiplication and add extra test case., Andy Wingo, 2018/07/02
- [Guile-commits] 116/437: Change jit_finish to work with varargs functions in x86_64., Andy Wingo, 2018/07/02
- [Guile-commits] 85/437: add (void) casts for C++ compatibility, Andy Wingo, 2018/07/02
- [Guile-commits] 127/437: Extra cleanup before update to new codebase., Andy Wingo, 2018/07/02
- [Guile-commits] 130/437: Add make rule to build test case dependencies., Andy Wingo, 2018/07/02
- [Guile-commits] 125/437: fix multiplication on x86_64, Andy Wingo, 2018/07/02
- [Guile-commits] 102/437: add ldst test,
Andy Wingo <=
- [Guile-commits] 131/437: Add proper make clean rule to the check subdir., Andy Wingo, 2018/07/02
- [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