1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-05-03 05:20:16 +02:00
Commit graph

162 commits

Author SHA1 Message Date
pcpa
adc854f1a7 Correct regressions with --with-float={soft,softfp} in the arm backend
* lib/jit_arm.c: Correct use of wrong argument offset
	variable in armv7l or float/double argument for varargs
	function in armv7hl.
	  Correct jit_getarg* logic in software float mode to
	match expected behavior in other backends, that is, if
	a function is not called, it is safe to use a few lightning
	calls before a next jit_getarg* call, as done in the test
	case check/stack.tst. The proper solution should be to
	extend the parser in lib/lightning.c to check if there is
	some float operation that will call some (libgcc?) function,
	but software float arm should be a very uncommon backend for
	lightning, so, just load the already in place arguments
	saved to stack, assuming the register argument was clobbered
	(what should not be the case most times...).
2012-12-22 16:28:02 -02:00
pcpa
59255a493c Add new register clobber detection test case.
* check/clobber.ok, check/clobber.tst: New test case doing
	extensive validation tests to ensure registers not used in
	a operation are not clobbered.

	* check/Makefile.am: Update for new test case.
2012-12-22 12:15:03 -02:00
pcpa
38770ecbaa Correct bogus logic caused by wrong optimizations.
* lib/lightning.c: Partially rewrite/revert code to compute
	initial	register live state at the start of a basic block.
	The original logic was corrupted when adding optimizations
	to do as few computations as possible in jit_update. The
	reglive field must be always a known set of live registers
	at the start of a basic block. The value that was incorrect
	was the regmask field, that must be the set of registers
	that are in unknown state, because they are not known live,
	neither set (or possibly not set) in the basic block, and
	*must* store the state at the start of the basic block.
2012-12-21 21:00:32 -02:00
pcpa
2751320022 Correct stack.tst test case on ppc. Now all tests pass in all backends.
* include/lightning/jit_ppc.h: Correct mismatch of JIT_F{1,5}
	with enum codes, that were correct, and returned by jit_f().

	* lib/jit_ppc-cpu.c, lib/jit_ppc-fpu.c, lib/jit_ppc.c: Properly
	implement and better describe values when generating stack
	frames.
2012-12-20 14:34:28 -02:00
pcpa
a74318a1d7 Add new test case to check stack integrity on complex stack frames.
* check/stack.ok, check/stack.tst: New files to test data
	integrity on a deep chain of stack frames.

	* lib/jit_arm.c, lib/jit_arm-cpu.c, lib/jit_mips.c,
	lib/jit_mips-cpu.c, lib/jit_ppc.c, lib/jit_ppc-cpu.c,
	lib/jit_x86.c, lib/jit_x86-cpu.c: Calculate _jit->function->stack
	in the emit stage, otherwise it will calculate it wrong if
	need to jit_allocai space to spill registers.

	* lib/lightning.c: Correct wrong offset when updating the
	"current" jit function pointer in the code that may need to
	allocate stack space to spill registers.

	* check/lightning.c: Correct off by one data space check.

	* check/Makefile.am: Update for new test case.
2012-12-19 18:07:12 -02:00
pcpa
b43ea1f908 Add two extra test cases for float operations.
* check/fop_abs.ok, check/fop_abs.tst, check/fop_sqrt.ok,
	check/fop_sqrt.tst: New files implementing simple test cases
	for the extra float operations.

	* check/Makefile.am: Update for new test cases.

	* check/alu.inc: Add an extra macro to check for unordered
	equality on tests where it is expected to use NaN as an
	argument.

	* check/lightning.c: Minor change for proper/common argument
	syntax handling ommiting arguments to options.
2012-12-17 17:55:38 -02:00
pcpa
d7389bffa3 Simplify listing of test cases with alternate jit generation options
* check/Makefile.am: Automatically generate pattern list
	of tests with alternate jit generation options. This should
	prevent typos and needing to change multiple places after
	a change.
2012-12-17 11:23:39 -02:00
pcpa
d05538bff6 Add support to test different/alternate code generation setups.
* check/lightning.c: Remove the ".cpu name value" syntax,
	as it was not able to do proper changes before the jit
	internal data structure was initialized. Now it supports
	several getopt options to force using different jit
	generation options, effectively replacing the previous
	syntax.

	* check/run-test: Add simple extra logic to handle differently
	named test scripts, used to test things like x87 coprocessor
	in ix86, and arm instruction set or software float in armv7l.

	* configure.ac: Add some AC_RUN_IFELSE calls to figure at
	compile time if can test different code generation options,
	and update Makefile generation accordingly.

	* check/Makefile.am, lib/jit_arm.c, lib/jit_x86.c: Update to
	properly work with the test tool updating the jit_cpu global
	information.

	* check/check.arm.sh, check/check.swf.sh, check/check.x87.sh:
	New wrapper files passing -mthumb=0, mvfp=0 and -mx87=1 to
	the test tool, if applicable, so that it can validate alternate
	code generation options on test hosts that support them.
