mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-05-03 13:20:26 +02:00
cherrypick from ludovic courtes
2006-10-31 Paolo Bonzini <bonzini@gnu.org> Ludovic Courtes <ludo@chbouib.org> * tests/divi.c, tests/divi.ok, tests/movi.c, tests/movi.ok: New. * tests/ldxi.c: Ensure large pointer is generated. * tests/Makefile.am: Point to new tests. * lightning.h: Include funcs-common.h before funcs.h. * lightning/sparc/core.h: Fix bugs in modi/divi. Patches applied: * lcourtes@laas.fr--2005-libre/lightning--stable--1.2--patch-11 Fixed a typo in `lightning/sparc/core.h'. * lcourtes@laas.fr--2005-libre/lightning--stable--1.2--patch-12 SPARC: Fixed `jit_immsize' (untested!). * lcourtes@laas.fr--2005-libre/lightning--stable--1.2--patch-13 Added a `divi' test case (does not catch the bug fixed by the previous patch). * lcourtes@laas.fr--2005-libre/lightning--stable--1.2--patch-14 `divi' test case: Return non-zero on failure. * lcourtes@laas.fr--2005-libre/lightning--stable--1.2--patch-15 `ldxi.c' (test case): Make sure we use a large pointer operand. * lcourtes@laas.fr--2005-libre/lightning--stable--1.2--patch-16 Added a `movi' test case (for `jit_movi_p' with large operands). git-archimport-id: bonzini@gnu.org--2004b/lightning--stable--1.2--patch-31
This commit is contained in:
parent
1f7feaffe2
commit
147efb8d90
14 changed files with 221 additions and 35 deletions
|
@ -1,3 +1,12 @@
|
||||||
|
2006-10-31 Paolo Bonzini <bonzini@gnu.org>
|
||||||
|
Ludovic Courtes <ludo@chbouib.org>
|
||||||
|
|
||||||
|
* tests/divi.c, tests/divi.ok, tests/movi.c, tests/movi.ok: New.
|
||||||
|
* tests/ldxi.c: Ensure large pointer is generated.
|
||||||
|
* tests/Makefile.am: Point to new tests.
|
||||||
|
* lightning.h: Include funcs-common.h before funcs.h.
|
||||||
|
* lightning/sparc/core.h: Fix bugs in modi/divi.
|
||||||
|
|
||||||
2006-10-30 Paolo Bonzini <bonzini@gnu.org>
|
2006-10-30 Paolo Bonzini <bonzini@gnu.org>
|
||||||
|
|
||||||
* lightning/Makefile.am: Use "ln -sf".
|
* lightning/Makefile.am: Use "ln -sf".
|
||||||
|
|
|
@ -43,7 +43,7 @@ DIST_COMMON = README $(am__configure_deps) $(dist_aclocal_DATA) \
|
||||||
$(include_HEADERS) $(srcdir)/Makefile.am $(srcdir)/Makefile.in \
|
$(include_HEADERS) $(srcdir)/Makefile.am $(srcdir)/Makefile.in \
|
||||||
$(srcdir)/config.h.in $(srcdir)/lightningize.in \
|
$(srcdir)/config.h.in $(srcdir)/lightningize.in \
|
||||||
$(top_srcdir)/configure AUTHORS COPYING COPYING.DOC \
|
$(top_srcdir)/configure AUTHORS COPYING COPYING.DOC \
|
||||||
COPYING.LESSER ChangeLog INSTALL NEWS THANKS TODO \
|
COPYING.LESSER ChangeLog INSTALL NEWS THANKS \
|
||||||
build-aux/config.guess build-aux/config.sub build-aux/depcomp \
|
build-aux/config.guess build-aux/config.sub build-aux/depcomp \
|
||||||
build-aux/install-sh build-aux/mdate-sh build-aux/missing \
|
build-aux/install-sh build-aux/mdate-sh build-aux/missing \
|
||||||
build-aux/texinfo.tex
|
build-aux/texinfo.tex
|
||||||
|
|
7
THANKS
7
THANKS
|
@ -1,8 +1,9 @@
|
||||||
Thanks to all the following people for their help in
|
Thanks to all the following people for their help in
|
||||||
improving GNU lightning:
|
improving GNU lightning:
|
||||||
|
|
||||||
Tom Tromey <tromey@redhat.com>
|
|
||||||
Laurent Michel <ldm@thorgal.homelinux.org>
|
|
||||||
Eli Barzilay <eli@barzilay.org>
|
Eli Barzilay <eli@barzilay.org>
|
||||||
Jens Troeger <savage@light-speed.de>
|
Ludovic Courtes <ludo@chbouib.org>
|
||||||
|
Laurent Michel <ldm@thorgal.homelinux.org>
|
||||||
Basile Starynkevitch <basile@starynkevitch.net>
|
Basile Starynkevitch <basile@starynkevitch.net>
|
||||||
|
Jens Troeger <savage@light-speed.de>
|
||||||
|
Tom Tromey <tromey@redhat.com>
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
@set UPDATED 21 June 2005
|
@set UPDATED 25 October 2006
|
||||||
@set UPDATED-MONTH June 2005
|
@set UPDATED-MONTH October 2006
|
||||||
@set EDITION 1.2b
|
@set EDITION 1.2b
|
||||||
@set VERSION 1.2b
|
@set VERSION 1.2b
|
||||||
|
|
|
@ -46,8 +46,8 @@ extern "C" {
|
||||||
|
|
||||||
#include <lightning/core.h>
|
#include <lightning/core.h>
|
||||||
#include <lightning/core-common.h>
|
#include <lightning/core-common.h>
|
||||||
#include <lightning/funcs.h>
|
|
||||||
#include <lightning/funcs-common.h>
|
#include <lightning/funcs-common.h>
|
||||||
|
#include <lightning/funcs.h>
|
||||||
#include <lightning/fp.h>
|
#include <lightning/fp.h>
|
||||||
#include <lightning/fp-common.h>
|
#include <lightning/fp-common.h>
|
||||||
|
|
||||||
|
|
|
@ -46,9 +46,4 @@ jit_fail(const char *msg, const char *file, int line, const char *function)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#ifndef jit_start_pfx
|
|
||||||
#define jit_start_pfx() ( (jit_insn*)0x4)
|
|
||||||
#define jit_end_pfx() ( (jit_insn*)0x0)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif /* __lightning_funcs_common_h */
|
#endif /* __lightning_funcs_common_h */
|
||||||
|
|
|
@ -1,13 +1,13 @@
|
||||||
/******************************** -*- C -*- ****************************
|
/******************************** -*- C -*- ****************************
|
||||||
*
|
*
|
||||||
* Platform-independent layer (Sparc version)
|
* Platform-independent layer (SPARC version)
|
||||||
*
|
*
|
||||||
***********************************************************************/
|
***********************************************************************/
|
||||||
|
|
||||||
|
|
||||||
/***********************************************************************
|
/***********************************************************************
|
||||||
*
|
*
|
||||||
* Copyright 2000, 2001, 2002 Free Software Foundation, Inc.
|
* Copyright 2000, 2001, 2002, 2006 Free Software Foundation, Inc.
|
||||||
* Written by Paolo Bonzini.
|
* Written by Paolo Bonzini.
|
||||||
*
|
*
|
||||||
* This file is part of GNU lightning.
|
* This file is part of GNU lightning.
|
||||||
|
@ -98,17 +98,17 @@ struct jit_local_state {
|
||||||
jit_mul (JIT_BIG, JIT_BIG, s2), \
|
jit_mul (JIT_BIG, JIT_BIG, s2), \
|
||||||
jit_subr_i (d, s1, JIT_BIG))
|
jit_subr_i (d, s1, JIT_BIG))
|
||||||
|
|
||||||
#define jit_modi(jit_divi, jit_muli, jit_divr, jit_mulr, d, rs, is) \
|
#define jit_modi(jit_divi, jit_muli, jit_divr, jit_mulr, d, rs, is) \
|
||||||
(_siP(13,(imm)) \
|
(_siP(13,(is)) \
|
||||||
? (jit_divi (JIT_BIG, rs, is), \
|
? (jit_divi (JIT_BIG, rs, is), \
|
||||||
jit_muli (JIT_BIG, JIT_BIG, is), \
|
jit_muli (JIT_BIG, JIT_BIG, is), \
|
||||||
jit_subr_i (d, rs, JIT_BIG)) \
|
jit_subr_i (d, rs, JIT_BIG)) \
|
||||||
: (SETir ((is), JIT_BIG2), \
|
: (SETir ((is), JIT_BIG2), \
|
||||||
jit_modr (jit_divr, jit_mulr, d, rs, JIT_BIG2)))
|
jit_modr (jit_divr, jit_mulr, d, rs, JIT_BIG2)))
|
||||||
|
|
||||||
/* How many instruction are needed to put imm in a register. */
|
/* How many instruction are needed to put imm in a register. */
|
||||||
#define jit_immsize(imm) (!(imm) ? 0 : \
|
#define jit_immsize(imm) (!(imm) ? 0 : \
|
||||||
(!_siP((imm), 13) && ((imm) & 0x3ff) ? 2 : 1))
|
(!_siP(13,(imm)) && ((imm) & 0x3ff) ? 2 : 1))
|
||||||
|
|
||||||
|
|
||||||
/* branch instructions return the address of the *delay* instruction -- this
|
/* branch instructions return the address of the *delay* instruction -- this
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
AM_CPPFLAGS = -I$(top_builddir) -I$(top_srcdir) -I$(top_srcdir)/lightning/$(cpu)
|
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
|
check_PROGRAMS = fibit incr printf printf2 rpn fib fibdelay add bp testfp funcfp rpnfp modi ldxi divi movi
|
||||||
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
|
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
|
||||||
EXTRA_DIST = $(noinst_DATA) run-test
|
EXTRA_DIST = $(noinst_DATA) run-test
|
||||||
|
|
||||||
if DISASS
|
if DISASS
|
||||||
|
@ -9,6 +9,6 @@ LDADD = $(top_builddir)/opcode/libdisass.a
|
||||||
endif
|
endif
|
||||||
|
|
||||||
if REGRESSION_TESTING
|
if REGRESSION_TESTING
|
||||||
TESTS = fib fibit fibdelay incr printf printf2 rpn add bp testfp funcfp rpnfp modi ldxi
|
TESTS = fib fibit fibdelay incr printf printf2 rpn add bp testfp funcfp rpnfp modi ldxi divi movi
|
||||||
TESTS_ENVIRONMENT=$(srcdir)/run-test
|
TESTS_ENVIRONMENT=$(srcdir)/run-test
|
||||||
endif
|
endif
|
||||||
|
|
|
@ -40,7 +40,8 @@ target_triplet = @target@
|
||||||
check_PROGRAMS = fibit$(EXEEXT) incr$(EXEEXT) printf$(EXEEXT) \
|
check_PROGRAMS = fibit$(EXEEXT) incr$(EXEEXT) printf$(EXEEXT) \
|
||||||
printf2$(EXEEXT) rpn$(EXEEXT) fib$(EXEEXT) fibdelay$(EXEEXT) \
|
printf2$(EXEEXT) rpn$(EXEEXT) fib$(EXEEXT) fibdelay$(EXEEXT) \
|
||||||
add$(EXEEXT) bp$(EXEEXT) testfp$(EXEEXT) funcfp$(EXEEXT) \
|
add$(EXEEXT) bp$(EXEEXT) testfp$(EXEEXT) funcfp$(EXEEXT) \
|
||||||
rpnfp$(EXEEXT) modi$(EXEEXT) ldxi$(EXEEXT)
|
rpnfp$(EXEEXT) modi$(EXEEXT) ldxi$(EXEEXT) divi$(EXEEXT) \
|
||||||
|
movi$(EXEEXT)
|
||||||
subdir = tests
|
subdir = tests
|
||||||
DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
|
DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
|
||||||
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
|
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
|
||||||
|
@ -59,6 +60,10 @@ bp_SOURCES = bp.c
|
||||||
bp_OBJECTS = bp.$(OBJEXT)
|
bp_OBJECTS = bp.$(OBJEXT)
|
||||||
bp_LDADD = $(LDADD)
|
bp_LDADD = $(LDADD)
|
||||||
@DISASS_TRUE@bp_DEPENDENCIES = $(top_builddir)/opcode/libdisass.a
|
@DISASS_TRUE@bp_DEPENDENCIES = $(top_builddir)/opcode/libdisass.a
|
||||||
|
divi_SOURCES = divi.c
|
||||||
|
divi_OBJECTS = divi.$(OBJEXT)
|
||||||
|
divi_LDADD = $(LDADD)
|
||||||
|
@DISASS_TRUE@divi_DEPENDENCIES = $(top_builddir)/opcode/libdisass.a
|
||||||
fib_SOURCES = fib.c
|
fib_SOURCES = fib.c
|
||||||
fib_OBJECTS = fib.$(OBJEXT)
|
fib_OBJECTS = fib.$(OBJEXT)
|
||||||
fib_LDADD = $(LDADD)
|
fib_LDADD = $(LDADD)
|
||||||
|
@ -88,6 +93,10 @@ modi_SOURCES = modi.c
|
||||||
modi_OBJECTS = modi.$(OBJEXT)
|
modi_OBJECTS = modi.$(OBJEXT)
|
||||||
modi_LDADD = $(LDADD)
|
modi_LDADD = $(LDADD)
|
||||||
@DISASS_TRUE@modi_DEPENDENCIES = $(top_builddir)/opcode/libdisass.a
|
@DISASS_TRUE@modi_DEPENDENCIES = $(top_builddir)/opcode/libdisass.a
|
||||||
|
movi_SOURCES = movi.c
|
||||||
|
movi_OBJECTS = movi.$(OBJEXT)
|
||||||
|
movi_LDADD = $(LDADD)
|
||||||
|
@DISASS_TRUE@movi_DEPENDENCIES = $(top_builddir)/opcode/libdisass.a
|
||||||
printf_SOURCES = printf.c
|
printf_SOURCES = printf.c
|
||||||
printf_OBJECTS = printf.$(OBJEXT)
|
printf_OBJECTS = printf.$(OBJEXT)
|
||||||
printf_LDADD = $(LDADD)
|
printf_LDADD = $(LDADD)
|
||||||
|
@ -116,10 +125,11 @@ COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
|
||||||
$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
|
$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
|
||||||
CCLD = $(CC)
|
CCLD = $(CC)
|
||||||
LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
|
LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
|
||||||
SOURCES = add.c bp.c fib.c fibdelay.c fibit.c funcfp.c incr.c ldxi.c \
|
SOURCES = add.c bp.c divi.c fib.c fibdelay.c fibit.c funcfp.c incr.c \
|
||||||
modi.c printf.c printf2.c rpn.c rpnfp.c testfp.c
|
ldxi.c modi.c movi.c printf.c printf2.c rpn.c rpnfp.c testfp.c
|
||||||
DIST_SOURCES = add.c bp.c fib.c fibdelay.c fibit.c funcfp.c incr.c \
|
DIST_SOURCES = add.c bp.c divi.c fib.c fibdelay.c fibit.c funcfp.c \
|
||||||
ldxi.c modi.c printf.c printf2.c rpn.c rpnfp.c testfp.c
|
incr.c ldxi.c modi.c movi.c printf.c printf2.c rpn.c rpnfp.c \
|
||||||
|
testfp.c
|
||||||
DATA = $(noinst_DATA)
|
DATA = $(noinst_DATA)
|
||||||
ETAGS = etags
|
ETAGS = etags
|
||||||
CTAGS = ctags
|
CTAGS = ctags
|
||||||
|
@ -225,10 +235,10 @@ target_cpu = @target_cpu@
|
||||||
target_os = @target_os@
|
target_os = @target_os@
|
||||||
target_vendor = @target_vendor@
|
target_vendor = @target_vendor@
|
||||||
AM_CPPFLAGS = -I$(top_builddir) -I$(top_srcdir) -I$(top_srcdir)/lightning/$(cpu)
|
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
|
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
|
||||||
EXTRA_DIST = $(noinst_DATA) run-test
|
EXTRA_DIST = $(noinst_DATA) run-test
|
||||||
@DISASS_TRUE@LDADD = $(top_builddir)/opcode/libdisass.a
|
@DISASS_TRUE@LDADD = $(top_builddir)/opcode/libdisass.a
|
||||||
@REGRESSION_TESTING_TRUE@TESTS = fib fibit fibdelay incr printf printf2 rpn add bp testfp funcfp rpnfp modi ldxi
|
@REGRESSION_TESTING_TRUE@TESTS = fib fibit fibdelay incr printf printf2 rpn add bp testfp funcfp rpnfp modi ldxi divi movi
|
||||||
@REGRESSION_TESTING_TRUE@TESTS_ENVIRONMENT = $(srcdir)/run-test
|
@REGRESSION_TESTING_TRUE@TESTS_ENVIRONMENT = $(srcdir)/run-test
|
||||||
all: all-am
|
all: all-am
|
||||||
|
|
||||||
|
@ -272,6 +282,9 @@ add$(EXEEXT): $(add_OBJECTS) $(add_DEPENDENCIES)
|
||||||
bp$(EXEEXT): $(bp_OBJECTS) $(bp_DEPENDENCIES)
|
bp$(EXEEXT): $(bp_OBJECTS) $(bp_DEPENDENCIES)
|
||||||
@rm -f bp$(EXEEXT)
|
@rm -f bp$(EXEEXT)
|
||||||
$(LINK) $(bp_LDFLAGS) $(bp_OBJECTS) $(bp_LDADD) $(LIBS)
|
$(LINK) $(bp_LDFLAGS) $(bp_OBJECTS) $(bp_LDADD) $(LIBS)
|
||||||
|
divi$(EXEEXT): $(divi_OBJECTS) $(divi_DEPENDENCIES)
|
||||||
|
@rm -f divi$(EXEEXT)
|
||||||
|
$(LINK) $(divi_LDFLAGS) $(divi_OBJECTS) $(divi_LDADD) $(LIBS)
|
||||||
fib$(EXEEXT): $(fib_OBJECTS) $(fib_DEPENDENCIES)
|
fib$(EXEEXT): $(fib_OBJECTS) $(fib_DEPENDENCIES)
|
||||||
@rm -f fib$(EXEEXT)
|
@rm -f fib$(EXEEXT)
|
||||||
$(LINK) $(fib_LDFLAGS) $(fib_OBJECTS) $(fib_LDADD) $(LIBS)
|
$(LINK) $(fib_LDFLAGS) $(fib_OBJECTS) $(fib_LDADD) $(LIBS)
|
||||||
|
@ -293,6 +306,9 @@ ldxi$(EXEEXT): $(ldxi_OBJECTS) $(ldxi_DEPENDENCIES)
|
||||||
modi$(EXEEXT): $(modi_OBJECTS) $(modi_DEPENDENCIES)
|
modi$(EXEEXT): $(modi_OBJECTS) $(modi_DEPENDENCIES)
|
||||||
@rm -f modi$(EXEEXT)
|
@rm -f modi$(EXEEXT)
|
||||||
$(LINK) $(modi_LDFLAGS) $(modi_OBJECTS) $(modi_LDADD) $(LIBS)
|
$(LINK) $(modi_LDFLAGS) $(modi_OBJECTS) $(modi_LDADD) $(LIBS)
|
||||||
|
movi$(EXEEXT): $(movi_OBJECTS) $(movi_DEPENDENCIES)
|
||||||
|
@rm -f movi$(EXEEXT)
|
||||||
|
$(LINK) $(movi_LDFLAGS) $(movi_OBJECTS) $(movi_LDADD) $(LIBS)
|
||||||
printf$(EXEEXT): $(printf_OBJECTS) $(printf_DEPENDENCIES)
|
printf$(EXEEXT): $(printf_OBJECTS) $(printf_DEPENDENCIES)
|
||||||
@rm -f printf$(EXEEXT)
|
@rm -f printf$(EXEEXT)
|
||||||
$(LINK) $(printf_LDFLAGS) $(printf_OBJECTS) $(printf_LDADD) $(LIBS)
|
$(LINK) $(printf_LDFLAGS) $(printf_OBJECTS) $(printf_LDADD) $(LIBS)
|
||||||
|
@ -317,6 +333,7 @@ distclean-compile:
|
||||||
|
|
||||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/add.Po@am__quote@
|
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/add.Po@am__quote@
|
||||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/bp.Po@am__quote@
|
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/bp.Po@am__quote@
|
||||||
|
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/divi.Po@am__quote@
|
||||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fib.Po@am__quote@
|
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fib.Po@am__quote@
|
||||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fibdelay.Po@am__quote@
|
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fibdelay.Po@am__quote@
|
||||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fibit.Po@am__quote@
|
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fibit.Po@am__quote@
|
||||||
|
@ -324,6 +341,7 @@ distclean-compile:
|
||||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/incr.Po@am__quote@
|
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/incr.Po@am__quote@
|
||||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ldxi.Po@am__quote@
|
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ldxi.Po@am__quote@
|
||||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/modi.Po@am__quote@
|
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/modi.Po@am__quote@
|
||||||
|
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/movi.Po@am__quote@
|
||||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/printf.Po@am__quote@
|
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/printf.Po@am__quote@
|
||||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/printf2.Po@am__quote@
|
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/printf2.Po@am__quote@
|
||||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rpn.Po@am__quote@
|
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rpn.Po@am__quote@
|
||||||
|
|
84
tests/divi.c
Normal file
84
tests/divi.c
Normal file
|
@ -0,0 +1,84 @@
|
||||||
|
/******************************** -*- C -*- ****************************
|
||||||
|
*
|
||||||
|
* Test jit_divi_i
|
||||||
|
*
|
||||||
|
***********************************************************************/
|
||||||
|
|
||||||
|
|
||||||
|
/* Contributed by Ludovic Courtès. */
|
||||||
|
|
||||||
|
#ifdef HAVE_CONFIG_H
|
||||||
|
# include "config.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <string.h>
|
||||||
|
#include "lightning.h"
|
||||||
|
|
||||||
|
typedef int (* divider_t) (int);
|
||||||
|
|
||||||
|
static divider_t
|
||||||
|
generate_divider (int operand, unsigned int *size)
|
||||||
|
{
|
||||||
|
static char buffer[1024];
|
||||||
|
divider_t result;
|
||||||
|
int arg;
|
||||||
|
|
||||||
|
result = (divider_t)(jit_set_ip (buffer).iptr);
|
||||||
|
jit_leaf (1);
|
||||||
|
arg = jit_arg_i ();
|
||||||
|
jit_getarg_i (JIT_R1, arg);
|
||||||
|
|
||||||
|
jit_divi_i (JIT_R2, JIT_R1, operand);
|
||||||
|
jit_movr_i (JIT_RET, JIT_R2);
|
||||||
|
|
||||||
|
jit_ret ();
|
||||||
|
jit_flush_code (buffer, jit_get_ip ().ptr);
|
||||||
|
|
||||||
|
*size = (char *)jit_get_ip ().ptr - buffer;
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int
|
||||||
|
test_divider (int divisor, const int *operands, unsigned operand_count)
|
||||||
|
{
|
||||||
|
int failed = 0;
|
||||||
|
unsigned int op, size;
|
||||||
|
divider_t div = generate_divider (divisor, &size);
|
||||||
|
|
||||||
|
for (op = 0; op < operand_count; op++)
|
||||||
|
{
|
||||||
|
int result, expected;
|
||||||
|
|
||||||
|
result = div (operands[op]);
|
||||||
|
expected = operands[op] / divisor;
|
||||||
|
printf ("%i/%i = %i (expected %i)\n", operands[op], divisor,
|
||||||
|
result, expected);
|
||||||
|
|
||||||
|
if (result != expected)
|
||||||
|
failed = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
return (!failed);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
int
|
||||||
|
main (int argc, char *argv[])
|
||||||
|
{
|
||||||
|
static const int small_ops[] = { 40, 64, 80 };
|
||||||
|
static const int large_ops[] = { 98304, 65536, 163840 };
|
||||||
|
|
||||||
|
/* Test a small immediate operand. */
|
||||||
|
if (!test_divider (8, small_ops, sizeof (small_ops) / sizeof (int)))
|
||||||
|
return 1;
|
||||||
|
|
||||||
|
/* Test a large immediate operand (requires more instructions on RISC
|
||||||
|
processors). */
|
||||||
|
if (!test_divider (32768, large_ops, sizeof (large_ops) / sizeof (int)))
|
||||||
|
return 1;
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
6
tests/divi.ok
Normal file
6
tests/divi.ok
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
40/8 = 5 (expected 5)
|
||||||
|
64/8 = 8 (expected 8)
|
||||||
|
80/8 = 10 (expected 10)
|
||||||
|
98304/32768 = 3 (expected 3)
|
||||||
|
65536/32768 = 2 (expected 2)
|
||||||
|
163840/32768 = 5 (expected 5)
|
17
tests/ldxi.c
17
tests/ldxi.c
|
@ -20,7 +20,7 @@ typedef char (* loader_t) (int);
|
||||||
/* Check `ldxi' with a big operand (OPERAND is assumed to be ``big'', e.g.,
|
/* Check `ldxi' with a big operand (OPERAND is assumed to be ``big'', e.g.,
|
||||||
more than one octet-long on PowerPC). */
|
more than one octet-long on PowerPC). */
|
||||||
static loader_t
|
static loader_t
|
||||||
generate_ldxi_big_operand (void *operand)
|
generate_ldxi_big_operand (const void *operand)
|
||||||
{
|
{
|
||||||
static char buffer[1024];
|
static char buffer[1024];
|
||||||
loader_t result;
|
loader_t result;
|
||||||
|
@ -47,14 +47,23 @@ int
|
||||||
main (int argc, char *argv[])
|
main (int argc, char *argv[])
|
||||||
{
|
{
|
||||||
static const char the_array[] = "GNU Lightning";
|
static const char the_array[] = "GNU Lightning";
|
||||||
|
char the_on_stack_array[] = "GNU Lightning";
|
||||||
unsigned i;
|
unsigned i;
|
||||||
loader_t array_loader = generate_ldxi_big_operand ((void *)the_array);
|
loader_t array_loader;
|
||||||
|
const char *large_pointer;
|
||||||
|
|
||||||
|
if (the_array > the_on_stack_array)
|
||||||
|
large_pointer = the_array;
|
||||||
|
else
|
||||||
|
large_pointer = the_on_stack_array;
|
||||||
|
|
||||||
|
array_loader = generate_ldxi_big_operand (large_pointer);
|
||||||
|
|
||||||
for (i = 0; i < sizeof (the_array) - 1; i++)
|
for (i = 0; i < sizeof (the_array) - 1; i++)
|
||||||
{
|
{
|
||||||
printf ("array[%i] = %c, array_loader (%i) = %c\n",
|
printf ("array[%i] = %c, array_loader (%i) = %c\n",
|
||||||
i, the_array[i], i, array_loader (i));
|
i, large_pointer[i], i, array_loader (i));
|
||||||
if (the_array[i] != array_loader (i))
|
if (large_pointer[i] != array_loader (i))
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
63
tests/movi.c
Normal file
63
tests/movi.c
Normal file
|
@ -0,0 +1,63 @@
|
||||||
|
/******************************** -*- C -*- ****************************
|
||||||
|
*
|
||||||
|
* Test jit_movi_p
|
||||||
|
*
|
||||||
|
***********************************************************************/
|
||||||
|
|
||||||
|
|
||||||
|
/* Contributed by Ludovic Courtès. */
|
||||||
|
|
||||||
|
#ifdef HAVE_CONFIG_H
|
||||||
|
# include "config.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <string.h>
|
||||||
|
#include "lightning.h"
|
||||||
|
|
||||||
|
typedef void * (* mover_t) (void);
|
||||||
|
|
||||||
|
static mover_t
|
||||||
|
generate_movi (const void *operand)
|
||||||
|
{
|
||||||
|
static char buffer[1024];
|
||||||
|
mover_t result;
|
||||||
|
|
||||||
|
/* printf ("si?=%i ui?=%i\n", _siP (16, operand), _uiP (16, operand)); */
|
||||||
|
|
||||||
|
result = (mover_t)(jit_set_ip (buffer).iptr);
|
||||||
|
jit_leaf (1);
|
||||||
|
|
||||||
|
jit_movi_p (JIT_R0, operand);
|
||||||
|
jit_movr_p (JIT_RET, JIT_R0);
|
||||||
|
|
||||||
|
jit_ret ();
|
||||||
|
jit_flush_code (buffer, jit_get_ip ().ptr);
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int
|
||||||
|
main (int argc, char *argv[])
|
||||||
|
{
|
||||||
|
static const char the_array[] = "GNU Lightning";
|
||||||
|
mover_t get_array;
|
||||||
|
const void *large_pointer;
|
||||||
|
|
||||||
|
if (the_array > (char *)&get_array)
|
||||||
|
large_pointer = the_array;
|
||||||
|
else
|
||||||
|
large_pointer = &get_array;
|
||||||
|
|
||||||
|
/* On RISC machines, moving a large immediate may require several
|
||||||
|
instructions (e.g., `sethi' followed by `ori' on SPARC). */
|
||||||
|
get_array = generate_movi (large_pointer);
|
||||||
|
|
||||||
|
if (get_array () == large_pointer)
|
||||||
|
printf ("`jit_movi_p' succeeded\n");
|
||||||
|
else
|
||||||
|
printf ("`jit_movi_p' failed\n");
|
||||||
|
|
||||||
|
return (get_array () != large_pointer);
|
||||||
|
}
|
1
tests/movi.ok
Normal file
1
tests/movi.ok
Normal file
|
@ -0,0 +1 @@
|
||||||
|
`jit_movi_p' succeeded
|
Loading…
Add table
Add a link
Reference in a new issue