2012-12-14 22:40:08 -02:00
pcpa
0e83b52d49 Correct test cases to work with x87 in ix86.
* lib/jit_x86-x87.c, lib/jit_x86.c: Correct test cases in ix86
	when using the x87 coprocessor instead of sse2+.
2012-12-14 17:39:29 -02:00
pcpa
03559bb8cc Make it clear stdarg like abstraction is not supported.
* include/lightning.h, include/lightning/jit_private.h,
	lib/jit_arm.c, lib/jit_mips.c, lib/jit_ppc.c, lib/jit_x86.c,
	lib/lightning.c: Make jit_ellipsis implementation not
	backend specific. It is not intended to handle va_list
	like objects at runtime, as jit_arg* and jit_getarg*
	return constant values resolved at parse time, so, effectively
	it is not possible to create printf like jit functions, as
	there is no va_start, va_arg, va_end, etc, abstraction. This
	limitation should be kept for the sake of making new ports
	easier.
2012-12-14 15:21:39 -02:00
pcpa
074056499f Remove most type casts and compile test tool silently with -Wall 2012-12-14 14:15:25 -02:00
pcpa
6227bf5bf9 Add new varargs test and correct related test case failures in all ports. 2012-12-13 18:26:57 -02:00
pcpa
0b89a17ca2 Add jit_ellipis and remove jit_prepare argument.
* include/lightning.h, lib/jit_arm.c, lib/jit_mips.c,
	lib/jit_ppc.c, lib/jit_x86.c, lib/lightning.c: Change jit_prepare
	to no longer receive an argument. If receiving an argument, it
	should be an ABI specifier, not a boolean if varargs or not,
	and add the new jit_ellipsis call, to specify where the
	ellipsis is in the C prototype of the function being called.
	Note that currently it is not supported to define varargs
	functions and it will be ignored if calling jit_ellipsis not
	in a prepare/finish* block, but this should be addressed.

	* check/allocai.tst, check/alu_add.tst, check/alu_and.tst,
	check/alu_com.tst, check/alu_div.tst, check/alu_lsh.tst,
	check/alu_mul.tst, check/alu_neg.tst, check/alu_or.tst,
	check/alu_rem.tst, check/alu_rsh.tst, check/alu_sub.tst,
	check/alu_xor.tst, check/alux_add.tst, check/alux_sub.tst,
	check/bp.tst, check/branch.tst, check/cvt.tst, check/divi.tst,
	check/fib.tst, check/ldsti.tst, check/ldstr-c.tst,
	check/ldstr.tst, check/ldstxi-c.tst, check/ldstxi.tst,
	check/ldstxr-c.tst, check/ldstxr.tst, check/rpn.tst,
	check/lightning.c: Update for the change to jit_prepare and
	addition of jit_ellipsis.
2012-12-12 22:59:52 -02:00
pcpa
a04df966c0 Make all current test cases pass in Darwin PowerPC.
* lib/jit_ppc-cpu.c: Make movr a function that checks arguments
	so that other code can safely assume it is a noop if src and dst
	are the same register.
	  Implement rem{r,i}{,_u} as a div{,u}/mul/sub.
	  Correct ANDIS, ORIS and XORIS calls to cast the argument to
	unsigned before the shift to avoid an assertion if the argument
	had the topmost bit set.
	  Implement lshi, rshi and rshi_u as functions to test for a
	zero argument, that would otherwise trigger an assertion when
	computing the shift value.
	  Do a simple implementation of bm{s,c}{r,i} with a temporary,
	"andr" of arguments and jump based on comparison with zero.
	  Correct typo in ldxi_c.

	* lib/jit_ppc-fpu.c: Correct wrong arguments to FDIV* and STF*.

	* lib/jit_ppc.c: Correct wrong check for 6 instead of 8 integer
	arguments in registers. If calling a varargs function and
	passing a float or double argument, also either store the
	value in the stack or in integer registers, as varargs functions
	do not fetch it from float registers.
	  Add "case" for new functions and incorrectly missing ones.
	  Call libgcc's __clear_cache, that should know what to do
	if the hardware needs flushing cache before execution.

	* lib/lightning.c: Do a simple/trivial logic in jit_regset_scan1,
	that should make it easier for the compiler to optimize it, and
	that also corrects the previously wrong code for big endian, and
	that was causing problems in ppc due to not saving all callee save
	registers as it was not "finding" them in the regset due to the
	little endian assumption bug.
2012-12-11 13:14:09 -02:00
pcpa
7e3d863767 Add better ppc support code, but still not functional.
* configure.ac: Only default to using the builtin disassembler
	if on GNU/Linux. This should be temporary, due to requiring
	/proc/self/exe.
	  Correctly check $target_cpu for powerpc.

	* include/lightning/jit_ppc.h: Correctly implement jit_v_num.

	* include/lightning/jit_private.h: Declare proper prototype
	for jit_init_debug and jit_finish_debug.

	* lib/jit_ppc-cpu.c: Remove code to save/restore callee save
	float registers, as it is not required since those float
	registers are not usable currently.
	  Change prolog and epilog generation to, at least comparing
	code, match what gcc generates in "gcc -O0", but it is still
	failing in Darwin PPC, apparently due to the __clear_cache
	call not being enough, as frequently it will also fail to
	execute, and the code buffer is all zeroes.

	* lib/lightning.c: Do not fail in jit_regset_scan1 calls due
	to passing 64 as argument on computers with 64 registers.
2012-12-11 02:16:51 -02:00
pcpa
a3fbc5da96 Correct test cases in the mips backend.
* lib/jit_mips-cpu.c: Correct all current test cases.
	  Call the "xori" not the "XORI" macro for jit_xori implementation,
	as the XORI macro handles only 16 bit unsigned values.
	  Call the "movr" macro, not the "movi" macro in the special
	case of adding or subtracting zero.
	  Use the proper temporary register in the jit_andr implementation.
2012-12-10 21:14:50 -02:00
pcpa
e255b76068 Add several arithmetic and branch tests cases.
* check/alu.inc, check/alu_add.ok, check/alu_add.tst,
	check/alu_and.ok, check/alu_and.tst, check/alu_com.ok,
	check/alu_com.tst, check/alu_div.ok, check/alu_div.tst,
	check/alu_lsh.ok, check/alu_lsh.tst, check/alu_mul.ok,
	check/alu_mul.tst, check/alu_neg.ok, check/alu_neg.tst,
	check/alu_or.ok, check/alu_or.tst, check/alu_rem.ok,
	check/alu_rem.tst, check/alu_rsh.ok, check/alu_rsh.tst,
	check/alu_sub.ok, check/alu_sub.tst, check/alu_xor.ok,
	check/alu_xor.tst, check/alux_add.ok, check/alux_add.tst,
	check/alux_sub.ok, check/alux_sub.tst, check/branch.ok,
	check/branch.tst: New test cases for arithmetic and branch
	tests.

	* check/Makefile.am: Update for new test cases.

	* include/lightning/jit_private.h: Make the jit_reg_free_p
	macro shared by all backends. Previously was added for the
	arm backend, but is useful in the x86_64 backend when checking
	state of "special purpose register".
	Also add the new jit_class_named register class, that must be
	or'ed with the register value if calling jit_get_reg expecting
	an specific value, because the specific register value may be
	zero, that previously was treated as no register requested.

	* lib/jit_arm-cpu.c: Correct argument order for T2_MVN.

	* lib/jit_arm-swf.c: Call the proper function for double
	divide. The "software float" implementation just calls
	libgcc functions.

	* lib/jit_arm.c: Return float/double values in the float
	register if using the hard float ABI.

	* lib/jit_x86-cpu.c: Change the can_sign_extend_int_p macro
	to not include -0x80000000L, because there is code that
	"abuses" it and thinks it can negate the immediate value
	after calling that macro.
	  Correct implementation of jit_subi that had a wrong code
	patch logic doing subtraction with reversed arguments.
	  Correct REX prefix calculation in the jit_muli implementation.
	  Correct logic to get/unget %*ax and %*dx registers in divremr
	and divremi.
	  Correct divremi that was using the symbolic, unique %*ax
	value in on place (not using the _REGNO name suffix).
	  Correct cut&paste error causing it to use "xor" instead of
	"or" in one code path of the jit_ori implementation.
	  Correct several flaws when clobbering registers and/or when
	one of the arguments was %*cx in the rotshr wrapper function
	implementing most shift operations.

	* lib/lightning.c: No longer expect that the backend be smart
	enough to know what to do when asking for a named register
	if that register is already an argument or is live. It fails
	if it is an argument, or if register is live, fails if cannot
	spill.
	  No longer incorrectly assume that eqr_{f,d} and ltgr_{f,d} are
	safe to inverse value tests in jump thread optimization.
2012-12-09 19:13:33 -02:00
pcpa
d1c0bc8e98 Add new test case for int/float to/from conversion.
* check/Makefile.am, check/cvt.ok, check/cvt.tst: Add new
	"cvt" test case to test conversion from/to int/float types.

	* check/lightning.c: Only define truncr_{f,d}_l in 64 bit mode.

	* include/lightning.h: Correct typo that caused it to define
	jit_truncr_{f,d}_l in 32 bit mode.

	* lib/jit_arm-cpu.c: Avoid assertion failure in the signed/unsigned
	extend opcodes generation as it shares an interface for 3 argument
	opcode generation.

	* lib/jit_x86-cpu.c: Correct wrong argument passed to
	jit_unget_reg in the andi implementation and wrong byte
	unsigned extend code generation.

	* lib/jit_x86-sse.c: Correct conversion from "word" to float or
	double as is dependent on wordsize.
2012-12-06 15:16:23 -02:00
pcpa
e7e55966cb Add new ldst variant test cases to check base/index register clobber.
* check/ldstr-c.ok, check/ldstr-c.tst, check/ldstxi-c.ok,
	check/ldstxi-c.tst, check/ldstxr-c.ok, check/ldstxr-c.tst:
	New test case files testing load clobbering the base and/or
	index register;

	* check/ldst.inc: New file with common definition for all the
	ldst* test cases.

	check/Makefile.am, check/ldsti.tst, check/ldstr.tst,
	check/ldstxi.tst, check/ldstxr.tst: Update for new common
	definitions file and new register clobber ldst tests.
2012-12-06 10:00:30 -02:00
pcpa
ee0fab1dae Correct testcases in the mips backend.
* lib/jit_mips-fpu.c: Correct wrong register order in stxr_{f,d}
	in the mips backend.
2012-12-06 07:47:42 -02:00
pcpa
66cb4452d7 Make current test cases pass in armv7l.
* lib/jit_arm-vfp.c: Correct regression found in armv7l with
	latest test cases.
2012-12-05 23:48:40 -02:00
pcpa
91244b1801 Correct test cases in i586 build.
* check/ldstxi.tst, check/ldstxr.tst: Correct wrong argument
	order for 32 bit mode tests.

	* configure.ac: Correct check for ix86 target_cpu.
2012-12-05 22:40:02 -02:00
pcpa
f59fceb75d Add new test cases to exercise memory load/store.
* check/ldstr.ok, check/ldstr.tst, check/ldsti.ok,
	check/ldsti.tst, check/ldstxr.ok, check/ldstxr.tst,
	check/ldstxi.ok, check/ldstxi.tst:
	New test case files exercising a very large amount of
	register combinations to verify load/store implementation.

	* check/Makefile.am: Update for new test cases.

	* lib/jit_x86-cpu.c: Correct wrong argument order when
	computing REX prefix for {ld,st}r_T codes;
2012-12-05 15:57:33 -02:00
pcpa
aa7c8230c1 Implement sqrt codes in mips.
* lib/jit_mips-fpu.c, lib/jit_mips.c: Implement missing mips
	jit_sqrtr_{f,d} codes.

	* check/all.tst, include/lightning.h, lib/jit_print.c: Change
	declaration order and call order in all.tst of {add,sub}c and
	{add,sub}x. *c must be called before to set the carry and *x
	second to use the carry and keep it set. The wrong call order
	was causing all.tst to fail in mips, where a register is
	allocated to keep a global carry state.
2012-12-04 13:30:46 -02:00
pcpa
760fab8d37 Correct mips backend implementation to pass initial tests.
* include/lightning/jit_mips.h, lib/jit_mips-cpu.c,
	lib/jit_mips-fpu.c, lib/jit_mips.c: Correct float/double
	argument handling and make the mips backend pass the initial
	test cases.

	* include/lightning.h, ib/jit_print.c, lib/lightning.c:
	Add extra enum values for argument handling functions that
	could not be abstracted to the current codes, that is, when
	float values need to move from/to gpr from/to fpr. It would
	be more tempting to add such primitives, but they would have
	wordsize limitations, and it is not expected to add codes
	with one gpr argument for 64 bit and two for 32 bit.

	* lib/jit_ppc.c: Check _jit->function before calling jit_epilog()
	to avoid a runtime exception.
2012-12-04 12:39:10 -02:00
pcpa
01be83d480 Make mips backend compile on a qemu image.
* include/lightning/jit_mips.h, lib/jit_mips.c: Update to
	make the mips backend compile in a qemu image.

	* lib/jit_ppc.c: Minor adaptations to help in having the
	ppc backend compilable.
2012-12-04 00:27:44 -02:00
pcpa
1c9088beca Update code to build and pass test cases in the arm port.
* configure.ac, include/lightning/jit_private.h, lib/jit_arm-cpu.c,
	lib/jit_arm-swf.c, lib/jit_arm.c, check/Makefile.am: Correct
	implementation of the arm backend port to build and pass the
	current test cases. Tested on armv7 with softfp abi.

	* lib/jit_disasm.c: Rename and change prototype of static
	disassemble function as in the arm backend it is required
	to access state information stored in the jit_state_t object.

	* check/3to2.tst, check/add.tst: Correct test case code assuming
	JIT_RO and JIT_RET are the same, and even if they are the same,
	the logic was incorrect because it must always call jit_retval*
	to fetch a function call return before any other instruction.
	The arm backend hash a special condition if jit_retval is not
	called, because "r0" is not JIT_R0, but is JIT_RET and *also*
	the first argument for a called function, so JIT_RET must be
	only used as an argument to jit_retval.

	* TODO: New file listing important tasks to be resolved.
2012-12-03 14:27:27 -02:00
pcpa
712877a5a4 Correct implementation problems on ix86.
* check/all.tst, check/lightning.c: Only declare or use 64 bit
	interfaces on 64 bit builds.

	* check/fib.tst: Use simpler logic to not need preprocessor
	conditionals for 32 or 64 bit.

	* include/lightning.h: Only declare 64 bit macros on a 64 bit
	build. Code using lightning must know about wordsize and the
	jit generation limitations, also, this way it generates a
	compile time failure, not a runtime assertion.

	* include/lightning/jit_x86.h: Correct typo in macro name.

	* lib/jit_arm.c, lib/jit_arm-cpu.c, lib/jit_mips.c,
	lib/jit_mips-cpu.c, lib/jit_ppc.c, lib/jit_ppc-cpu.c,
	lib/jit_x86.c, lib/jit_x86-cpu.c: Correct wrong code to get
	current jit function pointer.

	* lib/lightning.c: Move call to the simplify() optimization
	to after register liveness is known. Previous code did work
	by accident but now with proper test cases the problem was
	noticed.

	* lib/jit_disasm.c: Always cast bfd_vma to long long when
	passing it as printf argument.
2012-12-03 09:40:08 -02:00
pcpa
e6f1df7124 Correct make distcheck.
2012-12-03 Paulo Andrade <pcpa@gnu.org>

	* configure.ac, check/Makefile.am, check/check.sh,
	doc/Makefile.am, include/lightning/Makefile.am,
	lib/Makefile.am: Correct make distcheck.
2012-12-03 07:26:40 -02:00
pcpa
90a187a12e Correct integer multiplication and add extra test case.
* lib/jit_ppc.c: Assign copyright ownership to FSF.

	* lib/jit_x86-cpu.c: Correct integer multiplication that was
	generating code with reversed register arguments.

	* check/rpn.ok, check/rpn.tst: New test case file.
2012-12-03 00:07:29 -02:00
pcpa
b7c8db4ba4 Add extra files implementing different jit backends.
2012-12-02 Paulo Andrade <pcpa@gnu.org>

	* lib/jit_x86-cpu.c, lib/jit_x86-sse.c, lib/jit_x86-x87.c:
	Actually change copyright owner to FSF as avertised.

	*  lib/jit_arm-cpu.c,  lib/jit_arm-swf.c,
	lib/jit_arm-vfp.c, lib/jit_arm.c,
	lib/jit_mips-cpu.c, lib/jit_mips-fpu.c, lib/jit_mips.c,
	lib/jit_ppc-cpu.c, lib/jit_ppc-fpu.c, lib/jit_ppc.c: New
	files implementing initial code different jit backends.

	* include/lightning/jit_private.h: Add extra field to the
	private jit_patch_t type, required by the arm port.

	* lib/Makefile.am: Update for the new backend implementation
	files.
2012-12-02 22:58:40 -02:00
pcpa
51b2cee78e Add proper make clean rule to the check subdir.
2012-12-02 Paulo Andrade <pcpa@gnu.org>

        * check/Makefile.am: Add proper "make clean" rule and missing
        check.sh to EXTRA_DIST.
2012-12-02 20:24:24 -02:00
pcpa
22cc2ad62c Add make rule to build test case dependencies.
* .gitignore: Update pattern of ignored files.

	* check/Makefile.am: Add rule to build liblightning.la dependency
	in case of running "make check" before building the library.
2012-12-02 20:15:57 -02:00
pcpa
cb6a2c51f0 Remove previous macro files as they are no longer used.
* lightning/Makefile.am, lightning/asm-common.h,
	lightning/core-common.h, lightning/fp-common.h,
	lightning/funcs-common.h, lightning/i386/Makefile.frag,
	lightning/i386/asm-32.h, lightning/i386/asm-64.h,
	lightning/i386/asm.h, lightning/i386/core-32.h,
	lightning/i386/core-64.h, lightning/i386/core.h,
	lightning/i386/fp-32.h, lightning/i386/fp-64.h,
	lightning/i386/fp.h, lightning/i386/funcs.h,
	lightning/ppc/asm.h, lightning/ppc/core.h,
	lightning/ppc/fp.h, lightning/ppc/funcs.h,
	lightning/sparc/asm.h, lightning/sparc/core.h,
	lightning/sparc/fp.h, lightning/sparc/funcs.h:
	Removed. The core logic is used in the new code, and new mips
	and arm ports will be added. At first, sparc will not be
	supported as it has not yet been ported to the new engine.
2012-12-02 20:03:12 -02:00
pcpa
7a1c455237 Big merge with new lightning semantics aiming for lightning 2.0.
2012-12-02 Paulo Andrade <pcpa@gnu.org>

	* tests/Makefile.am, tests/3to2.c, tests/3to2.ok, tests/add.c,
	tests/add.ok, tests/allocai.c, tests/allocai.ok, tests/bp.c,
	tests/bp.ok, tests/divi.c, tests/divi.ok, tests/fib.c, tests/fib.ok,
	tests/fibdelay.c, tests/fibdelay.ok, tests/fibit.c, tests/fibit.ok,
	tests/funcfp.c, tests/funcfp.ok, tests/incr.c, tests/incr.ok,
	tests/ldst.c, tests/ldst.ok, tests/ldxi.c, tests/ldxi.ok,
	tests/modi.c, tests/modi.ok, tests/movi.c, tests/movi.ok,
	tests/printf.c, tests/printf.ok, tests/printf2.c, tests/printf2.ok,
	tests/ret.c, tests/ret.ok, tests/rpn.c, tests/rpn.ok, tests/rpnfp.c,
	tests/rpnfp.ok, tests/sete.c, tests/sete.ok, tests/testfp.c,
	tests/testfp.ok, tests-run-test: Removed previous test suite, in
	favor of a newer one in the check subdirectory.

	* check/3to2.ok, check/3to2.tst, check/add.ok, check/add.tst,
	check/allocai.ok, check/allocai.tst, check/bp.ok, check/bp.tst,
	check/divi.ok, check/divi.tst, check/fib.ok, check/fib.tst:
	New sample input for the new test program, loosely matching
	several of the previous test cases.

	* check/Makefile.am: New test suite makefile.

	* check/check.sh, check/run-test: New wrapper files for the
	new test suite.

	* check/lightning.c: New file. The main driver of the new test
	suite, that compiles to a parser of a very simple assembly like
	language, generates jit and executes it.

	* check/all.tst: New file. A generic debug and sample test file
	with a directive to prevent it from being executed, and useful to
	read disassembly of all possible instructions, using a fixed set
	of registers.

	* include/Makefile.am, include/lightning.h,
	include/lightning/Makefile.am, include/lightning/jit_arm.h,
	include/lightning/jit_mips.h, include/lightning/jit_ppc.h,
	include/lightning/jit_private.h, include/lightning/jit_x86.h,
	lib/Makefile.am, lib/jit_disasm.c, lib/jit_print.c,
	lib/jit_x86-cpu.c, lib/jit_x86-sse.c, lib/jit_x86-x87.c,
	lib/jit_x86.c, lib/lightning.c: New files. These files are
	written from scratch, only by <pcpa@gnu.org>, and have now
	copyright assignment to the FSF. This is the core of the new
	lightning rework. Previously it was integrated in code with
	a garbage collector and several custom types like vectors and
	hash tables, so this first code merge with lightning converts
	that code into a library extracting only the jit bits, and at
	first only for x86_64 GNU/Linux.

	* lightning.h, m4/lightning.m4: Removed. These are no longer
	required in the new lightning code.

	.gitignore, Makefile.am, configure.ac: Update for the new
	lightning code.
2012-12-02 19:44:36 -02:00
pcpa
75d99beb21 Extra cleanup before update to new codebase.
2012-12-02 Paulo Andrade <pcpa@gnu.org>
	* .cvsignore: Removed for extra cleanup.

	* build-aux: Rename directory to m4.

	* m4: Renamed to "default" name and for consistency with merge
	with code rework to be imported in lightning.

	* .gitignore, configure.ac, Makefile.am, doc/Makefile.am:
	Update for build-aux to m4 rename.
2012-12-02 19:08:34 -02:00
pcpa
7d3321d696 Cleanup on preparation for lightning rework.
2012-12-01 Paulo Andrade <pcpa@gnu.org>

	* opcode/Makefile.am, opcode/Makefile.in, opcode/ansidecl.h,
	opcode/bfd.h, opcode/dis-asm.h, opcode/dis-buf.c, opcode/disass.c,
	opcode/i386-dis.c, opcode/i386.h, opcode/ppc-dis.c, opcode/ppc-opc.c,
	opcode/ppc.h, opcode/sparc-dis.c, opcode/sparc-opc.c, opcode/sparc.h,
	opcode/sysdep.h: Removed. Do not bundle GNU binutils files.

	* aclocal.m4, configure, Makefile.in, config.h.in, doc/Makefile.in,
	lightning/Makefile.in, tests/Makefile.in: Removed. Do not maintain
	autogenerated files that also generate too much diff noise when
	regenerated in git.

	* build-aux/help2man, build-aux/texinfo.tex, build-aux/texi2dvi:
	Removed. Buildenvironment must have an up to date version from
	upstream installed.

	* build-aux/config.guess, build-aux/config.sub, build-aux/depcomp,
	build-aux/install-sh build-aux/mdate-sh build-aux/missing: Removed.
	Do not maintain a copy of automake files in git. Release tarballs
	must use an up to date version.

	* lightningize.in, doc/lightningize.1: Removed. Do not encourage
	bundling lightning in other packages. It should use a system package
	or a proper thirdy part subdirectory.

	* INSTALL: Removed. Autoreconf removes it and creates a symlink
	when regenerating files, so, avoid conflicts in git and let
	automake create the symlink.

	* .gitignore: Add INSTALL and autogenerated files.

	* configure.ac, Makefile.am: Update for removal of opcode subdir,
	auto generated files and lightningize.

	* tests/Makefile.am, tests/3to2.c, tests/add.c, tests/bp.c,
	tests/fib.c, tests/fibdelay.c, tests/fibit.c, tests/funcfp.c,
	tests/incr.c, tests/printf.c, tests/rpn.c, tests/rpnfp.c,
	tests/sete.c, tests/testfp.c: Update for removal of opcode subdir.

	* doc/Makefile.am: Update for removal of lightningize.

	* configure.ac, lightning/ppc/funcs.h, lightning/sparc/funcs.h,
	lightning/i386/fp.h, lightning/i386/core.h, lightning/i386/asm.h,
	tests/3to2.c, tests/add.c, tests/bp.c, tests/fib.c, tests/fibdelay.c,
	tests/fibit.c, tests/funcfp.c, tests/incr.c, tests/printf.c,
	tests/rpn.c, tests/rpnfp.c, tests/sete.c, tests/testfp.c:
	Remove LIGHTNING_CROSS, it is half supported and incomplete.

	* tests/3to2.c, tests/funcfp.c, tests/rpnfp.c: Remove preprocessor
	check on JIT_FPR. If no hardware registers are available, the backend
	must provide an alternative for software float.

	* lightning/ppc/core.h, lightning/sparc/core.h, tests/Makefile.am:
	Remove JIT_NEED_PUSH_POP. It is absolutely not trivial to implement
	properly on some backends due to stack alignment constraints, and
	whenever it is required, using jit_allocai and using a properly
	aligned stack vector, or a heap buffer, is better.

	* tests/push-pop.c, tests/push-pop.ok: Removed due to
	JIT_NEED_PUSH_POP no longer available.
2012-12-01 17:52:59 -02:00
Paolo Bonzini
0469f165c2 fix multiplication on x86_64
2011-02-28  Paolo Bonzini  <bonzini@gnu.org>

	* lightning/i386/core-64.h: Add jit_add{c,x}{i,r}_l, jit_mulr_{l,ul}_,
	fix jit_mul{i,r}_{l,ul}.
2011-02-28 11:24:03 +01:00
PCPA
e98ff58a7e Also reset alloca_slack after jit_prolog in i386.
There is no guarantee of order of jit_function calls, so, it must
reset it for every function. This should correct possible issues in
OS/X, and will be required when i386 code is updated to use MMX/SSE*
registers, possibly as some kind of extended interface, and then,
would require 16 bytes aligned stack. This is already an issue if
calling C code that uses SSE, and currently requires "manually"
padding the stack by using jit_allocai.
2010-08-29 11:55:48 +02:00
PCPA
d2239c223a Revert change aliasing jit_movi_p to jit_movi_ul.
It cannot "optimize" to use 32 bits opcode or zero the register
because that would break jit_patch_movi.
2010-08-29 11:55:11 +02:00
PCPA
3749bc71d8 Correct ALU add and sub operations with 64 bit immediate operands.
The problems would also happen with 32 bit unsigned operands that would
happen to have the topmost bit set, so, now it only uses 32 bit immediates
when bit 31 is not set.
  This patch correct all the issues found by the test cases alu_add.tst and
alu_sub.tst in http://code.google.com/p/exl/source/browse/trunk/check/lightning
2010-08-29 11:55:11 +02:00
PCPA
7b330c81b9 Define some extra fp-common macros when sizeof(long) == sizeof(int). 2010-08-29 11:55:11 +02:00
PCPA
8665ce16da Change _ASM_SAFETY register width check to accept valid alternate values.
The checks were moved from i386/asm.h to i386/asm-{32,64}.h, as well
as some macros from core-{32,64}.h. Now it checks if the value is in the
range of a valid register, and in the proper register class, what should
prevent the common mistake of calling a jit*r_x macro passing an immediate
as argument.
  Now it pass lightning's make check in i386/x86_64, as well as all test
cases in http://code.google.com/p/exl/source/browse/trunk/check/lightning
when compiled with -D_ASM_SAFETY.
2010-08-29 11:55:11 +02:00
Paulo Cesar Pereira de Andrade
d4a2a1ba07 Correct branches and several ALU operations with 64 immediates
jit_bra_l had the logic reversed, and correcting that also corrected
jit_b{lt,le,eq,ge,gt,ne}i_l.
  TESTQir and _ALUQir were not properly working with 64 bit immediates,
that require using a temporary register (JIT_REXTMP) as there are no
related opcodes for 64 bit immediates. This corrected jit_bm{s,c}i_l and
jit_bo{add,sub}i_l.
  Now, the tests in
http://code.google.com/p/exl/source/browse/trunk/check/lightning/branch.tst
pass.
2010-08-29 11:55:11 +02:00
Paulo Cesar Pereira de Andrade
67e1051827 Account stack alignment on jit functions with odd number of arguments.
The x86_64 correction to keep stack aligned in jit_finish* was only
correct for functions being called, but did not correctly handle alignment
of stack arguments.
2010-08-25 20:50:41 -03:00
PCPA
fe9f114745 Implement x86_64 support for multiple integer and float arguments.
This changes the usage of some of the jit_local_state fields, and add
two extra ones. Since jit_arg_x now returns either a register offset or
an stack offset, it does not add _XMM0 to nextarg_putfp to distinguish
from stack offsets.
  The nextarg_puti field is used to known when run out of integer register
arguments, and should push arguments on the stack.
  The new framesize field is used to keep track of jit_arg_x offset on
the stack, when jit_arg_x runs out of registers.
  The argssize field is used in a slightly different way now, and is
used to keep track of number of stack slots used to pass arguments, and
nextarg_puti is used in its previous semantics, to also match nextarg_putfp
logic.
2010-08-25 07:02:52 -03:00
PCPA
d04cfb05ac Change jit_finish to work with varargs functions in x86_64.
It is required to set %al to 0-8 inclusive, telling the number of
xmm registers used to pass arguments.
  This also corrects the calculation of _jitl.nextarg_putfp, that
would be incorrect if calling a function with both, float and double
arguments.
2010-08-25 06:55:50 -03:00
PCPA
100fbd17fb Change JIT_FPR_NUM to 7 to prevent clobber of JIT_FPR(7)
Lightning provides at least 6 float registers, so, in this commit,
reduce from 8 to 7 so that code respecting JIT_FPR_NUM should be
safe again't use of JIT_FPTMP.
2010-08-25 06:47:42 -03:00
PCPA
ec36c13183 Change JIT_REXTMP to not clobber 6th argument.
To not clobber JIT_R2, JIT_REXTMP is defined to the callee save register
%r12, instead of the expected, scratch register %r11.
  To have JIT_V_NUM at least at 3, it now also uses %r14, but does not add
%r15, that could be JIT_V(4) to simplify logic of keeping stack 16 bytes
aligned.
2010-08-25 06:45:42 -03:00
Paulo Cesar Pereira de Andrade
3eb42b42b6 Change JIT_REXTMP, JIT_R, JIT_V to use 64-bit registers 2010-08-24 12:37:29 +02:00