libretro: adjust psxclock description
[pcsx_rearmed.git] / deps / lightning / ChangeLog
1 2023-08-21 Paulo Andrade <pcpa@gnu.org>
2
3         * check/Makefile.am, check/lightning.c: Add new hmul tests.
4         * doc/body.texi: Document hmul.
5         * include/lightning.h.in: Create the new hmul codes.
6         * lib/jit_aarch64-cpu.c, lib/jit_aarch64-sz.c, lib/jit_aarch64.c,
7         lib/jit_alpha-cpu.c, lib/jit_alpha-sz.c, lib/jit_alpha.c,
8         lib/jit_arm-cpu.c, lib/jit_arm-sz.c, lib/jit_arm.c,
9         lib/jit_hppa-cpu.c, lib/jit_hppa-sz.c, lib/jit_hppa.c,
10         lib/jit_ia64-cpu.c, lib/jit_ia64-sz.c, lib/jit_ia64.c,
11         lib/jit_loongarch-cpu.c, lib/jit_loongarch-sz.c, lib/jit_loongarch.c,
12         lib/jit_mips-cpu.c, lib/jit_mips-sz.c, lib/jit_mips.c,
13         lib/jit_ppc-cpu.c, lib/jit_ppc-sz.c, lib/jit_ppc.c,
14         lib/jit_riscv-cpu.c, lib/jit_riscv-sz.c, lib/jit_riscv.c,
15         lib/jit_s390-cpu.c, lib/jit_s390-sz.c, lib/jit_s390.c,
16         lib/jit_sparc-cpu.c, lib/jit_sparc-sz.c, lib/jit_sparc.c,
17         lib/jit_x86-cpu.c, lib/jit_x86-sz.c, lib/jit_x86.c: Implement
18         hmul and update the *-sz.c files.
19         * lib/jit_names.c, lib/lightning.c: Add knowledge of hmul.
20
21 2023-04-18 Paulo Andrade <pcpa@gnu.org>
22
23         * include/lightning.h.in: Define new fmar_f, fmai_f, fmsr_f,
24         fmsi_f, fmar_d, fmai_d, fmsr_d and fmsi_d instructions, that
25         add support for fused multiply add/sub, in the format
26         r0 = r1 * r2 +/- r3.
27         * include/lightning/jit_private.h: Add helper macros for debug
28         output.
29         * lib/jit_names.c: Add strings for debug output.
30         * lib/jit_print.c: Print debug output for the new instructions.
31         * lib/lightning.c: Add logic for the new register pair in the
32         'v' (second) field of jit_node_t. The new pattern is required
33         to allow having a 'double' immediate in the last argument, for
34         the versions with immediates. The versions with immediates are
35         added for consistency, as they should be very rarely used in
36         common usage of fused multiply add/sub.
37
38 2023-04-06 Paulo Andrade <pcpa@gnu.org>
39
40         * include/lightning.h.in: Define new movi_w_f, movi_w_d and
41         movi_ww_d instructions, to have an inverse counterpart to
42         movi_f_w, movi_d_w and movi_d_ww.
43         * lib/lightning.c: Update for the new instructions.
44         * lib/jit_names.c, lib/jit_print.c: Update debug information.
45
46 2023-04-05 Paulo Andrade <pcpa@gnu.org>
47
48         * include/lightning.h.in: Define new unldr, unldi, unldr_x,
49         unldi_x, unstr, unsti, unldr_x and unstr_x instructions.
50         Remove comment about internal backend specific codes, as they
51         are required by unldr_x and unstr_x in some code paths.
52         * lib/lightning.c: Implement generic movi_f_w, movi_d_w and
53         movi_d_ww that are actually the same for all ports.
54         Define generic load/store implementations when unaligned memory
55         access does not trap.
56
57 2023-03-23 Paulo Andrade <pcpa@gnu.org>
58
59         * include/lightning.h.in: Define new qlshr, qlshi, qlshr_u,
60         qlshi_u, qrshr, qrshi, qrshr_u and qrshi_u instructions.
61         * lib/jit_fallback.c: Implement new fallbacks.
62         * lib/jit_names.c: Update debug information.
63         * lib/lightning.c: Add code to update regsets, matching other
64         instructions with two outputs.
65
66 2023-03-20 Paulo Andrade <pcpa@gnu.org>
67
68         * check/all.tst: Add missing instructions to debug encoding.
69         * check/lightning.c: Implement calls to the new rich set of
70         instructions, with an immediate argument, mostly which are resolved
71         at code generation time. With the exception of jit_negi_{f,d},
72         jit_absi{f,d} and jit_sqrti_{f,d} that generate code to execute at
73         runtime. This is required because the code generator should create
74         the proper float environment with rounding modes, exceptions, etc.
75         The new jit_depi is just a wrapper to have the second operand as an
76         immediate and call jit_depr.
77         * include/lightning.h.in: Declare new instructions code and function
78         prototypes as appropriate.
79         * include/lightning/jit_private.h: Add 4 new macros to generate
80         synthetic debug for float operations with an immediate argument.
81         * lib/jit_aarch64.c, lib/jit_alpha.c, lib/jit_arm.c, lib/jit_hppa.c,
82         lib/jit_ia64.c, lib/jit_loongarch.c, lib/jit_mips.c, lib/jit_ppc.c,
83         lib/jit_riscv.c, lib/jit_s390.c, lib/jit_sparc.c, lib/jit_x86.c:
84         Add code to call the generic code to implement new instructions
85         with immediate operands.
86         * lib/jit_names.c, lib/jit_print.c: Add debug for the new instructions
87         with immediate operands.
88         * lib/lightning.c: Add code to handle regsets and actually implement
89         the generic new instructions.
90
91 2023-03-17 Paulo Andrade <pcpa@gnu.org>
92
93         * lib/jit_fallback.c: Implement fallbacks for new instructions
94         ext, ext_u and dep.
95         * lib/lightning.c: Add code to understand the new instructions
96         and update regsets as appropriate.
97         * lib/jit_names.c, lib/jit_print.c: Update for debug information
98         of ext, ext_u and dep.
99         * include/lightning.h.in: Define jit_code_t for ext, ext_u and dep.
100         * check/lightning.c: Handle the new instructions.
101         * check/all.tst: Add new instructions for the full disassembly.
102
103 2023-03-07 Paulo Andrade <pcpa@gnu.org>
104
105         * check/alu_rot.tst, check/alu_rot.ok: New test files for the new
106         lrotr, lroti, rrotr and rroti instructions.
107         * check/Makefile.am, check/lightning.c, include/lightning.h.in,
108         lib/jit_names.c: lib/lightning.c, doc/body.texi: Update for the
109         new instructions.
110         * lib/jit_aarch64-cpu.c, lib/jit_aarch64.c, lib/jit_arm-cpu.c,
111         lib/jit_arm.c: Implement optimized rrotr and rroti. lrotr and
112         lroti just adjust parameters for a left shift rotate.
113         * lib/jit_alpha-cpu.c, lib/jit_alpha.c, lib/jit_ia64-cpu,
114         lib/jit_ia64.c, lib/jit_riscv-cpu.c, lib/jit_riscv.c,
115         jit_sparc-cpu.c, jit_sparc.c: Implement calls to fallback lrotr,
116         lroti, rrotr and rroti.
117         * lib/jit_hppa-cpu.c, lib/jit_hppa.c: Implement optimized rroti.
118         Other instructions use fallbacks.
119         * lib/jit_loongarch-cpu.c, lib/jit_loongarch.c: Implement optimized
120         rrotr and rroti. lrotr and lroti just adapt arguments and use a
121         right shift.
122         * lib/jit_mips-cpu.c, lib/jit_mips.c: If mips2, Implement optimized
123         rrotr and rroti. lrotr and lroti just adapt arguments and use a
124         right shift. If mips1 use fallbacks.
125         * lib/jit_ppc-cpu.c, lib/jit_ppc.c, jit_s390-cpu.c, jit_s390.c,
126         lib/jit_x86-cpu.c, lib/jit_x86.c: Implement optimized lrotr,
127         lroti, rrotr, rroti.
128         * lib/jit_fallback.c: Implement fallbacks for lrotr, lroti,
129         rrotr and rroti. Also add extra macro to avoid segfaults in s390,
130         that cannot use register zero for some addressing instructions.
131
132 2023-03-02 Paulo Andrade <pcpa@gnu.org>
133
134         * check/popcnt.tst, check/popcnt.ok: New test files for the new
135         popcntr instruction.
136         * check/Makefile.am, check/lightning.c, include/lightning.h.in,
137         lib/jit_names.c: lib/lightning.c, doc/body.texi: Update for popcntr.
138         * lib/jit_aarch64-fpu.c, lib/jit_aarch64.c: Implement optimized
139         popcntr using the fpu.
140         * lib/jit_alpha-cpu.c, lib/jit_alpha.c: Implement optimized
141         popcntr using the ctpop instruction.
142         * lib/jit_arm-vfp.c, lib/jit_arm-cpu.c, lib/jit_arm.c: Implement
143         untested optimized popcntr using vfp >= 4, otherwise use a
144         software fallback.
145         * lib/jit_ia64-cpu.c, lib/jit_jia64.c: Implement optimized
146         popcntr using the popcnt instruction.
147         * lib/jit_ppc-cpu.c, lib/jit_ppc.c: Implement optimized
148         popcntr using the popcntb, plus mullr and rshi_u instruction.
149         * lib/jit_x86-cpu.c, lib/jit_x86.c: Implement optimized
150         popcntr instruction using the popcnt instruction if available,
151         otherwise use an optimized fallback.
152         * lib/jit_fallback.c: Implement simple fallback popcnt.
153         * lib/jit_hppa.c, lib/jit_loongarch.c, lib/jit_mips.c,
154         lib/jit_riscv.c, lib/jit_s390.c, lib/jit_sparc.c: Use fallback
155         popcnt.
156
157 2023-02-26 Paulo Andrade <pcpa@gnu.org>
158
159         * check/bit.tst: Correct 32 bit sample ctz implementation.
160         * include/lightning/jit_mips.h: Add jit_cpu flags for instructions
161         that cannot be used in delay slot.
162         * lib/jit_fallback.c: Mips fallbacks now might need a flush of
163         instructions to get correct label addresses, due to pending
164         instruction candidate to delay slot.
165         * lib/jit_mips-cpu.c: Flush any pending instruction if it cannot
166         be used in the delay slot. Add calls to fallback clo, clz, cto and
167         ctz for mips 1.
168         * lib/jit_mips.c: Add code to set defaults or detect if can use
169         certain instructions to delay slots.
170
171 2023-02-23 Paulo Andrade <pcpa@gnu.org>
172
173         * include/lightning/jit_private.h: Add new 'inst' field to
174         jit_compiler_t, if __mips__ is defined. This field is a simple
175         helper for a pending instruction to be emitted, and that can
176         be emitted out of order.
177         * lib/jit_fallback.c: Update for changes in internal mips patching
178         and jumping macros and function calls.
179         * lib/jit_mips-cpu.c: Core of changes to attempt to fill delay
180         slots with instructions that can be emitted out of order.
181         * lib/jit_mips-fpu.c: Update to use delay slot in branches.
182         * lib/jit_mips.c: Update for new delay slot use logic.
183
184 2023-02-20 Paulo Andrade <pcpa@gnu.org>
185
186         * check/float.tst: Add conditionals for mips release for expected
187         NaN truncated to an integer.
188         * check/lightning.c: Add extra preprocessor for mips release.
189         * include/lightning/jit_mips.h: Make the NEW_ABI preprocessor
190         defined to zero if using the n32 or n64 abis. This makes it
191         easier to create runtime checks with an always true or false
192         condition.
193         * lib/jit_mips-cpu.c, lib/jit_mips-fpu.c: Implement mips release
194         6 support.
195         * lib/jit_mips.c: Add more reliable mips release detection code.
196
197 2023-02-09 Paulo Andrade <pcpa@gnu.org>
198
199         * check/Makefile.am: Update for new bit.tst test, to check the
200         new clor, clzr, ctor and ctzr instructions.
201         * check/all.tst: Update to verify encoding of new instructions.
202         * check/lightning.c: Update to have the lightning "assembler"
203         understanding the new instructions.
204         * include/lightning.h.in: Define new codes for new instructions.
205         * lib/jit_aarch64.c, lib/jit_alpha.c, lib/jit_arm.c, lib/jit_hppa.c,
206         lib/jit_ia64.c, lib/jit_loongarch.c, lib/jit_mips.c, lib/jit_ppc.c,
207         lib/jit_riscv.c, lib/jit_s390.c, lib/jit_sparc.c, lib/jit_x86.c:
208         Implement fallback version of new instructions.
209         * lib/jit_fallback.c: Actual implementation of the fallbacks of
210         the new instructions.
211         * lib/jit_names.c: Update to print debug information of new
212         instructions.
213
214 2023-01-26 Paulo Andrade <pcpa@gnu.org>
215
216         * check/riprel.c, check/riprel.ok: New check files.
217         * check/Makefile.am: Support for new riprel test.
218         * lib/jit_x86-cpu.c, lib/jit_x86-sse.c, lib/jit_x86.c: Implement
219         %rip relative addressing when reliable. Currently disabled for
220         x32 and _WIN32; could be added for positive relative addresses
221         only where it should work.
222         * lib/lightning.c: Correct problem added in previous patch due
223         to not testing on a 32 bit environment.
224
225 2023-01-23 Paulo Andrade <pcpa@gnu.org>
226
227         * lib/jit_mips-cpu.c, lib/jit_mips-cpu.c: Use pseudo instructions
228         "b" (BEQ(0,0,disp)) and "bal" (BGEZAL(0,disp)) for mips2, when an
229         unconditional branch or function call is known to be in range of a
230         relative jump. This should significantly reduce jit size generation.
231
232 2023-01-20 Paulo Andrade <pcpa@gnu.org>
233
234         * lib/jit_mips-cpu.c, lib/jit_mips.c, lib/jit_rewind.c: Adapt
235         code to implement a variable framesize and optimize frame pointer
236         for simple leaf functions.
237
238 2023-01-19 Paulo Andrade <pcpa@gnu.org>
239
240         * lib/jit_riscv.c, lib/jit_riscv-cpu.c: Adapt code to use a
241         variable framesize. Previously it was aligning the stack at
242         8 bytes, not 16. Now functions are called with a 16 byte aligned
243         stack.
244
245 2023-01-18 Paulo Andrade <pcpa@gnu.org>
246
247         * include/lightning/jit_private.h: Include new framesize field
248         of jit_compiler_t; add new alist field for jit_function_t; add
249         new cvt_offset and need_stack fields specific to x86.
250         * lib/jit_x86.c, lib/jit_x86-cpu: Rewrite code to create stack
251         frames, so that less stack space can be used if no, or very few
252         callee save registers are modified in a function.
253         * jit_x86-sse.c, jit_x86-x87.c: Make CVT_OFFSET variable, and
254         dynamically allocated; this is required to avoid needing to
255         modify twice %rsp at function prologs, even if no stack space
256         is used.
257
258 2022-11-09 Paulo Andrade <pcpa@gnu.org>
259
260         * configure.ac: Add new --enable-devel-strong-type-checking
261         option.
262         * include/lightning.h.in: Rework to not need to know if
263         PACKED_STACK is defined, and add a new argument to _jit_arg,
264         _jit_putarg{r,i}, _jit_pusharg{r,i} and _jit_ret{r,i} to have
265         the same code path if PACKED_STACK is defined or not, and also
266         to implement STRONG_TYPE_CHECK enabled with the new
267         --enable-devel-strong-type-checking.
268         * include/lightning/jit_private.h: Add new macros to add assertions
269         for STRONG_TYPE_CHECK and avoid pasting tokens in jit_inc_synth*
270         when the token is not a static known value.
271         * lib/jit_aarch64.c: The first implementation of the new code,
272         working correctly in Apple M1 and with and without STRONG_TYPE_CHECK
273         in Linux.
274
275 2022-11-08 Paulo Andrade <pcpa@gnu.org>
276
277         Add support for packed stack arguments as used by Apple M1
278         aarch64 cpus. This requires a major redesign in how Lightning
279         works, because contrary to all other supported ports, in this
280         case arguments must be truncated and sign/zero extended if
281         passed in registers, but when receiving the argument, there
282         is no need to truncate and sign/zero extend.
283         Return values are also treated this way. The callee must
284         truncate sign/zero extend, not the caller.
285         check/Makefile.am: Add LIGHTNING_CFLAGS to AM_CFLAGS.
286         check/all.tst: Implement paired arg/getarg/pusharg/putarg/ret
287         codes to validate they do not generate assertions.
288         * check/allocar.tst, check/call.tst, check/fib.tst, check/put.tst,
289         check/stack.tst: Update to pass in all build types.
290         check/lightning.c: Add new codes for extra codes to handle
291         packed stack.
292         * configure.ac: Add a preprocessor define to know if packed stack
293         need is required. This is not really used, as it was moved to
294         jit_aarch64.h.
295         * doc/Makefile.am: Add LIGHTNING_CFLAGS to AM_CFLAGS.
296         * doc/rpn.c: Update to pass in all build types.
297         include/lightning.h.in: Add new codes and reorder enum.
298         * include/lightning/jit_aarch64.h: Detect condition of needing
299         a packed stack.
300         * lib/jit_aarch64-sz.c: Regenerate.
301         * lib/jit_aarch64.c: Major updates for packed stack.
302         * lib/jit_names.c: Updates for debug output.
303         * lib/lightning.c: Update for new codes.
304
305 2022-10-31  Marc Nieper-Wißkirchen  <marc@nieper-wisskirchen.de>
306
307         Add new skip instruction.
308         * .gitignore: Update from Gnulib.
309         * check/Makefile.am: Add tests.
310         * check/lightning.c: Handle skip instructions.
311         * check/protect.c: Rewrite with skip.
312         * check/skip.ok: New test.
313         * check/skip.tst: New test.
314         * doc/body.texi: Document the skip instruction.
315         * include/lightning.h.in: Add the skip instruction.
316         * lib/jit_aarch64-sz.c: Update for skip instruction.
317         * lib/jit_aarch64.c: Implement skip instruction.
318         * lib/jit_alpha-sz.c: Update for skip instruction.
319         * lib/jit_alpha.c: Implement skip instruction.
320         * lib/jit_arm-sz.c: Update for skip instruction.
321         * lib/jit_arm.c: Implement skip instruction.
322         * lib/jit_hppa-sz.c: Update for skip instruction.
323         * lib/jit_hppa.c: Implement skip instruction.
324         * lib/jit_ia64-sz.c: Update for skip instruction.
325         * lib/jit_ia64.c: Implement skip instruction.
326         * lib/jit_loongarch-sz.c: Update for skip instruction.
327         * lib/jit_loongarch.c: Implement skip instruction.
328         * lib/jit_mips-sz.c: Update for skip instruction.
329         * lib/jit_mips.c: Implement skip instruction.
330         * lib/jit_names.c: Update for skip instruction.
331         * lib/jit_ppc-sz.c: Update for skip instruction.
332         * lib/jit_ppc.c: Implement skip instruction.
333         * lib/jit_riscv-sz.c: Update for skip instruction.
334         * lib/jit_riscv.c: Implement skip instruction.
335         * lib/jit_s390-sz.c: Update for skip instruction.
336         * lib/jit_s390.c: Implement skip instruction.
337         * lib/jit_size.c: Treat align and skip in a special way.
338         * lib/jit_sparc-sz.c: Update for skip instruction.
339         * lib/jit_sparc.c: Implement skip instruction.
340         * lib/jit_x86-sz.c: Update for skip instruction.
341         * lib/jit_x86.c: Implement skip instruction.
342         * lib/lightning.c: Classify skip instruction.
343
344 2022-10-30  Marc Nieper-Wißkirchen  <marc@nieper-wisskirchen.de>
345
346         Add user-visible functions jit_protect and jit_unprotect.
347         * check/Makefile.am: Add test for jit_protect and jit_unprotect.
348         * check/protect.c: New test.
349         * doc/body.texi: Add documentation for jit_protect and
350         jit_unprotect.
351         * include/lightning.h.in: Add prototypes for jit_protect and
352         jit_unprotect.
353         * include/lightning/jit_private.h: Add a field to store the size
354         of the protected memory.
355         * lib/lightning.c: Remember the size of the protected memory and
356         implement the two new functions.
357
358 2022-10-12 Paulo Andrade <pcpa@gnu.org>
359
360         * include/lightning/jit_loongarch.h, lib/jit_loongarch-cpu.c,
361         lib/jit_loongarch-fpu.c, lib/jit_loongarch-sz.c, lib/jit_loongarch.c:
362         New files implementing the first version of the new loongarch port.
363         * check/float.tst: Add preprocessor checks for NaN and +-Inf
364         values converted to integers for loongarch.
365         * configure.ac: Add check and conditionals for new architecture.
366         * include/lightning.h.in, check/lightning.c,
367         include/lightning/Makefile.am, include/lightning/jit_private.h,
368         lib/Makefile.am, lib/jit_size.c, lib/lightning.c: Update for new
369         port.
370
371 2022-10-05 Paulo Andrade <pcpa@gnu.org>
372
373         * check/lightning.c: Remove -Dmacro=value from usage and attempt
374         to parse it. It was buggy and not properly implemented. Now
375         it pass any extra options to the generated jit. To pass any
376         option starting with '-' need to also use '--'.
377         * check/collatz.e: New sample file showing an example of jit
378         generation.
379
380 2022-10-04 Paulo Andrade <pcpa@gnu.org>
381
382         * include/lightning/jit_private.h: Add new flag to jit_block_t.
383         * lib/lightning.c: Rewrite register liveness and state at block
384         entry code to avoid a very expensive and non scaling code path.
385         Now it attempts to do as few as possible recomputations when
386         merging state of adjacent blocks, still doing one extra nop pass
387         (in the sense that it will not find any changes) to make sure the
388         logic is correct.
389
390 2022-09-30 Paulo Andrade <pcpa@gnu.org>
391
392         * include/lightning/jit_private.h: Implement new data structures
393         specific to riscv.
394         * lib/jit_disasm.c: Extra disassemble code for riscv constant pool.
395         * lib/jit_riscv-cpu.c: Modify movi to use constant pool if 3 or
396         more instructions are required to construct constant and modify
397         movi_p to use a pc relative load from a constant pool.
398         lib/jit_riscv-sz.c: Update for new constant pool code. Most
399         instructions that need 64 bit constants are significantly reduced.
400         * lib/jit_riscv.c: Implement most of the constant pool code.
401         * lib/jit_size.c: Update for estimate of code generation size.
402         * lib/lightning.c: Update for riscv specific code, and also make
403         sure to mprotect the constant pool as executable.
404
405 2022-09-08 Paulo Andrade <pcpa@gnu.org>
406
407         * lib/jit_fallback.c: Implement fallback compare and swap with
408         pthreads.
409         * check/Makefile.am: Update for new cas{r,i} simple test.
410         * check/catomic.c, check/catomic.ok: New test case for
411         simple compare and swap atomic operation.
412         * check/lightning.c: Add entries to be able to use
413         the new compare and swap atomic operation. Still missing
414         a general test, only the basic C version.
415         * include/lightning.h.in: Include pthread.h, even if not
416         needing a fallback compare and swap.
417         * include/lightning/jit_private.h: Add support for a register pair
418         in second argument. Required by the new casr and casi operations.
419         * lib/jit_aarch64-cpu.c, lib/jit_aarch64-sz.c, lib/jit_aarch64.c,
420         lib/jit_ppc-cpu.c, lib/jit_ppc-sz.c, lib/jit_ppc.c, lib/jit_x86-cpu.c,
421         lib/jit_x86-sz.c, lib/jit_x86.c: Implement inline code for compare
422         and swap.
423         * lib/jit_arm-cpu.c, lib/jit_arm-sz.c, lib/jit_arm.c: Implement
424         inline code for compare and swap if cpu is armv7, otherwise, use
425         a fallback with pthreads.
426         * lib/jit_alpha-cpu.c, lib/jit_alpha-sz.c, lib/jit_alpha.c,
427         lib/jit_hppa-cpu.c, lib/jit_hppa-sz.c, lib/jit_hppa.c,
428         lib/jit_ia64-cpu.c, lib/jit_ia64-sz.c, lib/jit_ia64.c,
429         lib/jit_mips-cpu.c, lib/jit_mips-sz.c, lib/jit_mips.c,
430         lib/jit_riscv-cpu.c, lib/jit_riscv-sz.c, lib/jit_riscv.c,
431         lib/jit_s390-cpu.c, lib/jit_s390-sz.c, lib/jit_s390.c,
432         lib/jit_sparc-cpu.c, lib/jit_sparc-sz.c, lib/jit_sparc.c: Implement
433         fallback compare and swap with pthreads. At least some of these
434         should be updated for inline code generation.
435         * lib/jit_names.c, lib/jit_print.c: lib/lightning.c: Update for the
436         new compare and swap operation.
437         * doc/body.texi: Add simple documentation of the compare and swap
438         new operation.
439
440 2022-08-12  Marc Nieper-Wißkirchen  <marc@nieper-wisskirchen.de>
441
442         Document jit_align.
443         * doc/body.texi: Add documentation for jit_align.
444
445 2022-05-14 Paulo Andrade <pcpa@gnu.org>
446
447         * include/lightning.h.in: Reorder jit_mov{n,z}r in instruction list.
448         * lib/jit_alpha.c, lib/jit_alpha-cpu.c, lib/jit_hppa.c,
449         lib/jit_hppa-cpu.c, lib/jit_ia64.c, lib/jit_ia64-cpu.c,
450         lib/jit_riscv.c, lib/jit_riscv-cpu.c, lib/jit_s390.c,
451         lib/jit_s390-cpu.c, lib/jit_sparc.c, lib/jit_sparc-cpu.c:
452         Implement fallback jit_mov{n,z}r. These are a somewhat cheap
453         implementation, but should be reviewed for the arches that already
454         have a proper conditional move.
455         * lib/jit_arm-sz.c, lib/jit_mips-sz.c: Add missing maximum size
456         estimative and reorder.
457         * lib/jit_aarch64-sz.c, lib/jit_x86-sz.c, lib/jit_ppc-sz.c:
458         Reorder entry to match definition order.
459         * lib/jit_aarch64-sz.c, lib/jit_alpha-sz.c, lib/jit_hppa-sz.c,
460         lib/jit_ia64-sz.c, lib/jit_riscv-sz.c, lib/jit_s390-sz.c,
461         lib/jit_sparc-sz.c: Add heuristic value, basically the sum of
462         the cost of a movr + beqr.
463         * lib/jit_names.c: Add entries for debug output of mov{n,z}r.
464         * lib/lightning.c: Use proper bitmask in jit_classify.
465
466 2021-04-03  Marc Nieper-Wißkirchen  <marc@nieper-wisskirchen.de>
467
468         * check/Makefile.am: Add test for the live instruction.
469         * check/live.ok: New file.
470         * check/live.tst: New file.
471         * doc/body.texi: Add documentation for the live instruction and
472         for jit_get_reg/jit_get_unreg.  Fix menu entries.
473         * include/lightning.h.in (jit_get_reg, jit_unget_reg): Expose the
474         macros in the public header file.
475         * include/lightning/jit_private.h (jit_get_reg, jit_unget_reg):
476         Remove the macros from the private header file.
477
478 2021-04-03  Marc Nieper-Wißkirchen  <marc@nieper-wisskirchen.de>
479
480         * Makefile.am, check/Makefile.am, doc/Makefile.am,
481         lib/Makefile.am: Include $(top_builddir)/include in include paths
482         for the autoconf-generated header file lightning.h.
483
484 2021-04-03  Marc Nieper-Wißkirchen  <marc@nieper-wisskirchen.de>
485
486         * doc/.gitignore: Add version.texi to list of ignored files.
487         * doc/version.texi: Remove file from version control.
488
489 2020-18-04 Paulo Andrade <pcpa@gnu.org>
490
491         * lib/jit_x86-cpu.c, lib/jit_x86.c: Implement %rip relative
492         calls and jumps on x86_64. Currently very conservative, assuming
493         a jit block can be larger than 2G, so, if a jump or call is in
494         the same jit generation, but target is unknown, use an indirect
495         branch (could have an option to assume a jit code block is
496         never larger than 2G). Also a deoptimization is that now does
497         not always generate ip relative jmpi; previously implicitly
498         assumed jmpi would never be larger than 2G. Overall still an
499         optimization.
500
501 2020-23-01 Paulo Andrade <pcpa@gnu.org>
502
503         * lib/lightning.c: Add a proper fix to the condition of considering
504         a register dead at entry of a block when it modifies the register
505         !after! a branch to a target where it is live.
506         The correction is just to split blocks on branches. It uses an
507         extra label per branch, but makes following the code simpler and
508         avoid costly searches.
509
510 2020-22-01 Paulo Andrade <pcpa@gnu.org>
511
512         * lib/lightning.c: Correct a special condition of a register
513         only assigned in a block, and incorrectly marked as dead before
514         a jump where the register is live.
515
516 2019-10-04 Paulo Andrade <pcpa@gnu.org>
517
518         * check/lightning.c, include/lightning/jit_private.h,
519         include/lightning/jit_x86.h, lib/jit_x86-cpu.c, lib/jit_x86-sz.c,
520         lib/jit_x86.c: Correct issues with MinGW64 that defines _WIN32
521         and needs long long for jit_word_t.
522
523 2019-09-16 Paulo Andrade <pcpa@gnu.org>
524
525         * lib/lightning.c: Do not add registers that are never modified
526         to the set of registers to scan for live range, what might
527         consume a lot of cpu time, doing nothing.
528
529 2019-09-16 Marc Nieper-Wißkirchen <marc@nieper-wisskirchen.de>
530
531         * include/lightning/jit_x86.h, lib/jit_x86.c: Correct x86_64
532         backend, made %r12 a callee-save register as dictated by the
533         System V AMD64 ABI.
534
535 2019-09-16 Paulo Andrade <pcpa@gnu.org>
536
537         * Makefile.am: Do not force CFLAGS for the get_jit_size target.
538         * check/lightning.c: Drop __ppc__ check.
539         * include/lightning.h.in: Drop __ppc__ check. Add new
540         jit_flag_vararg flag, for special case in powerpc 32 bit using
541          the SYSV abi, and need to pass an extra argument during code
542         generation.
543         * include/lightning/jit_ppc.c: Drop __ppc_ check. Remove the
544         ABI_ELFv2 macro, as it now directly checks for the _CALL_ELF
545         value when/if appropriate.
546         * include/lightning/jit_private.h: Drop __ppc_ check. Check for
547         _CALL_AIXDESC to define extra data to handle function
548         descriptors.
549         * lib/jit_ppc-cpu.c: Update to check for _CALL_SYSV; assume
550         !_CALL_SYSV == (_CALL_AIX || _CALL_LINUX). Significant code
551         rework for the SYSV abi.
552         * lib/jit_ppc-sz.c: Update for the SYSV abi.
553         * lib/jit_ppc.c: Update for the SYSV abi. Add matching va_list
554         type. Drop __ppc__ check.
555         * lib/jit_size.c: Drop __ppc_ check.
556         * lib/lightning.c: Drop __ppc__ check. Add proper check for
557         __powerpc__ and _CALL_AIXDESC to manage function descriptors.
558         * lib/size.c: Update to drop __pppc_ check and SYSV abi.
559
560 2019-08-30 Paulo Andrade <pcpa@gnu.org>
561
562         * lib/jit_mips-cpu.c: Use JALR to get the same effect as JR, as
563         in mips32r6 JR generates an illegal instruction. Thanks to
564         Bruno Haible for providing a patch and the information, reported at
565         https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=925129
566         * THANKS: update.
567
568 2019-08-29 Marc Nieper-Wißkirchen <marc@nieper-wisskirchen.de>
569
570         * include/lightning/jit_private.h: Move definition of offsetof
571         from the public header file here.
572
573         * configure.ac, include/Makefile.am, include/lightning.h,
574         include/lightning.h.in: Generate lightning.h from lightning.in.h
575         and remove the dependence on config.h from the public header file.
576
577 2019-06-04 Paulo Andrade <pcpa@gnu.org>
578
579         * include/lightning/jit_riscv.h, lib/jit_riscv-cpu.c,
580         lib/jit_riscv-fpu.c, lib/jit_riscv-sz.c, lib/jit_riscv.c:
581         Implement riscv port. Only 64 bit Linux supported. Built on
582         Fedora 28 image.
583
584         * check/all.tst, check/float.tst, configure.ac, include/lightning.h,
585         include/lightning/Makefile.am, include/lightning/jit_private.h,
586         lib/Makefile.am, lib/jit_disasm.c, lib/jit_size.c, lib/lightning.c:
587         Minor updates for the new riscv port.
588
589 2019-06-04 Paulo Andrade <pcpa@gnu.org>
590
591         * lib/jit_alpha.c lib/jit_ia64.c lib/jit_mips.c lib/jit_sparc.c:
592         Correct assertion of _jitc->regarg after emiting an instruction.
593         jit_carry may be set, but not an argument to the current instruction.
594
595 2019-06-01 Paulo Andrade <pcpa@gnu.org>
596
597         * lib/lightning.c: Correct assertion on jit_unget_reg when the
598         argument is jit_carry, and jit_carry was not used in the
599         instruction.
600
601 2019-06-01 Paulo Andrade <pcpa@gnu.org>
602
603         * include/lightning/jit_private.h: Remove no longer need
604         setmask field of jit_block_t and blockmask from jit_compiler_t.
605
606         * lib/lightning.c: Rework of register live and unknown state
607         information during jit generation. It no longer recurses nor
608         do dangerous bit unset of registers in unknown state. The
609         only pitfall known, that must be taken care now is that jmpr
610         (or jmpi to not a jit node) is treated as a function call, as
611         otherwise it would need to consider all registers live, and
612         spill/reload during all jit generation.
613
614 2018-12-28 Paulo Andrade <pcpa@gnu.org>
615
616         * lib/jit_disasm.c: Release bfd handle. Thanks for patch to
617         Marc Nieper-Wißkirchen.
618
619 2018-08-30 Paulo Andrade <pcpa@gnu.org>
620
621         * lib/jit_disasm.c: Add hints to select hppa disassembler.
622
623         * lib/jit_hppa-cpu.c: Correct address of vastart when all
624         argument registers were used as non vararg arguments.
625
626         * lib/jit_hppa-fpu.c: Disable load/store of rv,ix,rb where
627         rv is the value, ix is an register or integer offset and rb
628         is a base register. These should be better tested, as they do
629         not work on all environments (fail on qemu-hppa).
630
631 2018-04-20 Paulo Andrade <pcpa@gnu.org>
632
633         * include/lightning/jit_private.h: Add new register classes to
634         flag float registers and double only registers, required for sparc64
635         where only low 32 bit fpr registers can be used for single precision
636         operations.
637         Add new 128 bit jit_regset_t type for sparc64 register set.
638
639         * include/lightning/jit_sparc.h, lib/jit_sparc-cpu.c, lib/jit_sparc-fpu.c,
640         lib/jit_sparc-sz.c, lib/jit_sparc.c: Update for 64 bits sparc.
641
642         * lib/lightning.c: Update for new jit_regset_t required for sparc64.
643
644 2018-02-26 Paulo Andrade <pcpa@gnu.org>
645
646         * check/lightning.c, include/lightning.h: Add the new jit_va_push
647         interface. That should be called when passing a va_list to a C
648         function. This is required because on Alpha a va_list is passed
649         by value, and lightning does not know about data types, so, cannot
650         understand it is pushing a va_list as argument.
651
652         * lib/jit_names.c, lib/lightning.c: Minor changes for the new
653         jit_code_va_push.
654
655         * check/cva_list.c: Update only test case using jit_va_push, to
656         pass a va_list to a C function.
657
658         doc/body.texi: Better documentation of the varargs interface.
659
660         * jit_alpha.c, jit_alpha-cpu.c: Update to properly push a
661         C va_list and correctly calculate varargs offset.
662
663         * lib/jit_aarch64-sz.c, lib/jit_aarch64.c, lib/jit_alpha-sz.c,
664         lib/jit_arm-sz.c, lib/jit_arm.c, lib/jit_hppa-sz.c, lib/jit_hppa.c,
665         lib/jit_ia64-sz.c, lib/jit_ia64.c, lib/jit_mips-sz.c, lib/jit_mips.c,
666         lib/jit_ppc-sz.c, lib/jit_ppc.c, lib/jit_s390-sz.c, lib/jit_s390.c,
667         lib/jit_sparc-sz.c, lib/jit_sparc.c, lib/jit_x86-sz.c, lib/jit_x86.c:
668         Update for the new jit_va_push interface.
669
670 2018-02-22 Paulo Andrade <pcpa@gnu.org>
671
672         * lib/jit_alpha-cpu.c: Always set t12 to the address of the
673         current function, to properly work on all systems. Previously
674         the shortcut did only work on Tru64. For Linux and glibc the
675         change is required.
676
677 2018-02-22 Paulo Andrade <pcpa@gnu.org>
678
679         * lib/jit_aarch64.c, lib/jit_alpha.c, lib/jit_arm.c,
680         lib/jit_mips.c, lib/jit_ppc.c, lib/jit_sparc.c, lib/jit_x86.c:
681         Correct wrong logic in usage of jit_live in jit_retr. The
682         problem is that if a temporary is required during epilog,
683         the return register might be allocated, so, jit_live must always
684         be used.
685
686 2018-01-31 Paulo Andrade <pcpa@gnu.org>
687
688         * lib/lightning.c: Avoid deep recursions when computing live
689         register ranges.
690
691 2018-01-31 Paulo Andrade <pcpa@gnu.org>
692
693         * lib/jit_mips-cpu.c: Correct frame size and varargs
694         initialization for the n32 abi.
695         * lib/jit_mips.c, lib/jit_mips-fpu.c: Correct 32 bit abis
696         in big-endian.
697
698 2017-09-13 Paulo Andrade <pcpa@gnu.org>
699
700         * configure.ac: Add check for binutils 2.29 prototype to the
701         disassembler function.
702         * lib/jit_disasm.c: Adapt for binutils 2.29 change.
703
704 2017-06-09 Paulo Andrade <pcpa@gnu.org>
705
706         * include/lightning/jit_private.h, lib/lightning.c: Add a
707         second pass from start when computing register live ranges.
708         This should be used temporarily, and is required for certain
709         loop constructs, with several consecutive blocks not referencing
710         a live register.
711
712 2016-05-05 Paulo Andrade <pcpa@gnu.org>
713
714         * lib/lightning.c: Correct wrong movr simplification,
715         remove no longer needed code to set return registers live
716         and update live register set when reaching a label boundary,
717         but do not descend if the block has been already visited.
718         The later need some tuning for complex code generation, where
719         it will still have issues.
720
721 2015-11-30 Paulo Andrade <pcpa@gnu.org>
722
723         * doc/body.texi: Change documentation to no longer say
724         it is a variant of the Fibonacci sequence, and document
725         a proper implementation.
726         Thanks to Jon Arintok for pointing out that the Fibonacci
727         sequence generation was incorrect. It was documented, but
728         still confusing.
729
730         * check/fib.tst, check/fib.ok, check/bp.tst, check/bp.ok,
731         doc/ifib.c, doc/rbif.c: Implement a proper Fibonacci
732         sequence implementation.
733
734 2015-07-03 Paulo Andrade <pcpa@gnu.org>
735
736         * lib/jit_mips-cpu.c: Correct definition of htonr_ul.
737         Correct prolog/epilog/va* routines to work on o64 abi.
738
739         * lib/jit_mips-fpu.c: Correct load of double literal
740         argument when not using a data buffer.
741         Remove alignment correction in vaarg_d if using the
742         new mips abi.
743
744         * lib/jit_mips.c: Correct code to allow creating variadic
745         jit functions when using the new mips abi.
746
747         * lib/jit_rewind.c: Minor adjust for rewind when using
748         the new mips abi, if there are varargs arguments in
749         registers.
750
751 2015-06-06 Paulo Andrade <pcpa@gnu.org>
752
753         * lib/jit_ia64-cpu.c: Search backward for the last output
754         register used, otherwise would stop too early if a float
755         argument used the slot.
756         Correct offset of first va_list argument, and use proper
757         va_list abi.
758
759         * lib/jit_ia64-fpu.c: Add new functions to move a gpr
760         to a fpr register, to counterpart the ones that move a
761         fpr to a gpr. These are required to properly implement
762         jit_getarg*_{f,d} on complex prototypes, or variadic
763         jit functions.
764
765         * lib/jit_ia64-sz.c: Update for support to jit variadic
766         functions.
767
768         * lib/jit_ia64.c: Implement proper abi for variadic
769         jit functions.
770
771 2015-06-04 Paulo Andrade <pcpa@gnu.org>
772
773         * lib/jit_rewind.c: New file implementing generic functions
774         to "rewind", or rewrite IR code sequences.
775
776         * include/lightning.h: Add several new codes, that previously
777         were a function call, that would synthesize the operation.
778         Now, there is a code for the operation, and a new flag to
779         know an operation is synthesized.
780
781         * include/lightning/jit_private.h: Add several new macros to
782         help construct synthesized IR code sequences.
783
784         * lib/Makefile.am: Update for lib/jit_rewind.c.
785
786         * lib/jit_disasm.c: Update for a small rework on jit_node_t,
787         so that --enable-devel-disassembler does not need a change
788         in the layout of jit_node_t.
789
790         * lib/jit_names.c: Update for the new codes.
791
792         * lib/jit_print.c: Update to print more readable output, and
793         flag synthesized IR code sequences.
794
795         * lib/jit_aarch64-sz.c, lib/jit_aarch64.c,
796         lib/jit_arm-sz.c, lib/jit_arm.c, lib/jit_x86-sz.c,
797         lib/jit_x86.c: Update for new synthesized IR code sequences.
798
799         * lib/jit_ppc-cpu.c, lib/jit_ppc-fpu., lib/jit_ppc-sz.c,
800         lib/jit_ppc.c, lib/jit_mips-cpu.c, lib/jit_mips-fpu.c,
801         lib/jit_mips-sz.c, lib/jit_mips.c, lib/jit_s390-fpu.c,
802         lib/jit_s390-sz.c, lib/jit_s390.c: Update for new synthesized
803         IR code sequences and correct bugs in the initial varargs
804         implementation support.
805
806         * lib/jit_alpha-sz.c, lib/jit_alpha.c, lib/jit_hppa-sz.c,
807         lib/jit_hppa.c, lib/jit_ia64-sz.c, lib/jit_ia64.c,
808         lib/jit_sparc-sz.c, lib/jit_sparc.c: Add generic, untested
809         support for the new synthesized IR code sequences. Known
810         most likely broken right now, and should be corrected once
811         access to these hosts is available.
812
813         * lib/lightning.c: Update for new IR codes, and add support
814         for not yet existing instructions that change third argument.
815
816         * size.c: Change to use different tables for LE and BE PowerPC.
817         Correct a wrong endif for x32.
818
819 2015-05-25 Paulo Andrade <pcpa@gnu.org>
820
821         * check/cva_list.c: New file implementing a test to ensure
822         the value returned by jit_va_start is a valid C va_list.
823
824         * check/va_list.ok: New simple helper file, as now the
825         va_list.tst test is enabled.
826
827         * check/va_list.tst: Rewritten for an extensive variadic
828         jit functions test.
829
830         * check/Makefile.am: Update for the new tests.
831
832         * lib/jit_arm-cpu.c, lib/jit_arm-swf.c, lib/jit_arm-vfp.c,
833         lib/jit_arm.c: Correct broken software float in a previous
834         commit. Note that the hard float abi implementation is known
835         broken at this time, for special cases involving variadic
836         functions, and should be corrected next.
837
838         lib/jit_x86-cpu.c, lib/jit_x86-sz.c, lib/jit_x86.c: Correct
839         the jit_va_list_t semantics to match C va_list.
840
841 2015-05-24 Paulo Andrade <pcpa@gnu.org>
842
843         * lib/Makefile.am: Bump library major. This is a preparation
844         for a rework that was due for quite some time, but that is
845         now required to properly implement variadic jit functions.
846         The rework is mainly required to know at prolog parsing, if
847         a function is variadic or not. This will benefit a few
848         backends, and is mandatory for the hard float arm abi.
849         The rework was already planned for quite some time, to
850         be able to use a variable stack framesize, and for leaf
851         functions optimization where applicable.
852         The change will be source compatible, but will change
853         some internals, and jit_code_t values, as some new will
854         be added.
855         The only behavior change is that, jit_arg_register_p may
856         change return value on hard float arm abi, if called before
857         or after jit_ellipsis. Common sense anyway, would say to
858         make that call after jit_ellipsis, but documentation
859         should be updated for it.
860
861 2015-05-24 Paulo Andrade <pcpa@gnu.org>
862
863         * lib/jit_aarch64-fpu.c, lib/jit_aarch64.c: Correct base
864         aarch64 varargs code.
865
866 2015-05-24 Paulo Andrade <pcpa@gnu.org>
867
868         * check/lightning.c: Clearly run check if clang is the system
869         compiler.
870
871 2015-05-20 Paulo Andrade <pcpa@gnu.org>
872
873         * lib/jit_sparc-cpu.c, lib/jit_sparc-fpu.c, lib/jit_sparc.c:
874         Add base support to jit vararg functions to the sparc backend.
875
876 2015-05-20 Paulo Andrade <pcpa@gnu.org>
877
878         * lib/jit_alpha-cpu.c, lib/jit_alpha-fpu.c, lib/jit_alpha.c:
879         Add base support to jit vararg functions to the alpha backend.
880
881 2015-05-19 Paulo Andrade <pcpa@gnu.org>
882
883         * lib/jit_hppa-cpu.c, lib/jit_hppa-fpu.c, lib/jit_hppa.c:
884         Add base support to jit vararg functions to the hppa backend.
885
886 2015-05-10 Paulo Andrade <pcpa@gnu.org>
887
888         * lib/jit_ia64-cpu.c, lib/jit_ia64-fpu.c, lib/jit_ia64.c:
889         Add base support to jit vararg functions to the ia64 backend.
890
891 2015-05-10 Paulo Andrade <pcpa@gnu.org>
892
893         * lib/jit_ia64-fpu.c, lib/jit_ia64.c: Correct movi_d_w
894         and movi_f_w implementation to work when not using a
895         data buffer. This causes the check varargs.tst to
896         work when passing "-d" to the lightning test tool.
897
898 2015-05-10 Paulo Andrade <pcpa@gnu.org>
899
900         * lib/jit_ia64.c: Implement inline assembly cache flush,
901         required on multiprocessor systems.
902
903 2015-05-06 Paulo Andrade <pcpa@gnu.org>
904
905         * lib/jit_mips-cpu.c, lib/jit_mips-fpu.c, lib/jit_mips.c:
906         Add base support to jit vararg functions to the mips backend.
907         Currently only supported on the o32 abi, until access to a
908         n32 system is arranged.
909
910 2015-05-05 Paulo Andrade <pcpa@gnu.org>
911
912         * lib/jit_ppc-cpu.c, lib/jit_ppc-fpu.c, lib/jit_ppc.c:
913         Add base support to jit vararg functions to the PowerPC backend.
914
915 2015-05-02 Paulo Andrade <pcpa@gnu.org>
916
917         * lib/jit_s390-cpu.c, lib/jit_s390-fpu.c, lib/jit_s390.c:
918         Add base support to jit vararg functions to the s390 backend.
919
920 2015-05-01 Paulo Andrade <pcpa@gnu.org>
921
922         * lib/jit_arm-cpu.c, lib/jit_arm-swf.c, lib/jit_arm-vfp.c,
923         lib/jit_arm.c: Add base support to jit vararg
924         functions to the arm backend.
925
926 2015-04-30 Paulo Andrade <pcpa@gnu.org>
927
928         * lib/jit_aarch64-cpu.c, lib/jit_aarch64-fpu.c,
929         lib/jit_aarch64.c: Add base support to jit vararg
930         functions to the aarch64 backend.
931
932 2015-04-27 Paulo Andrade <pcpa@gnu.org>
933
934         * include/lightning.h, include/lightning/jit_private.h,
935         lib/jit_names.c, lib/lightning.c: Add initial support
936         for the new jit_va_start, jit_va_arg, jit_va_arg_d, and
937         jit_va_end interfaces. The jit_va_start call is supposed
938         to return a va_list compatible pointer, but not yet
939         decided if it will be "declared" stdarg compatible,
940         as for now only x86 support has been added (and should
941         be compatible), but issues may arise on other backends.
942
943         * check/lightning.c: Add wrappers to call the new jit_va_*
944         interfaces.
945
946         * lib/jit_x86-cpu.c, lib/jit_x86.c: Implement the new
947         jit_va_* for x86.
948
949         * lib/jit_x86-sz.c: Add fields, but not yet fully updated,
950         as this is an intermediate commit.
951
952         * lib/jit_aarch64-sz.c, lib/jit_aarch64.c,
953         lib/jit_alpha-sz.c, lib/jit_alpha.c,
954         lib/jit_arm-sz.c, lib/jit_arm.c,
955         lib/jit_hppa-sz.c, lib/jit_hppa.c,
956         lib/jit_ia64-sz.c, lib/jit_ia64.c,
957         lib/jit_mips-sz.c, lib/jit_mips.c,
958         lib/jit_ppc-sz.c, lib/jit_ppc.c,
959         lib/jit_s390-sz.c, lib/jit_s390.c,
960         lib/jit_sparc-sz.c, lib/jit_sparc.c: Prepare for the
961         new jit_va_* interfaces. Not yet implemented, and will
962         cause an assertion if used.
963
964         * check/va_list.tst: Simple early test case, that works
965         on x86_64, x32, ix86, cygwin, and cygwin64.
966
967 2015-02-17 Paulo Andrade <pcpa@gnu.org>
968
969         * include/lightning.h, include/lightning/jit_private.h,
970         lib/jit_aarch64-cpu.c, lib/jit_aarch64.c,
971         lib/jit_alpha-cpu.c, lib/jit_alpha.c,
972         lib/jit_arm-cpu.c, lib/jit_arm.c,
973         lib/jit_hppa-cpu.c, lib/jit_hppa.c,
974         lib/jit_ia64-cpu.c, lib/jit_ia64.c,
975         lib/jit_mips-cpu.c, lib/jit_mips.c,
976         lib/jit_ppc-cpu.c, lib/jit_ppc.c,
977         lib/jit_s390-cpu.c, lib/jit_s390.c,
978         lib/jit_sparc-cpu.c, lib/jit_sparc.c,
979         lib/jit_x86-cpu.c, lib/jit_x86.c: Implement the new
980         jit_allocar(offs, size) interface, that receives
981         two integer registers arguments, allocates space
982         dynamically in the stack, returns the offset in
983         the first argument, and uses the second argument
984         for the size in bytes of the memory to be allocated.
985
986         * check/allocar.ok, check/allocar.tst: New files
987         implementing test cases for the new jit_allocar
988         interface.
989
990         * check/Makefile.am, check/lightning.c: Update for
991         the new test case and interface.
992
993         * doc/body.texi: Add documentation of the new
994         interface.
995
996 2015-02-17 Paulo Andrade <pcpa@gnu.org>
997
998         * include/lightning/jit_x86.h, lib/jit_x86-cpu.c,
999         lib/jit_x86-x87.c: No longer make st(7) available.
1000         Need to keep one x87 slots empty to avoid exceptions.
1001         This has the side effect of no longer needing the
1002         hackish emms instruction before a function call.
1003
1004 2015-02-16 Paulo Andrade <pcpa@gnu.org>
1005
1006         * lib/lightning.c: Remove the jit_regno_patch bitfield
1007         register fields before actual emit, as it is only really
1008         used before emit, otherwise, on special conditions it
1009         may consider live registers as dead during code emit.
1010
1011 2015-02-15 Paulo Andrade <pcpa@gnu.org>
1012
1013         * lib/jit_x86-cpu.c, lib/jit_x86-sse.c, lib/jit_x86-x87.c:
1014         Correct encoding of ldxr* stxr* in the x32 abi. If the
1015         displacement register is negative, it would generate
1016         a 64 bit instruction with a 32 bit unsigned displacement.
1017
1018         * check/ranger.tst, check/ranger.ok: New files, implementing
1019         a test case for negative loads and stores. This is range.tst
1020         converted to use registers instead of immediate offsets.
1021
1022         check/Makefile.am: Update for the new test case.
1023
1024 2015-02-07 Paulo Andrade <pcpa@gnu.org>
1025
1026         * lib/jit_size.c: Preventively use at least 144 bytes
1027         if JIT_INSTR_MAX is less than it. The logic is not
1028         guaranteed to be 100% precise, it is mostly heuristics
1029         to allocate a buffer with as close as possible size,
1030         but a wrong value may cause code generation to write
1031         past the end of the buffer.
1032
1033 2015-02-03 Paulo Andrade <pcpa@gnu.org>
1034
1035         * lib/lightning.c: Correct the reason the bug in
1036         simplify_stxi was not triggered before, it was due to
1037         incorrectly resetting the value->code field, what was
1038         causing it to never properly optimize:
1039                 stxi Im0 Rb0 Rt0
1040                 ldxi Rt1 Rb1 Im1
1041         when Rb0 == Rb1, Rt0 == Rt1 and Im0 == Im1
1042         There was another possible issue, that has been also
1043         addressed in this commit, that would be the case of
1044         Rbn == Rtn, where no redundancy removal is possible.
1045
1046 2015-02-03 Paulo Andrade <pcpa@gnu.org>
1047
1048         * lib/lightning.c: Correct wrong check in simplify_stxi.
1049         The test was incorrectly comparing the target register
1050         and the displacement offset. This was a time bomb bug,
1051         that would trigger in code like:
1052                 stxi Im0 Rb0 Rt0
1053                 stxi Im1 Rb1 Rt1
1054         if Rb0 == Rb1 && Rt0 == Rt1 && Im0 == Rt1, that is,
1055         the wrong check was Im0 == Rt1, instead of the supposed
1056         Im0 == Imm1 (that was what the code mean't to do). It
1057         was removing the second stxi assuming it was redundantly
1058         generated; as that is not uncommon pattern on
1059         translators generating jit.
1060
1061 2015-02-02 Paulo Andrade <pcpa@gnu.org>
1062
1063         * configure.ac, include/lightning/jit_private.h,
1064         lib/jit_aarch64.c, lib/jit_alpha.c, lib/jit_arm.c,
1065         lib/jit_disasm.c, lib/jit_hppa.c, lib/jit_ia64.c,
1066         lib/jit_mips.c, lib/jit_ppc.c, lib/jit_print.c,
1067         lib/jit_s390.c, lib/jit_sparc.c, lib/jit_x86.c: Add a new
1068         --enable-devel-disassembler option, that should be used
1069         during development, or lightning debug. This option
1070         intermixes previous jit_print and jit_disassemble
1071         output, making it easier to visualize what lightning
1072         call was used, and what code was generated.
1073
1074 2015-01-31 Paulo Andrade <pcpa@gnu.org>
1075
1076         * lib/jit_arm-cpu.c, lib/jit_arm.c: Only limit to 24 bit
1077         displacement non conditional jump in the same jit_state_t.
1078
1079 2015-01-19 Paulo Andrade <pcpa@gnu.org>
1080
1081         * doc/body.texi: Reorder documentation, making jit_frame
1082         and jit_tramp the lightning response to the need of
1083         trampolines, continuations and tail call optimizations.
1084         A pseudo code example of a factorial function was added.
1085         Also added a section for description of the available
1086         predicates.
1087
1088         * doc/fact.c: New file, implementing a simple example of
1089         a translation of a trivial, recursive, tail call optimization
1090         into lightning calls. This is the conversion to functional C
1091         code of the example in doc/body.texi.
1092
1093         * doc/Makefile.am: Update for the next test case.
1094
1095 2015-01-17 Paulo Andrade <pcpa@gnu.org>
1096
1097         * include/lightning.h, lib/jit_aarch64.c,
1098         lib/jit_alpha.c, lib/jit_arm-vfp.c, lib/jit_arm.c,
1099         lib/jit_hppa.c, lib/jit_ia64.c, lib/jit_mips.c,
1100         lib/jit_ppc.c, lib/jit_s390.c, lib/jit_sparc.c,
1101         lib/jit_x86.c: Add the new jit_arg_register_p predicate.
1102         The predicate is expected to be used to know if an
1103         argument is in a register, what would need special
1104         handling if code that can overwrite non callee save
1105         registers is executed.
1106
1107         * check/carg.c: New test case to check consistency and
1108         expected usage of jit_arg_register_p.
1109
1110         * check/Makefile.am: Update for new test case.
1111
1112 2015-01-17 Paulo Andrade <pcpa@gnu.org>
1113
1114         * include/lightning/jit_aarch64.h,
1115         include/lightning/jit_alpha.h,
1116         include/lightning/jit_arm.h,
1117         include/lightning/jit_hppa.h,
1118         include/lightning/jit_mips.h,
1119          include/lightning/jit_ppc.h,
1120         include/lightning/jit_s390.h,
1121         include/lightning/jit_sparc.h,
1122         include/lightning/jit_x86.h,
1123         lib/jit_aarch64.c, lib/jit_alpha.c,
1124         lib/jit_arm.c, lib/jit_hppa.c,
1125         lib/jit_ia64.c, lib/jit_mips.c,
1126         lib/jit_ppc.c, lib/jit_s390.c,
1127         lib/jit_sparc.c, lib/jit_x86.c: Remove jit_arg_reg_p and
1128         jit_arg_f_reg_p from a public header, and define it only
1129         on port specific files where an integer offset is used
1130         to qualify an argument identifier. Exported code expects
1131         an opaque pointer (but of jit_node_t* type) to "qualify"
1132         an argument identifier.
1133         This patch, and the code review/simplification done during
1134         it also corrected some bugs:
1135         o Inconsistent jit_arg_d value of double argument after 3
1136           integer arguments in arm for jit_functions; tested, C
1137           functions were being properly called.
1138         o Inconsistent use of getarg_{f,d} and putarg*_{f,d} on
1139           s390 (32-bit) that happened to not have a proper test
1140           case, as it would only happen for jit functions, and
1141           tested, called C functions had proper arguments.
1142         o Corrected a "last minute" correction that did not go
1143           to the committed version, and would not compile on hppa,
1144           due to bad _jit_putargi_d prototype definition.
1145
1146 2015-01-17 Paulo Andrade <pcpa@gnu.org>
1147
1148         * doc/body.texi: Correct wrong/outdated information for
1149         hton*, pusharg* and ret*, and add missing documentation
1150         for rsb*, qmul*, qdvi* and putarg*.
1151
1152 2015-01-15 Paulo Andrade <pcpa@gnu.org>
1153
1154         * configure.ac, lib/jit_disasm.c: Rewrite workaround
1155         to apparent problem to initialize powerpc disassembler.
1156
1157 2015-01-15 Paulo Andrade <pcpa@gnu.org>
1158
1159         * include/lightning.h, lib/jit_aarch64.c,
1160         lib/jit_alpha.c, lib/jit_arm.c, lib/jit_hppa.c,
1161         lib/jit_ia64.c, lib/jit_mips.c, lib/jit_ppc.c,
1162         lib/jit_s390.c, lib/jit_sparc.c, lib/jit_x86.c:
1163         Implement jit_putarg*. It works as a mix of jit_getarg*
1164         and jit_pusharg*, in the way that the first argument is
1165         a register or immediate, and the second is a pointer
1166         returned by jit_arg*. The use of the interface is to change
1167         values of arguments to the current jit function.
1168
1169         * check/put.ok, check/put.tst: New test cases exercising
1170         the new jit_putarg* interface.
1171
1172         * check/Makefile.am, check/lightning.c: Update for the
1173         new test case and interface.
1174
1175 2015-01-08 Paulo Andrade <pcpa@gnu.org>
1176
1177         * include/lightning/jit_s390.h, lib/jit_s390-cpu.c,
1178         lib/jit_s390-fpu.c, lib/jit_s390-sz.c, lib/jit_s390.c:
1179         Renamed s390x* files to s390*.
1180
1181         * check/float.tst, check/lightning.c, configure.ac,
1182         include/lightning.h, include/lightning/Makefile.am,
1183         lib/Makefile.am, lib/jit_s390.c, lib/jit_size.c,
1184         lib/lightning.c: Update for renamed files.
1185
1186 2015-01-08 Paulo Andrade <pcpa@gnu.org>
1187
1188         * include/lightning.h, include/lightning/jit_private.h,
1189         include/lightning/jit_s390x.h, lib/jit_disasm.c,
1190         lib/jit_s390x-cpu.c, lib/jit_s390x-fpu.c, lib/jit_s390x-sz.c,
1191         lib/jit_s390x.c, lib/jit_size.c, lib/lightning.c:
1192         Add support for generating jit for s390 32 bit. This change
1193         also removed %f15 from the list of temporaries fpr registers;
1194         it was not being used, but if were, it would corrupt the
1195         stack frame because the spill address would overwrite grp
1196         offsets.
1197
1198 2014-12-26 Paulo Andrade <pcpa@gnu.org>
1199
1200         * lib/jit_ppc-cpu.c, lib/jit_ppc.c: Correct some endianess issues
1201         on the powerpc le backend.
1202
1203 2014-12-26 Paulo Andrade <pcpa@gnu.org>
1204
1205         * lib/jit_ppc-cpu.c: Add mcrxr instruction emulation,
1206         as this instruction has been phased out, and should be
1207         implemented as a kernel trap.
1208
1209 2014-12-26 Paulo Andrade <pcpa@gnu.org>
1210
1211         * lib/jit_arm.c: Better check for need to flush constants
1212         before the pool being no longer reachable.
1213
1214 2014-12-25 Paulo Andrade <pcpa@gnu.org>
1215
1216         * include/lightning.h: Split jit_htonr in the new 3 interfaces
1217         jit_htonr_us, jit_htonr_ui and jit_htonr_ul, the later only
1218         available on 64 bit. The plain/untyped jit_htonr macro call
1219         maps to the wordsize one.
1220         * lib/jit_aarch64-cpu.c,  lib/jit_aarch64-sz.c, lib/jit_aarch64.c,
1221         lib/jit_alpha-cpu.c, lib/jit_alpha-sz.c, lib/jit_alpha.c,
1222         lib/jit_arm-cpu.c, lib/jit_arm-sz.c, lib/jit_arm.c,
1223         lib/jit_hppa-cpu.c, lib/jit_hppa-sz.c, lib/jit_hppa.c,
1224         lib/jit_ia64-cpu.c, lib/jit_ia64-sz.c, lib/jit_ia64.c,
1225         lib/jit_mips-cpu.c, lib/jit_mips-sz.c, lib/jit_mips.c,
1226         lib/jit_ppc-cpu.c, lib/jit_ppc-sz.c, lib/jit_ppc.c,
1227         lib/jit_s390x-cpu.c, lib/jit_s390x-sz.c, lib/jit_s390x.c,
1228         lib/jit_sparc-cpu.c, lib/jit_sparc-sz.c, lib/jit_sparc.c,
1229         lib/jit_x86-cpu.c, lib/jit_x86-sz.c, lib/jit_x86.c:
1230         Update backends for the new jit_htonr*.
1231         * check/lightning.c, lib/jit_names.c, lib/lightning.c:
1232         Update for the new jit_htonr* interfaces.
1233         * check/Makefile.am: Update for new test cases.
1234         * check/hton.ok, check/hton.tst: New test cases.
1235
1236 2014-12-24 Paulo Andrade <pcpa@gnu.org>
1237
1238         * include/lightning/jit_private.h, include/lightning/jit_x86.h,
1239         lib/jit_disasm.c, lib/jit_x86-cpu.c, lib/jit_x86-sse.c,
1240         lib/jit_x86-sz.c, lib/jit_x86-x87.c, lib/jit_x86.c,
1241         size.c: Implement support for the x32 abi. Built and
1242         tested on Gentoo default/linux/amd64/13.0/x32 profile.
1243
1244 2014-12-24 Paulo Andrade <pcpa@gnu.org>
1245
1246         * lib/jit_names.c: Add missing rsbi_f and rsbi_d strings.
1247
1248 2014-12-21 Paulo Andrade <pcpa@gnu.org>
1249
1250         * lib/jit_arm.c: Call __clear_cache for every page.
1251         This should only be required for older boards or
1252         toolchain setup, but has been reported to be required
1253         for lightning at some point.
1254
1255 2014-12-21 Paulo Andrade <pcpa@gnu.org>
1256
1257         * lib/jit_arm.c: Correct check to guard overflow of index
1258         of constants from program counter.
1259
1260 2014-11-24 Paulo Andrade <pcpa@gnu.org>
1261
1262         * lib/lightning.c: Remove an optimization to calee save
1263         registers that may incorrectly remove a jit_movr under
1264         special conditions.
1265
1266 2014-11-20 Paulo Andrade <pcpa@gnu.org>
1267
1268         * include/lightning/jit_ppc.h, lib/jit_ppc-cpu.c,
1269         lib/jit_ppc.c: Add initial powerpc le support.
1270
1271 2014-11-20 Paulo Andrade <pcpa@gnu.org>
1272
1273         * lib/jit_disasm.c: Change thumb or arm disassemble based on
1274         jit code before disassembly.
1275
1276         * lib/jit_arm-cpu.c: Correct reversed arguments to LDRD and
1277         STRD instructions, and correct checking for support of those.
1278
1279         * lib/jit_arm-swf.c: Correct wrong use of LDRD and STRD and
1280         only use those if the register is even.
1281
1282         * check/check.arm.swf.sh, check/check.arm4.swf.sh: New files
1283         to test LDRD and STRD, as well as the alternate code path
1284         when those are not available, in the .arm4. test case.
1285
1286         * check/Makefile.am: Update for the new test cases.
1287
1288 2014-11-08 Paulo Andrade <pcpa@gnu.org>
1289
1290         * include/lightning/jit_private.h, lib/jit_aarch64.c,
1291         lib/jit_alpha.c, lib/jit_arm.c, lib/jit_hppa.c,
1292         lib/jit_ia64.c, lib/jit_mips.c, lib/jit_ppc.c,
1293         lib/jit_s390x.c, lib/jit_sparc.c, lib/jit_x86.c:
1294         Implement a private jit_flush call, that flushes
1295         the cache, if applicable, aligning down to the
1296         previous and up to the next page boundary.
1297
1298 2014-11-08 Paulo Andrade <pcpa@gnu.org>
1299
1300         * check/ctramp.c: New file. It just repeats the test
1301         of tramp.tst, but using two jit_state_t, what should
1302         test possible issues with two contexts, and also validate
1303         jit_tramp works on backends with function descriptions.
1304
1305         * check/Makefile.am: Update for new test case.
1306
1307 2014-11-03 Paulo Andrade <pcpa@gnu.org>
1308
1309         * include/lightning/jit_mips.h: Do not make the t9 register
1310         JIT_R11 (or JIT_R7 for n32 or n64 abi) available. Previously
1311         it cause problems if one expects it to not be changed in a
1312         function call. For example, calling a jit function, where it
1313         really does not need to be changed.
1314
1315 2014-10-26 Paulo Andrade <pcpa@gnu.org>
1316
1317         * lib/jit_aarch64.c, lib/jit_alpha.c, lib/jit_arm.c,
1318         lib/jit_hppa.c, lib/jit_ia64.c, lib/jit_mips.c, lib/jit_ppc.c,
1319         lib/jit_s390x.c, lib/jit_sparc.c, lib/jit_x86.c: Add an
1320         assertion to all code generation "drivers" to ensure
1321         _jitc->regarg is empty or in an expected state, after
1322         translation of a lightning instruction to native code.
1323         This change was a brute force test to find out other cases
1324         of a temporary not being release (like was happening with
1325         _bmsi and _bmci on x86), but no other case was found,
1326         after running make check, with assertions enabled, on all
1327         backends.
1328
1329 2014-10-26 Paulo Andrade <pcpa@gnu.org>
1330
1331         * lib/jit_x86-cpu.c: Correct a register allocation leak in
1332         _bmsi and _bmci.
1333
1334 2014-10-25 Paulo Andrade <pcpa@gnu.org>
1335
1336         * lib/jit_disasm.c: Do not cause an fatal error if init_jit
1337         fails in the jit_init_debug call.
1338
1339 2014-10-24 Paulo Andrade <pcpa@gnu.org>
1340
1341         * lib/jit_ia64.c, lib/jit_ppc.c: Correct handling of function
1342         descriptor when first prolog is a jit_tramp prolog. The
1343         test case was using the same jit_context_t, so was not
1344         triggering this condition.
1345
1346         * lib/jit_ppc-cpu.c: Properly handle jump displacements that
1347         do not fit on 24 powerpc. This required changing from previous
1348         "mtlr reg, blr" to "mtctr reg, bctr" to properly handle
1349         the logic to "hide" function descriptors, but that would
1350         also be required as the proper jit_jmpr when/if implementing
1351         optimizations to leaf functions (was working with blr because
1352         it is saved/reloaded in prolog/epilog).
1353
1354 2014-10-21 Paulo Andrade <pcpa@gnu.org>
1355
1356         * include/lightning.h, lib/lightning.c: Add three predicates
1357         to query information about labels. jit_forward_p(label)
1358         will return non zero if the label is "forward", that is
1359         need a call to jit_link(label), jit_indirect_p(label)
1360         that returns non zero if the label was created with the
1361         jit_indirect() call, and jit_target_p(label) that will
1362         return non zero if there is at least one jump patched
1363         to land at that label.
1364
1365 2014-10-18 Paulo Andrade <pcpa@gnu.org>
1366
1367         * check/range.ok, check/range.tst: New test case designed
1368         to catch incorrect code generation, usually due to incorrect
1369         test of immediate size. The test checks a large amount of
1370         encodings in "power of two" boundaries. This test exorcises
1371         a significant amount of code paths that was previously not
1372         tested.
1373
1374         * check/Makefile.am: Add range test to make check target.
1375
1376         * lib/jit_aarch64-cpu.c: Correct wrong address calculation
1377         for stxi_c, stxi_s, stxi_i and stxi_l when the offset is
1378         too large.
1379
1380         * lib/jit_mips-fpu.c: Correct wrong size test to check if
1381         an immediate can be encoded in a float or double store.
1382
1383         * lib/jit_s390x-cpu.c: Correct inverted encoding to stxi_s
1384         when the offset cannot be encoded, and fallbacks to an
1385         alternate encoding in 2 instructions.
1386
1387 2014-10-17 Paulo Andrade <pcpa@gnu.org>
1388
1389         * check/alu_rsb.ok, check/alu_rsb.tst: New files implementing
1390         tests for jit_rsb*.
1391
1392         * check/Makefile.am, check/lightning.c, include/lightning.h,
1393         lib/jit_aarch64-cpu.c, lib/jit_aarch64-fpu.c, lib/jit_aarch64-sz.c,
1394         lib/jit_aarch64.c, lib/jit_alpha-cpu.c, lib/jit_alpha-fpu.c,
1395         lib/jit_alpha-sz.c, lib/jit_alpha.c, lib/jit_arm-cpu.c,
1396         lib/jit_arm-swf.c, lib/jit_arm-sz.c, lib/jit_arm-vfp.c,
1397         lib/jit_arm.c, lib/jit_hppa-cpu.c, lib/jit_hppa-fpu.c,
1398         lib/jit_hppa-sz.c, lib/jit_hppa.c, lib/jit_ia64-cpu.c,
1399         lib/jit_ia64-fpu.c, lib/jit_ia64-sz.c, lib/jit_ia64.c,
1400         lib/jit_mips-cpu.c, lib/jit_mips-fpu.c, lib/jit_mips-sz.c,
1401         lib/jit_mips.c, lib/jit_names.c, lib/jit_ppc-cpu.c,
1402         lib/jit_ppc-fpu.c, lib/jit_ppc-sz.c, lib/jit_ppc.c,
1403         lib/jit_s390x-cpu.c, lib/jit_s390x-fpu.c, lib/jit_s390x-sz.c,
1404         lib/jit_s390x.c, lib/jit_sparc-cpu.c, lib/jit_sparc-fpu.c,
1405         lib/jit_sparc-sz.c, lib/jit_sparc.c, lib/jit_x86-cpu.c,
1406         lib/jit_x86-sse.c, lib/jit_x86-sz.c, lib/jit_x86-x87.c,
1407         lib/jit_x86.c, lib/lightning.c: Implement jit_rsb*. This
1408         was a missing lightning 1.x interface, that on most
1409         backends is synthesized, but on a few backends (hppa and ia64),
1410         it can generate better code as on those there is, or the
1411         only instruction with an immediate is in "rsb" format
1412         (left operand).
1413
1414 2014-10-17 Paulo Andrade <pcpa@gnu.org>
1415
1416         * lib/jit_names.c: New file with single definition of string
1417         representation of lightning IR codes.
1418
1419         * size.c: Modified to append the code name in a C comment
1420         after the maximum instruction size.
1421
1422         * lib/jit_print.c: Minor change to not duplicate jit_names.c
1423         contents.
1424
1425         * lib/jit_aarch64-sz.c, lib/jit_alpha-sz.c, lib/jit_arm-sz.c,
1426         lib/jit_hppa-sz.c, lib/jit_ia64-sz.c, lib/jit_mips-sz.c,
1427         lib/jit_ppc-sz.c, lib/jit_s390x-sz.c, lib/jit_sparc-sz.c,
1428         lib/jit_x86-sz.c: Rewritten to add string representation of
1429         IR codes in a C comment.
1430
1431 2014-10-14 Paulo Andrade <pcpa@gnu.org>
1432
1433         * lib/jit_aarch64-cpu.c, lib/jit_alpha-cpu.c, lib/jit_arm-cpu.c,
1434         lib/jit_hppa-cpu.c, lib/jit_mips-cpu.c, lib/jit_ppc-cpu.c,
1435         lib/jit_sparc-cpu.c: Implement or correct the internal
1436         nop(count) call that receives an argument that tells the
1437         modulo bytes to align the code for the next instruction.
1438
1439         * include/lightning.h, lib/lightning.c, lib/jit_aarch64.c,
1440         lib/jit_alpha.c, lib/jit_arm.c, lib/jit_hppa.c, lib/jit_ia64.c,
1441         lib/jit_mips.c, lib/jit_ppc.c, lib/jit_s390x.c, lib/jit_sparc.c,
1442         lib/jit_x86.c: Implement the new jit_align() call that receive
1443         an argument, that tells the modulo, in bytes, to align the
1444         next instruction. In most backends the only value that makes
1445         a difference is a value that matches sizeof(void*), as all
1446         other values usually are already automatically aligned in
1447         labels, but not guaranteed to be aligned at word size bytes.
1448
1449         * check/align.ok, check/align.tst: New files, implementing
1450         a simple test for the new jit_align() interface.
1451
1452         * check/Makefile.am, check/lightning.c, lib/jit_aarch64-sz.c,
1453         lib/jit_alpha-sz.c, lib/jit_arm-sz.c, lib/jit_hppa-sz.c,
1454         lib/jit_ia64-sz.c, lib/jit_mips-sz.c, lib/jit_ppc-sz.c,
1455         lib/jit_print.c, lib/jit_s390x-sz.c, lib/jit_sparc-sz.c,
1456         lib/jit_x86-sz.c: Update for the new jit_code_align code and
1457         the jit_align() interface.
1458
1459 2014-10-13 Paulo Andrade <pcpa@gnu.org>
1460
1461         * include/lightning.h, lib/jit_size.c, size.c: Use a
1462         symbolic value for the last IR code.
1463
1464 2014-10-12 Paulo Andrade <pcpa@gnu.org>
1465
1466         * include/lightning.h, include/lightning/jit_private.h,
1467         lib/jit_aarch64-cpu.c, lib/jit_alpha-cpu.c, lib/jit_arm-cpu.c,
1468         lib/jit_hppa-cpu.c, lib/jit_ia64-cpu.c, lib/jit_mips-cpu.c,
1469         lib/jit_ppc-cpu.c, lib/jit_s390x-cpu.c, lib/jit_sparc-cpu.c,
1470         lib/jit_x86-cpu.c, lib/lightning.c: Implement the new
1471         jit_frame and jit_tramp interfaces, that allow writing
1472         trampoline like calls, where a single dispatcher jit buffer
1473         is written, and later other jit buffers are created, with
1474         the same stack frame layout as the dispatcher. This is the
1475         logic that GNU Smalltalk used in lightning 1.x, and is required
1476         to make a sane port for lighting 2.x.
1477
1478         * jit_ia64-cpu.c: Implement support for jit_frame and jit_tramp,
1479         and also correct wrong encoding for B4 instructions, that
1480         implement jmpr, as well as correct reverse logic in _jmpr,
1481         that was moving the branch register to the jump register,
1482         and not vice-versa.
1483         Also, if a stack frame is to be assumed, always assume it may
1484         call a function with up to 8 arguments, regardless of the
1485         hint frame argument.
1486
1487         * lib/jit_arm.c: Add a new must_align_p() interface to ensure
1488         function prologs are always aligned. This condition was
1489         previously always true, somewhat by accident, but with
1490         jit_tramp it is not guaranteed.
1491
1492         * jit_ia64-cpu.c: lib/jit_ppc.c: Add minor special handling
1493         required to implement jit_tramp, where a function descriptor
1494         should not be added before a prolog, as jit_tramp means omit
1495         prolog.
1496
1497         * check/lightning.c: Update test driver for the new interfaces.
1498
1499         * check/Makefile.am, check/tramp.tst, check/tramp.ok: Add
1500         a simple test and example of the jit_frame and jit_tramp
1501         usage implementing a simple Fibonacci function using a
1502         simulation of an interpreter stack and how it would handle
1503         state in language specific variables.
1504
1505         * doc/body.texi: Add documentation for jit_frame and
1506         jit_tramp.
1507
1508 2014-09-29 Paulo Andrade <pcpa@gnu.org>
1509
1510         * lib/jit_aarch64.c, lib/jit_alpha.c, lib/jit_arm.c,
1511         lib/jit_hppa.c, lib/jit_ia64.c, lib/jit_mips.c,
1512         lib/jit_ppc.c, lib/jit_s390x.c, lib/jit_sparc.c,
1513         lib/jit_x86.c, lib/lightning.c: Allow jit_jmpi on a
1514         target that is not a node. This may lead to hard to
1515         debug code generation, but is a required feature for
1516         certain generators, like the ones that used lightning
1517         1.2x. Note that previously, but not really well
1518         documented, it was instructed to use:
1519         jit_movi(rn, addr); jit_jmpr(rn);
1520         but now, plain:
1521         jit_patch_abs(jit_jmpi(), addr);
1522         should also work.
1523
1524 2014-09-24 Paulo Andrade <pcpa@gnu.org>
1525
1526         * lib/jit_x86-sz.c: Generate information about instruction
1527         lengths for more precise calculation of buffer size on
1528         Windows x64. This change is specially important because
1529         the maximum instruction length is larger than other
1530         systems, what could cause an out of bounds write on
1531         special conditions without this update.
1532
1533 2014-09-24 Paulo Andrade <pcpa@gnu.org>
1534
1535         * check/lightning.c: Add workaround to conflicting global
1536         optind variable in cygwin binutils that have an internal
1537         getopt* implementation.
1538
1539         * lib/jit_x86-cpu.c: Add a simple define ffsl ffs if building
1540         for 32 bit and there is no ffsl function.
1541
1542 2014-09-24 Paulo Andrade <pcpa@gnu.org>
1543
1544         * check/lightning.c: Add a hopefully temporary kludge to not use
1545         sprintf and sscanf returned by dlsym. This is required to pass
1546         the varargs test.
1547
1548         * include/lightning/jit_private.h: Use symbolic name for first
1549         integer register argument, as this is different in sysv and
1550         win64 abi.
1551
1552         * include/lightning/jit_x86.h: Add conditionals and definitions
1553         for Windows x64 (under __CYGWIN__ preprocessor conditional).
1554
1555         * lib/jit_x86-cpu.c: Correct one instruction encoding bug, that
1556         was working by accident. Only use rax to rdx for some byte
1557         operations to work on compatibility mode (that is, to generate
1558         the proper encoding, instead of actually generating encoding
1559         for high byte registers, e.g. %bh).
1560         Add proper prolog and epilog for windows x64.
1561
1562         * lib/jit_x86-sse.c: Correct a swapped rex prefix for float
1563         operations.
1564
1565         * lib/jit_x86.c: Adjust to support Windows x64 abi.
1566
1567         * check/check.x87.nodata.sh: New file, previously used but that
1568         was missing git.
1569
1570 2014-09-07 Paulo Andrade <pcpa@gnu.org>
1571
1572         * lib/lightning.c: Mark all registers advertised as live, as
1573         per jit_callee_save_p as live whenever reaching a jump that
1574         cannot be tracked. This is a rethink of the previous commit,
1575         and is a better approach, otherwise there would not be much
1576         sense on relying on jit_callee_save_p if it could not be
1577         trusted.
1578
1579         * check/jmpr.tst, check/jmpr.ok: New files implementing a very
1580         simple test case, that would actually cause an assertion on
1581         code before the change to only mark as live when reaching a
1582         jump that could not tracked, the actually advertised as callee
1583         save registers.
1584
1585         check/Makefile.am: Update for new jmpr test case.
1586
1587 2014-09-01 Paulo Andrade <pcpa@gnu.org>
1588
1589         * lib/lightning.c: Do not mark all registers in unknown state
1590         as live on jit_jmpr, or jit_jmpi to an absolute address. Instead,
1591         treat it as a function call, and only consider JIT_Vn registers
1592         as possibly live.
1593
1594 2014-08-29 Paulo Andrade <pcpa@gnu.org>
1595
1596         * doc/body.texi: Add a proper info menu entry for
1597         GNU lightning.
1598
1599         * doc/version.texi: Regenerate.
1600
1601 2014-08-16 Paulo Andrade <pcpa@gnu.org>
1602
1603         * lib/jit_aarch64-cpu.c, lib/jit_aarch64-fpu.c,
1604         lib/jit_arm-cpu.c, lib/jit_arm-vfp.c,
1605         lib/jit_hppa-cpu.c, lib/jit_hppa-fpu.c,
1606         lib/jit_ia64-cpu.c, lib/jit_ia64-fpu.c,
1607         lib/jit_mips-cpu.c, lib/jit_mips-fpu.c,
1608         lib/jit_ppc-cpu.c, lib/jit_ppc-fpu.c,
1609         lib/jit_s390x-cpu.c, lib/jit_s390x-fpu.c,
1610         lib/jit_s390x.c, lib/jit_sparc-cpu.c,
1611         lib/jit_x86-cpu.c, lib/jit_x86-sse.c,
1612         lib/jit_x86-x87.c: Review generation of all branch
1613         instructions and always adds the jit_class_nospill
1614         bitfield for temporary registers that cannot be spilled
1615         because the reload would be after a conditional jump; the
1616         patch only adds an extra assertion. These conditions do
1617         not happen on documented lightning usage, but can happen
1618         if one uses the not exported jit_get_reg and jit_unget_reg
1619         calls and cause enough register starvation.
1620
1621 2014-08-16 Paulo Andrade <pcpa@gnu.org>
1622
1623         * lib/jit_alpha.c: Correct wrong bitmask of most argument
1624         float register arguments, that were being set as callee
1625         save instead of argument registers class.
1626
1627 2014-08-16 Paulo Andrade <pcpa@gnu.org>
1628
1629         * lib/jit_arm-sz.c: Regenerate table of known maximum
1630         instruction sizes for the software float fallback,
1631         that implements "virtual" float registers in the stack
1632         and operations as calls to libgcc.
1633
1634         * size.c: Correct typo in the generated jit_arm-sz.c file.
1635
1636 2014-08-10 Paulo Andrade <pcpa@gnu.org>
1637
1638         * include/lightning/jit_alpha.h, lib/jit_alpha-cpu.c,
1639         lib/jit_alpha-fpu.c, lib/jit_alpha-sz.c, lib/jit_alpha.c:
1640         New files implementing a lightning Alpha port. Thanks
1641         to Trent Nelson and snakebit.net staff for providing access
1642         to an Alpha system.
1643
1644         * check/float.tst, check/lightning.c, configure.ac,
1645         include/lightning.h, include/lightning/Makefile.am,
1646         include/lightning/jit_private.h, lib/Makefile.am,
1647         lib/jit_disasm.c, lib/jit_size.c, lib/lightning.c:
1648         Minor changes to adapt for the new Alpha port.
1649
1650 2014-08-10 Paulo Andrade <pcpa@gnu.org>
1651
1652         * lib/lightning.c: Always mark JIT_RET and JIT_FRET as
1653         live in a function epilog. This is required because
1654         on some ports a complex sequence, allocating one or more
1655         registers, may be required to jump from a ret* to the
1656         epilog, and the lightning api does not have annotations
1657         to know if a function returns a value, or the type of
1658         the return value.
1659
1660 2014-08-10 Paulo Andrade <pcpa@gnu.org>
1661
1662         * lib/lightning.c: Change the correct live bitmask of
1663         return registers after a function call in jit_update.
1664
1665 2014-08-10 Paulo Andrade <pcpa@gnu.org>
1666
1667         * lib/lightning.c: Change assertions to have an int
1668         result and correct a bad bit mask assertion.
1669
1670 2014-08-10 Paulo Andrade <pcpa@gnu.org>
1671
1672         * lib/jit_aarch64.c: Correct bad setup for assertion
1673         of consistency before a patch.
1674
1675 2014-08-10 Paulo Andrade <pcpa@gnu.org>
1676
1677         * lib/jit_mips-cpu.c: Correct typo in the jit_bmsr
1678         implementation that was using the wrong test result
1679         register.
1680
1681 2014-07-28 Paulo Andrade <pcpa@gnu.org>
1682
1683         * lib/jit_memory.c: Do not call free on NULL pointers.
1684
1685         * include/lightning/jit_private.h, lib/jit_note.c,
1686         lib/lightning.c: Add a wrapper to memcpy and memmove
1687         to not actually call those functions with a zero size
1688         argument, and likely also a null src or dst.
1689
1690 2014-07-27 Paulo Andrade <pcpa@gnu.org>
1691
1692         * include/lightning/jit_private.h, lib/jit_disasm.c,
1693         lib/lightning.c: Remove the global jit_progname variable.
1694         It was being only used in jit_init_debug, that is called
1695         from init_jit, so, just pass an argument.
1696
1697 2014-07-27 Paulo Andrade <pcpa@gnu.org>
1698
1699         * doc/body.texi: Add note that jit_set_memory_functions
1700         should be called before init_jit, because init_jit
1701         itself may call the memory wrappers.
1702
1703 2014-04-22 Paulo Andrade <pcpa@gnu.org>
1704
1705         * lib/jit_arm.c: Do not get confused with default settings
1706         if /proc is not mounted on Linux specific code path.
1707
1708 2014-04-09 Paulo Andrade <pcpa@gnu.org>
1709
1710         * include/lightning/jit_aarch64.h, include/lightning/jit_arm.h,
1711         include/lightning/jit_hppa.h, include/lightning/jit_ia64.h,
1712         include/lightning/jit_mips.h, include/lightning/jit_ppc.h,
1713         include/lightning/jit_private.h, include/lightning/jit_s390x.h,
1714         include/lightning/jit_sparc.h, include/lightning/jit_x86.h:
1715         Do not add jit_regset_t, JIT_RA0, and JIT_FA0 to the installed
1716         header file. These types and definitions are supposed to be
1717         only used internally.
1718
1719 2014-04-05 Paulo Andrade <pcpa@gnu.org>
1720
1721         * lib/jit_arm-cpu.c: Only adjust stack pointer in prolog if
1722         need stack space, that is, do not emit a nop instruction
1723         subtracting zero from the stack pointer.
1724
1725 2014-04-04 Paulo Andrade <pcpa@gnu.org>
1726
1727         * lib/jit_disasm.c: Correct a crash in the doc/printf example
1728         on arm due to releasing the data_info information in
1729         jit_clear_state. This is a special case for arm only, and
1730         actually, only armv5 or older uses the data_info buffer,
1731         or when forcing arm instruction set mode besides thumb
1732         available.
1733
1734 2014-12-03 Paulo Andrade <pcpa@gnu.org>
1735
1736         * doc/body.texi: Write detailed description and examples for
1737         jit_get_memory_functions, jit_set_memory_functions,
1738         jit_get_code, jit_set_code, jit_get_data and jit_set_data.
1739
1740 2014-12-03 Paulo Andrade <pcpa@gnu.org>
1741
1742         * include/lightning.h, include/lightning/jit_private.h,
1743         lib/lightning.c: Implement the new jit_set_data() interface,
1744         and the new jit_get_data() helper. Like jit_set_code(),
1745         jit_realize() should be called before jit_set_data().
1746         The most common usage should be jit_set_data(JIT_DISABLE_DATA
1747         | JIT_DISABLE_NOTE), to force synthesize any float/double
1748         constant in the stack and not generate any debug information.
1749
1750         * lib/jit_note.c: Minor change to debug note generation as
1751         now it uses an alternate temporary data buffer during constants
1752         and debug generation to accommodate the possibility of the user
1753         setting an alternate data buffer.
1754
1755         * lib/jit_hppa-fpu.c, lib/jit_s390x.c, lib/jit_s390x-cpu.c,
1756         lib/jit_s390x-fpu.c, lib/jit_sparc.c, lib/jit_sparc-fpu.c,
1757         lib/jit_x86-sse.c, lib/jit_x86-x87.c: Implement jit_set_data.
1758
1759         * lib/jit_hppa-sz.c, lib/jit_sparc-sz.c, lib/jit_x86-sz.c,
1760         lib/jit_s390x-sz.c: Update for several instructions that now
1761         have a different maximum length due to jit_set_data.
1762
1763         * lib/jit_mips-fpu.c: Implement jit_set_data, but missing
1764         validation on n32 and n64 abis (and/or big endian).
1765
1766         * lib/jit_mips-sz.c: Update for changes in o32.
1767
1768         * lib/jit_ppc-fpu.c: Implement jit_set_data, but missing
1769         validation on Darwin PPC.
1770
1771         * lib/jit_ppc-sz.c: Update for changes in powerpc 32 and
1772         64 bit.
1773
1774         * lib/jit_ia64-fpu.c: Implement untested jit_set_data.
1775
1776         * TODO: Add note to list ports that were not tested for the
1777         new jit_set_data() feature, due to no longer having access
1778         to them.
1779
1780         * check/nodata.c: New file implementing a simple test exercising
1781         several different conditions created by jit_set_data().
1782
1783         * check/check.nodata.sh: New file implementing a wrapper
1784         over the existing *.tst files, that runs all tests without
1785         using a data buffer for constants; only meaningful (and
1786         enabled) on architectures that used to store float/double
1787         constants on a read only data buffer.
1788
1789         * configure.ac, check/Makefile.am: Update for the new test
1790         cases.
1791
1792         * check/lightning.c: Implement the new "-d" option that
1793         sets an internal flag to call jit_set_data() disable
1794         constants and debug, that is, using only a pure code
1795         buffer.
1796
1797 2014-11-03 Paulo Andrade <pcpa@gnu.org>
1798
1799         * include/lightning.h, include/lightning/jit_private.h,
1800         lib/lightning.c: Implement the new jit_set_code() interface,
1801         that allows instructing lightning to use an alternate code
1802         buffer. The new jit_realize() function should be called
1803         before jit_set_code(), and usually call jit_get_code()
1804         to query the amount of bytes expected to be required for
1805         the code.
1806
1807         * lib/jit_size.c: Minor update to have less chances of
1808         miscalculating the code buffer by starting the counter
1809         with the size of the longest instruction instead of zero,
1810         as code emit fails if at any moment less than the longest
1811         instruction bytes are available.
1812
1813         * check/setcode.c: New file implementing some basic tests
1814         of the new jit_set_code() interface.
1815
1816         * check/Makefile.am: Update for newer test case.
1817
1818 2014-06-03 Paulo Andrade <pcpa@gnu.org>
1819
1820         * include/lightning.h, lib/lightning.c: Add the new
1821         jit_indirect() call, that returns a special label node,
1822         and tells lightning that the label may be the target of
1823         an indirect jump.
1824
1825         * doc/body.texi: Document the new jit_indirect() call, and
1826         add examples of different ways to create labels and branches.
1827
1828 2014-23-02 Paulo Andrade <pcpa@gnu.org>
1829
1830         *  lib/jit_x86.c: Rewrite previous patch to inline save/restore
1831         because clobbering %ebx in x86 is treated as an error
1832         (jit_x86.c:239:5: error: PIC register clobbered by 'ebx' in 'asm').
1833
1834 2014-19-02 Paulo Andrade <pcpa@gnu.org>
1835
1836         * lib/jit_x86.c: Rewrite incorrect inline assembly that could
1837         truncate a variable in a callee save register. Now it simply
1838         tells gcc that the register is clobbered, instead of using a
1839         *32 bit* swap with a temporary variable. The problem only
1840         happens when compiling with optimization.
1841
1842 2014-19-02 Paulo Andrade <pcpa@gnu.org>
1843
1844         * include/lightning/jit_aarch64.h, include/lightning/jit_arm.h,
1845         include/lightning/jit_hppa.h, include/lightning/jit_ia64.h,
1846         include/lightning/jit_mips.h, include/lightning/jit_ppc.h,
1847         include/lightning/jit_s390x.h, include/lightning/jit_sparc.h,
1848         include/lightning/jit_x86.h: Change jit_regset_t to an
1849         unsigned type, to allow safe right shift.
1850
1851         * lib/lightning.c: Rewrite jit_regset_scan1 to allow easier
1852         compiler optimization.
1853
1854 2013-12-03 Paulo Andrade <pcpa@gnu.org>
1855
1856         * lib/jit_x86-x87.c: Correct wrong optimization when
1857         loading the log(2) constant.
1858
1859 2013-12-03 Paulo Andrade <pcpa@gnu.org>
1860
1861         * lib/jit_x86-cpu.c: Use the emms instruction before
1862         calling any function. This is particularly important
1863         when using c99 complex functions as it can easily
1864         overflow the x87 stack due to the way lightning uses
1865         the x87 stack as a flat register file.
1866
1867 2013-12-02 Paulo Andrade <pcpa@gnu.org>
1868
1869         * lib/jit_x86-x87.c: Correct wrong code generation due
1870         to comparing the base and not the value register with
1871         %st(0) in stxi_f.
1872
1873 2013-12-02 Paulo Andrade <pcpa@gnu.org>
1874
1875         * lib/jit_x86-x87.c, lib/jit_x86.c: Use 8 bytes aligned
1876         stack offset for float/double x87 to/from sse move.
1877
1878 2013-11-27 Paulo Andrade <pcpa@gnu.org>
1879
1880         * configure.ac, lib/jit_arm-swf.c, lib/jit_arm.c: Add
1881         changes that should at least allow building lightning
1882         on Apple iOS7.
1883
1884 2013-10-08 Paulo Andrade <pcpa@gnu.org>
1885
1886         * lib/jit_ppc-cpu.c: Correct wrong shortcut for ldxi_l with
1887         a zero offset, that was calling ldr_i instead of ldr_l.
1888
1889 2013-10-08 Paulo Andrade <pcpa@gnu.org>
1890
1891         * include/lightning/jit_arm.h, lib/jit_arm-cpu.c: Do not use
1892         by default load/store instructions that map to ldrt/strt.
1893         There is already the long displacement version for positive
1894         offsets, and when using a (shorter) negative offset it does
1895         not map to ldrt/strt. At least on qemu strt may cause
1896         reproducible, but unexpected SIGILL.
1897
1898 2013-10-08 Paulo Andrade <pcpa@gnu.org>
1899
1900         * lib/jit_arm-vfp.c: Correct wrong load/store offset
1901         calculation when the displacement is constant but too
1902         large to use an instruction with an immediate offset.
1903
1904 2013-10-07 Paulo Andrade <pcpa@gnu.org>
1905
1906         * check/self.c: Extend tests to validate jit_callee_save_p
1907         does not cause an assertion on valid arguments, and test
1908         extra registers defined on some backends.
1909
1910         * configure.ac: Do not ignore environment CFLAGS when
1911         checking if need to test runtime configurable options,
1912         like use x87 when sse2 is available, arm instruction set
1913         instead of thumb, etc.
1914
1915         * include/lightning/jit_arm.h: Correct wrong jit_f macro
1916         definition.
1917
1918         * include/lightning/jit_ia64.h, include/lightning/jit_ppc.h:
1919         Correct wrong jit_r macro definition.
1920
1921         * lib/jit_x86-x87.c, lib/jit_x86.c: Actually use the
1922         reserved stack space for integer to/from float conversion.
1923         The stack space was also changed to ensure it is 8 bytes
1924         aligned. Also, for Solaris x86 in 32 bit mode, an alternate
1925         truncr_d was implemented because for some reason it is
1926         failing with SIGILL if using the "fisttpl" instructions,
1927         that must be available on p6 or newer, but for the sake of
1928         making all tests pass, implement a 486 or newer sequence
1929         if "sun" is defined.
1930
1931 2013-10-03 Paulo Andrade <pcpa@gnu.org>
1932
1933         * include/lightning/jit_mips.h, lib/jit_mips-cpu.c,
1934         lib/jit_mips-sz.c, lib/jit_mips.c, size: Build and
1935         pass all test cases on Irix big endian mips using
1936         the 64 bit abi.
1937
1938 2013-10-02 Paulo Andrade <pcpa@gnu.org>
1939
1940         * include/lightning/jit_mips.h: Add proper mips abi detection.
1941
1942 2013-09-30 Paulo Andrade <pcpa@gnu.org>
1943
1944         * lib/jit_print.c: Do not crash if calling jit_print from
1945         gdb before actually emitting code.
1946
1947         * lib/lightning.c: Correct misplaced check for already
1948         visited blocks on conditional branches, what was preventing
1949         proper merge live bit masks of forward blocks.
1950
1951 2013-09-30 Paulo Andrade <pcpa@gnu.org>
1952
1953         * lib/jit_x86-cpu.c: Correct not properly tested case of using
1954         %r12 as index register, what was causing an invalid assertion.
1955         %r12 is mapped to the "extra" JIT_R3 register, and test cases
1956         only test "standard" lightning registers.
1957
1958 2013-09-28 Paulo Andrade <pcpa@gnu.org>
1959
1960         * lib/jit_ia64.c: Minor change to force collecting the maximum
1961         instruction length in the --enable-devel-get-jit-size build
1962         mode. The actual generated file did not change because the
1963         sampling was large enough that it had already collected proper
1964         information in the previously slightly buggy code (not forcing
1965         a sync of the instructions that could be combined).
1966
1967 2013-09-27 Paulo Andrade <pcpa@gnu.org>
1968
1969         * lib/jit_arm.c: Correct build when disassembler is
1970         disabled.
1971
1972 2013-09-25 Paulo Andrade <pcpa@gnu.org>
1973
1974         * lib/jit_ia64-cpu.c, lib/jit_ia64-fpu.c: Correct some
1975         off by one range checks (that were only accepting values
1976         one less than the maximum allowed) and an invalid test
1977         condition check that was forcing it to always use
1978         indirect jumps even when reachable with an immediate
1979         displacement.
1980
1981 2013-09-24 Paulo Andrade <pcpa@gnu.org>
1982
1983         * lib/jit_aarch64-sz.c, lib/jit_arm-sz.c, lib/jit_hppa-sz.c,
1984         lib/jit_ia64-sz.c, lib/jit_mips-sz.c, lib/jit_ppc-sz.c,
1985         lib/jit_s390x-sz.c, lib/jit_size.c, lib/jit_sparc-sz.c,
1986         lib/jit_x86-sz.c: New files implementing static tables
1987         with longest known instructions length generated to match
1988         a lightning instruction. These tables should make it easier
1989         to make it very unlikely to ever miscalculate, or by too
1990         much, the size of a code buffer.
1991
1992         * lib/jit_size.c: New file that aids to either collect
1993         jit code size information, or use the information depending
1994         on build options.
1995
1996         * size.c: New helper file that parses input for, and create
1997         an initial jit_$arch-sz.c file, that needs some minor edit
1998         for arches with multiple configurations.
1999
2000         * configure.ac, Makefile.am: Add the new, devel mode only
2001         --enable-devel-get-jit-size configure option, that sets
2002         compile time flags to collect jit code size information,
2003         that will be used as input for the "noinst size program".
2004
2005         * lib/jit_aarch64.c, lib/jit_arm.c, lib/jit_disasm.c,
2006         lib/jit_hppa.c, lib/jit_ia64.c, lib/jit_memory.c,
2007         lib/jit_mips.c, lib/jit_ppc.c, lib/jit_s390x.c,
2008         lib/jit_sparc.c, lib/jit_x86.c, lib/lightning.c: Minor
2009         changes for the --enable-devel-get-jit-size build mode,
2010         as well as the "production build mode" with jit code
2011         size information.
2012
2013 2013-09-14 Paulo Andrade <pcpa@gnu.org>
2014
2015         * include/lightning.h, lib/lightning.c: Add the new
2016         jit_pointer_p interface, that returns a boolean value
2017         telling if the pointer argument is inside the jit
2018         code buffer. This is useful to avoid the need to add
2019         extra labels and calls to jit_address to figure bounds
2020         of code buffer, and still keep internal data private.
2021
2022 2013-09-13 Paulo Andrade <pcpa@gnu.org>
2023
2024         * include/lightning.h, include/lightning/jit_private.h,
2025         lib/jit_note.c: Change the code argument of jit_get_note
2026         to a jit_pointer_t and make jit_get_note a public interface.
2027         It was intended so since start, as a way to map an offset
2028         in the code to a function name, file name and line number
2029         mapping.
2030
2031 2013-09-11 Paulo Andrade <pcpa@gnu.org>
2032
2033         * doc/body.texi: Correct reversed arguments in example of
2034         usage in a (possibly) multi threaded, multiple jit_state_t
2035         environments.
2036
2037         * include/lightning/jit_arm.h, include/lightning/jit_private.h,
2038         lib/jit_arm-cpu.c, lib/jit_arm.c: Make a previously, non
2039         documented, global state private to the related jit_state_t
2040         generating code.
2041
2042 2013-09-10 Paulo Andrade <pcpa@gnu.org>
2043
2044         * check/self.c, check/self.ok: New files implementing simple
2045         consistency check assertions. At first validating some macros
2046         that use values from different sources agree.
2047
2048         * check/Makefile.am: Update for the new test case.
2049
2050         * include/lightning.h,  lib/lightning.c: Add the new
2051         jit_callee_save_p() call, that is intended to be used when
2052         writing complex code using lightning, so that one does not
2053         need to verify what backend is being used, or have access to
2054         private data, to query if a register is callee save or not;
2055         on several backends the scratch registers are actually callee
2056         save.
2057
2058         * include/lightning/jit_aarch64.h, include/lightning/jit_arm.h,
2059         include/lightning/jit_hppa.h, include/lightning/jit_mips.h,
2060         include/lightning/jit_ppc.h, include/lightning/jit_sparc.h,
2061         include/lightning/jit_x86.h: Add an explicit definition for
2062         JIT_R3-JIT_Rn, JIT_V3-JIT_Vn and JIT_F6-JIT_Fn when applicable.
2063         This allows one to write code based on "#if defined(JIT_XN)"
2064         and therefore, not need to check what is the current backend
2065         or have access to private data structures. This is particularly
2066         useful when writing virtual machines with several specialized,
2067         global registers.
2068
2069         * lib/jit_ia64.c: Properly flag the callee save general
2070         purpose registers as such, so that jit_callee_save_p() works
2071         as intended.
2072
2073 2013-09-10 Paulo Andrade <pcpa@gnu.org>
2074
2075         * check/lightning.c, configure.ac: Conditionally use the
2076         code written to workaround a bug in the Hercules emulator,
2077         as isnan and isinf are not available at least on HP-UX ia64.
2078
2079 2013-09-10 Paulo Andrade <pcpa@gnu.org>
2080
2081         * lib/jit_s390x-cpu.c: Spill/reload correct callee save
2082         float registers.
2083
2084 2013-09-10 Paulo Andrade <pcpa@gnu.org>
2085
2086         * lib/jit_hppa-cpu.c: Correct code to call a function stored
2087         in a register or a patched function address.
2088
2089 2013-09-10 Paulo Andrade <pcpa@gnu.org>
2090
2091         * lib/jit_ia64-cpu.c: Correct incorrect logic when restoring
2092         the value of the "r2" callee save register.
2093
2094 2013-08-29 Paulo Andrade <pcpa@gnu.org>
2095
2096         * lib/jit_arm-cpu.c, lib/jit_arm.c: Correct wrong test and update
2097         of the thumb offset information, when checking if needing to
2098         patch a jump from arm to thumb mode. The problem would happen when
2099         remapping the code buffer, and the new address being lower than
2100         the previous one.
2101
2102 2013-08-26 Paulo Andrade <pcpa@gnu.org>
2103
2104         * configure.ac: Extend FreeBSD test to also handle NetBSD.
2105
2106         * lib/jit_x86-cpu.c: Correct wrongly defined offset type of
2107         ldxi_ui. Problem detected when building on NetBSD.
2108
2109         * lib/lightning.c: Adjust code to handle NetBSD mremap,
2110         where arguments do not match Linux mremap.
2111
2112 2013-08-26 Paulo Andrade <pcpa@gnu.org>
2113
2114         * lib/jit_ppc.c: Correct C sequence point problem miscalculating
2115         the actual function address in a function descriptor. Problem
2116         happens with gcc 4.8.1 at least.
2117
2118 2013-08-11 Paulo Andrade <pcpa@gnu.org>
2119
2120         * lib/jit_s390x-cpu.c: Correct code checking if immediate
2121         fits instruction, but using the negated value.
2122
2123 2013-07-28 Paulo Andrade <pcpa@gnu.org>
2124
2125         * include/lightning/jit_s390x.h, lib/jit_s390x-cpu.c,
2126         lib/jit_s390x-fpu.c, lib/jit_s390x.c: New files
2127         implementing the new s390x port.
2128
2129         * configure.ac, include/lightning.h,
2130         include/lightning/Makefile.am,
2131         include/lightning/jit_private.h,
2132         lib/Makefile.am, lib/jit_disasm.c, lib/lightning.c:
2133         Minor adaptation for the new s390x backend.
2134
2135         * check/float.tst: Update for the s390x result of
2136         truncating +Inf to integer.
2137
2138         * check/qalu_mul.tst: Add extra test cases to better test
2139         high word of signed multiplication as the result is
2140         adjust from unsigned multiplication on s390x.
2141
2142 2013-07-28 Paulo Andrade <pcpa@gnu.org>
2143
2144         * check/lightning.c: Do not assume casting a double NaN or
2145         Inf to float will produce the expected float NaN or Inf.
2146         This is not true at least under s390x.
2147
2148 2013-07-28 Paulo Andrade <pcpa@gnu.org>
2149
2150         * check/check.arm.sh, check/check.sh, check/check.swf.sh,
2151         check/check.x87.sh: Properly check test programs output,
2152         not just rely on the test program self testing the results
2153         and not crashing.
2154
2155 2013-07-28 Paulo Andrade <pcpa@gnu.org>
2156
2157         * lib/jit_aarch64.c: Remove unused macros left from cut&paste
2158         of jit_arm.c.
2159
2160 2013-07-16 Paulo Andrade <pcpa@gnu.org>
2161
2162         * include/lightning/jit_aarch64.h, lib/jit_aarch64-cpu.c,
2163         lib/jit_aarch64-fpu.c, lib/jit_aarch64.c: New files
2164         implementing the new aarch64 port, as a new architecture,
2165         not as an expansion of the existing armv[4-7] port.
2166
2167         * check/lightning.c: Add aarch64 support and a small
2168         change to recognize character constants as immediate
2169         values.
2170
2171         * check/float.tst: Add aarch64 preprocessor conditionals
2172         to select proper expected value when converting [+-]Inf
2173         and NaN to integer.
2174
2175         * include/lightning/jit_arm.h, lib/jit_arm.c: Minor changes
2176         to better match the new aarch64 files.
2177
2178         * configure.ac, include/lightning.h,
2179         include/lightning/Makefile.am, include/lightning/jit_private.h,
2180         lib/Makefile.am, lib/lightning.c: Minor adjustments
2181         for the aarch64 port.
2182
2183 2013-07-08 Paulo Andrade <pcpa@gnu.org>
2184
2185         * NEWS, THANKS, configure.ac, doc/version.texi: Update for
2186         the 1.99a second alpha release.
2187
2188 2013-06-25 Paulo Andrade <pcpa@gnu.org>
2189
2190         * lib/jit_mips.c: Correct cut&paste error that caused wrong
2191         stack offset calculation for double arguments in stack in
2192         the o32 abi.
2193         Correct typo in the __LITTLE_ENDIAN macro name, that came
2194         from cut&paste error in the original typo in lib/jit_ppc.c.
2195
2196         * lib/jit_ia64.c, lib/jit_ppc.c: Correct typo in the
2197         __LITTLE_ENDIAN macro name.
2198
2199 2013-06-22 Paulo Andrade <pcpa@gnu.org>
2200
2201         * check/lightning.c, configure.ac, include/lightning.h,
2202         lib/lightning.c: Add tests and quirks to build/detect
2203         and/or work on Irix.
2204
2205         * include/lightning/jit_mips.h, lib/jit_mips-cpu.c,
2206         lib/jit_mips-fpu.c, lib/jit_mips.c: Adapt code to run
2207         in big endian mips, using the n32 abi.
2208
2209 2013-06-18 Paulo Andrade <pcpa@gnu.org>
2210
2211         * include/lightning.h: Minor extra preprocessor testing
2212         to "detect" byte order on x86 solaris, that now builds
2213         and pass all test cases.
2214
2215 2013-06-18 Paulo Andrade <pcpa@gnu.org>
2216
2217         * lib/jit_sparc-cpu.c: Correct compiler warning of value
2218         used before assignment. The usage is bogus as the api
2219         requires always patching jumps, but the random value used
2220         could cause an assertion due to invalid displacement.
2221
2222         * lib/jit_sparc.c: Always load and store double arguments
2223         in stack as 2 float loads or stores, for safety, as unaligned
2224         access is not allowed in Sparc Solaris.
2225
2226 2013-06-14 Paulo Andrade <pcpa@gnu.org>
2227
2228         * configure.ac: Force -mlp64 to CFLAGS on HP-UX ia64 port.
2229         It is the only supported mode, and expects gcc as C compiler.
2230
2231         * include/lightning.h, lib/jit_ia64-cpu.c, lib/jit_ia64.c:
2232         Correct ia64 port to work on HP-UX that runs it in big endian
2233         mode.
2234
2235 2013-06-10 Paulo Andrade <pcpa@gnu.org>
2236
2237         * lib/jit_hppa.c: Sanitize the cache synchronization inline
2238         assembly code that was doing twice the work and redundantly
2239         flushing the end address every loop iteration.
2240
2241 2013-06-09 Paulo Andrade <pcpa@gnu.org>
2242
2243         * configure.ac, check/Makefile.am, doc/Makefile.am: Do not
2244         explicitly link to -ldl, but instead autodetect the library
2245         with dlopen, dlsym, etc.
2246
2247         * check/lightning.c: Add workaround to apparently buggy
2248         getopt in HP-UX that sets optind to the wrong index, and
2249         use RTLD_NEXT on HP-UX instead of RTLD_DEFAULT to dlsym
2250         global symbols.
2251
2252         * include/lightning.h: Rework definitions of wordsize and
2253         byte order to detect proper values on HP-UX.
2254
2255         * lib/lightning.c: Minor correction to use MAP_ANONYMOUS
2256         instead of MAP_ANON on HP-UX.
2257
2258         * lib/jit_hppa.c: Float arguments must be passed on integer
2259         registers on HP-UX, not only for varargs functions.
2260           Add code to properly clear instruction cache. This was
2261         not required on Debian hppa port, but may have been working
2262         by accident.
2263
2264         * lib/jit_hppa-cpu.c: Follow pattern of HP-UX binaries and
2265         use bve,n instead of bv,n to return from functions.
2266
2267         * lib/jit_hppa-fpu.c: For some reason "fst? frX,rX,(rY)" did
2268         not work on the tested computer (HP-UX B.11.23 U 9000/785 HP-UX)
2269         so the code was changed, at first for __hpux only to add the
2270         base and offset register and use the instruction with an
2271         immediate (zero) offset.
2272
2273 2013-06-07 Paulo Andrade <pcpa@gnu.org>
2274
2275         * check/lightning.c, lib/jit_disasm.c, lib/jit_ppc-cpu.c,
2276         lib/jit_ppc-fpu.c, lib/jit_ppc.c, include/lightning.h,
2277         include/lightning/jit_ppc.h, include/lightning/jit_private.h:
2278         Adapt code to work on 32 bit AIX ppc using gcc. Most changes
2279         are basically to adapt the elf64 logic to 32 bit, as it does
2280         not use the same convention of 32 bit Darwin ppc.
2281
2282         * check/stack.tst: Add a fake memcpy function to the test
2283         case if running under AIX, as it is not available to dlsym.
2284
2285         * configure.ac: Check for getopt.h header, not available in
2286         AIX.
2287
2288 2013-06-01 Paulo Andrade <pcpa@gnu.org>
2289
2290         * include/lightning/jit_hppa.h, lib/jit_hppa-cpu.c,
2291         lib/jit_hppa-fpu.c, lib/jit_hppa.c: New files implementing
2292         the hppa port. Built on Debian Linux PA-RISC 2.0, 32 bit.
2293
2294         * check/float.tst: Add preprocessor for hppa expected
2295         values when converting NaN and +-Inf to an integer.
2296
2297         * check/ldst.inc: Ensure double load/store tests use an
2298         8 byte aligned address by default.
2299
2300         * lib/lightning.c: Correct a bug found during tests in
2301         the new port, where qmul* and qdiv* were not properly
2302         setting one of the result registers as modified in the
2303         function, what would be a problem if the only "write"
2304         usage were the qmul* or qdiv*.
2305
2306         * check/varargs.tst, check/varargs.ok: Add one extra
2307         interleaved integer/double test to validate proper code
2308         generation in the extra case.
2309
2310         * check/lightning.c, configure.ac, include/lightning.h,
2311         include/lightning/Makefile.am,
2312         include/lightning/jit_private.h, lib/Makefile.am,
2313         lib/jit_disasm.c: Update for the hppa port.
2314
2315 2013-04-27 Paulo Andrade <pcpa@gnu.org>
2316
2317         * check/varargs.tst: Correct misplaced .align directive
2318         that was causing the double buffer to not be aligned at
2319         8 bytes.
2320         * lib/jit_ia64-cpu.c:
2321           Properly implement abi for excess arguments passed on
2322         stack.
2323           Simplify load/store with immediate displacement argument
2324         with zero value.
2325           Simplify some calls to "subi" changing to "addi" with
2326         a negative argument.
2327           Remove some #if 0'ed code, that could be useful in
2328         special conditions, but the most useful one would be
2329         to "optimize" "static" jit functions, but for the sake
2330         of simplicity, jit functions are implemented in a way
2331         that can be passed back to C code as C function pointers.
2332           Add an attribute to prototypes of several unused functions.
2333         These functions are defined for the sake of implementing all
2334         Itanium documented instructions, but a significant amount of
2335         them is not used by lightning.
2336         * lib/jit_ia64-fpu.c: Simplify load/store with zero immediate
2337         displacement and add unused attribute for functions not used
2338         by lightning, but required to provide macros implementing all
2339         Itanium documented instructions.
2340         * lib/jit_ia64.c: Update for the properly implemented abi
2341         for stack arguments.
2342         * lib/lightning.c: Mark an unused function as such.
2343
2344 2013-04-27 Paulo Andrade <pcpa@gnu.org>
2345
2346         lib/jit_ia64-cpu.c:
2347           Correct immediate range check of integer comparisons when
2348         inverting arguments.
2349           Correct gei_u that was not decrementing immediate when
2350         inverting arguments.
2351           Correct b?add* and b?sub* that were not properly updating
2352         the result register.
2353
2354 2013-04-27 Paulo Andrade <pcpa@gnu.org>
2355
2356         * lib/jit_ia64-cpu.c: Correct wrong mapping of 2 instructions
2357         in "M-, stop, M-, stop" translation, that was ignoring the
2358         last stop (implemented as a nop I- stop).
2359
2360         * lib/jit_ia64-fpu.c: Properly implement fnorm.s and fnorm.d,
2361         as well as the proper integer to float or double conversion.
2362
2363 2013-04-27 Paulo Andrade <pcpa@gnu.org>
2364
2365         * lib/jit_ia64-cpu.c: Correct bogus implementation of ldr_T
2366         for signed integers, that was using ld1.s, ld2.s and ld4.s.
2367         The ".s" stands for speculative load, not sign extend.
2368
2369         * lib/jit_ia64-fpu.c: Correct bogus implementation of ldxr_T
2370         for float and double. The third (actually, second) argument
2371         is indeed added to the base register, but the base register
2372         is modified. The actual M7 implementation was already correct,
2373         just the ldxr_f and ldxr_d implementation that was kept in
2374         a prototype state, misinterpreting what M7 does.
2375
2376 2013-04-27 Paulo Andrade <pcpa@gnu.org>
2377
2378         * lib/jit_ia64-cpu.c: Correct X2 pattern matching by preventing
2379         it to attempt to require a stop between the L and the X
2380         instruction; that is, check the registers and predicates
2381         before emitting the L instruction, not after.
2382
2383         * lib/jit_ia64-fpu.c: Slightly simplify and correct
2384         divr_f and divrd_d implementation.
2385
2386         * check/lightning.c: Add __ia64__ preprocessor define
2387         on Itanium.
2388
2389         * check/alu.inc, check/clobber.tst, check/float.tst: Define
2390         several macros conditionally to __ia64__. This is required
2391         because __ia64__ jit generation can use way too many memory,
2392         due to not implementing instruction reordering to avoid
2393         as much as possible "stops", what causes way too many nops
2394         to be generated, as well as the fact that division and
2395         remainder requires function calls, and float division
2396         requires significant code to implement.
2397
2398 2013-04-27 Paulo Andrade <pcpa@gnu.org>
2399
2400         * include/lightning.h: Add new backend specific movr_w_d,
2401         movr_d_w and movi_d_w codes as helpers to ia64 varargs
2402         functions arguments.
2403
2404         * lib/jit_ia64-cpu.c:
2405           Correct wrong encoding of A5 small integers.
2406           Correct define of "mux" instruction modifiers.
2407           Correct ordering of arguments and predicates of cmp_xy
2408         implementation with immediate arguments; like most other
2409         codes with an immediate, the immediate is the second, not
2410         the third argument.
2411
2412         * lib/jit_ia64-fpu.c: Actual implementation of the code
2413         to move to/from gpr to/from fpr, to implement varargs abi.
2414
2415         * lib/jit_ia64.c: Make fpr argument registers not allocatable
2416         as temporaries, no need for the extra checks when there are
2417         plenty registers.
2418
2419         * lib/jit_print.c, lib/lightning.c: Minor updates for the
2420         new movr_w_d, movr_d_w and movi_d_w codes.
2421
2422 2013-04-26 Paulo Andrade <pcpa@gnu.org>
2423
2424         * lib/jit_ia64-cpu.c, lib/jit_ia64-fpu.c: Correct code to
2425         also insert a stop to break an instruction group if a
2426         register is written more than once in the same group.
2427         This may happen if a register is argument and result of
2428         some lightning call (not a real instruction). The most
2429         common case should be code in the pattern:
2430                 movl rn=largenum
2431                 ...
2432                 mov rn=smallnum
2433         where "rn" would end up holding "largenum".
2434         But the problem possibly could happen in other circumstances.
2435
2436 2013-04-26 Paulo Andrade <pcpa@gnu.org>
2437
2438         * include/lightning/jit_ia64.h, lib/jit_ia64-cpu.c,
2439         lib/jit_ia64-fpu.c, lib/jit_ia64.c:
2440           Relocate JIT_Rn registers to the local registers, as, like
2441         float registers, div/rem and sqrt are implemented as function
2442         calls, and may overwrite non saved scratch registers.
2443           Change patch_at to receive a jit_code_t instead of a
2444         jit_node_t, so that it is easier to "inline" patches when
2445         some instruction requires complex code to implement, e.g.
2446         uneq and ltgt.
2447           Correct arguments to FMA and FMA like instructions that,
2448         due to a cut&paste error were passing the wrong argument
2449         to the related F- implementation function.
2450           Rewrite ltgt to return the proper result if one (or both)
2451         of the arguments is unordered.
2452
2453 2013-04-26 Paulo Andrade <pcpa@gnu.org>
2454
2455         * include/lightning/jit_ia64.h, include/lightning/jit_private.h,
2456         lib/jit_ia64-cpu.c, lib/jit_ia64-fpu.c, lib/jit_ia64.c,
2457         lib/lightning.c: Rework code to detect need of a "stop" to
2458         also handle predicates, as if a predicate is written, it
2459         cannot be read in the same instruction group.
2460           Use a single jit_regset_t variable for all registers when
2461         checking need for a stop (increment value by 128 for
2462         float registers).
2463           Correct wrong "subi" implementation, as the code executed
2464         is r0=im-r1, not r0=r1-im.
2465           Use standard lightning 6 fpr registers, and rework to
2466         use callee save float registers, that may be spill/reloaded
2467         in prolog/epilog. This is required because some jit
2468         instructions implementations need to call functions; currently
2469         integer div/mod and float sqrt, what may change the value of
2470         scratch float registers.
2471           Rework point of "sync" of branches that need to return a
2472         patch'able address, because the need for a "stop" before a
2473         predicate read causes all branches to be the instruction
2474         in slot 0, as there is no template to "stop" and branch
2475         in the same instruction "bundle".
2476
2477 2013-04-25 Paulo Andrade <pcpa@gnu.org>
2478
2479         * include/lightning/jit_ia64.h, lib/jit_ia64-cpu.c,
2480         lib/jit_ia64-fpu.c, lib/jit_ia64.c: New files implementing
2481         the basic infrastructure of an Itanium port. The code
2482         compiles and can generate jit for basic hello world like
2483         functions.
2484
2485         * check/lightning.c, configure.ac, include/lightning.h,
2486         include/lightning/Makefile.am, include/lightning/jit_private.h,
2487         lib/Makefile.am, lib/lightning.c: Update for the Itanium
2488         port.
2489
2490         * lib/jit_mips-cpu.c, lib/jit_mips.c: Correct typo and
2491         make the jit_carry register local to the jit_state_t.
2492         This matches code reviewed in the Itanium port, that
2493         should use the same base logic to handle carry/borrow.
2494
2495 2013-04-10 Paulo Andrade <pcpa@gnu.org>
2496
2497         * include/lightning/jit_private.h, lib/jit_arm.c,
2498         lib/jit_mips-cpu.c, lib/jit_mips.c, lib/jit_ppc-cpu.c,
2499         lib/jit_ppc.c, lib/jit_print.c, lib/jit_sparc-cpu.c,
2500         lib/jit_sparc.c, lib/jit_x86-cpu.c, lib/jit_x86.c,
2501         lib/lightning.c: Change all jit_regset macros to take
2502         a pointer argument, to avoid structure copies when
2503         adding a port to an architecture with more than 64
2504         registers.
2505
2506 2013-04-08 Paulo Andrade <pcpa@gnu.org>
2507
2508         * lib/jit_arm.c, lib/jit_ppc.c: Do not rely on __clear_cache
2509         aligning to the next page boundary the end argument. It may
2510         actually truncate it.
2511
2512 2013-03-29 Paulo Andrade <pcpa@gnu.org>
2513
2514         * include/lightning/jit_private.h, lib/jit_arm.c, lib/jit_memory.c,
2515         lib/jit_mips.c, lib/jit_ppc.c, lib/jit_sparc.c, lib/jit_x86.c,
2516         lib/lightning.c: Do not start over jit generation if can grow
2517         the code buffer with mremap without moving the base pointer.
2518
2519 2013-03-29 Paulo Andrade <pcpa@gnu.org>
2520
2521         * lib/jit_memory.c: Implement a simple memory allocation wrapper
2522         to allow overriding calls to malloc/calloc/realloc/free, as well
2523         as ensuring all memory containing pointers is zero or points to
2524         allocated memory.
2525
2526         * include/lightning.h, include/lightning/jit_private.h: Definitions
2527         for the memory allocation wrapper.
2528
2529         * lib/Makefile.am: Update for new jit_memory.c file.
2530
2531         * lib/jit_arm.c, lib/jit_disasm.c, lib/jit_mips.c, lib/jit_note.c,
2532         lib/jit_ppc.c, lib/jit_sparc.c, lib/jit_x86.c, lib/lightning.c:
2533         Use the new memory allocation wrapper code.
2534
2535 2013-03-22 Paulo Andrade <pcpa@gnu.org>
2536
2537         * configure.ac, include/lightning/jit_private.h, lib/lightning.c:
2538         Remove dependency on gmp. Only a simple bitmap was required, and
2539         that was not enough reason to force linking to gmp and possible
2540         complications caused by it.
2541
2542 2013-03-10 Paulo Andrade <pcpa@gnu.org>
2543
2544         * include/lightning.h: Add check for __powerpc__ defined
2545         in Linux, while Darwin defines __ppc__.
2546
2547         * include/lightning/jit_ppc.h: Adjust register definitions
2548         for Darwin 32 bit and Linux 64 bit ppc usage and/or ABI.
2549
2550         * include/lightning/jit_private.h: Add proper check for
2551         Linux __powerpc__ and an data definition for an workaround
2552         to properly handle code that starts with a jump to a "main"
2553         label.
2554
2555         * lib/jit_disasm.c: Add extra disassembler initialization
2556         for __powerpc64__.
2557
2558         * lib/jit_ppc-cpu.c: Add extra macros and functions, and
2559         correct/adapt previous ones to handle powerpc64.
2560
2561         * lib/jit_ppc-fpu.c: Adapt for 64 bit wordsize. Basically
2562         add conversion from/to int32/int64 and proper handling of
2563         load/store offsets too large for 32 bit.
2564
2565         * lib/jit_ppc.c: Add calls to 64 bit codes and adaptation
2566         for the PowerPC 64 bit Linux ABI.
2567
2568         * lib/jit_arm.c, lib/jit_mips.c, lib/jit_sparc, lib/jit_x86.c,
2569         lib/lightning.c: Correct off by one error when restarting jit
2570         of a function due to finding too late that needs to spill/reload
2571         some register. Problem was found by accident on a very special
2572         condition during PowerPC 64 code adaptation.
2573
2574 2013-03-08 Paulo Andrade <pcpa@gnu.org>
2575
2576         * check/lightning.c: Add missing ppc preprocessor definition.
2577
2578 2013-03-06 Paulo Andrade <pcpa@gnu.org>
2579
2580         * check/float.tst: Comment out the int to negative infinity
2581         test in mips for the moment because not all Loongson agrees
2582         on the result.
2583
2584         * lib/jit_disasm.c: Add a test instead of an assertion
2585         when loading symbols for disassembly due to a failure with
2586         a simple binutils build in Debian mipsel64.
2587
2588 2013-03-06 Paulo Andrade <pcpa@gnu.org>
2589
2590         * include/lightning/jit_private.h, lib/jit_arm-cpu.c,
2591         lib/jit_arm.c, lib/jit_disasm.c, lib/jit_mips-cpu.c,
2592         lib/jit_mips.c, lib/jit_note.c, lib/jit_ppc-cpu.c,
2593         lib/jit_ppc.c, lib/jit_print.c, lib/jit_sparc-cpu.c,
2594         lib/jit_sparc.c, lib/jit_x86-cpu.c, lib/jit_x86.c,
2595         lib/lightning.c: Add an extra structure for data storage
2596         during jit generation, and release it after generating
2597         jit, to reduce a bit memory usage, and also to make it
2598         easier to understand what data is available during
2599         jit runtime.
2600
2601 2013-03-06 Paulo Andrade <pcpa@gnu.org>
2602
2603         * lib/lightning.c: Make data and code buffer readonly.
2604
2605 2013-02-20 Paulo Andrade <pcpa@gnu.org>
2606
2607         * doc/body.texi: Fool proof validate the examples of what
2608         an assembly-language programmer would write and correct the
2609         wrong sparc example.
2610
2611 2013-02-19 Paulo Andrade <pcpa@gnu.org>
2612
2613         * doc/body.texi: Add back the SPARC code generation example.
2614
2615 2013-02-19 Paulo Andrade <pcpa@gnu.org>
2616
2617         * check/lightning.c: Remove state flag to work with partial
2618         sparc port, by just disassembling if there was incomplete
2619         code generation.
2620
2621         * jit_sparc-cpu.c: Correct wrong range check for immediate
2622         integer constants (off by one bit shift).
2623           Correct macro implementing equivalent "rd %y, rd" assembly.
2624           Implement qmul* and qdiv*.
2625
2626         * jit_sparc.c: Update for qmul* and qdiv* and remove logic
2627         to handle incomplete code generation during sparc port.
2628
2629 2013-02-18 Paulo Andrade <pcpa@gnu.org>
2630
2631         * check/float.tst: Add sparc to list of known NaN and +-Inf
2632         to integer conversion.
2633
2634         * check/lightning.c: Define __sparc__ to preprocessor in
2635         the sparc backend.
2636
2637         * include/lightning/jit_private.h: Correct wrong definition
2638         of emit_stxi_d, that has lived for a long time, but would
2639         cause problems whenever needing to spill/reload a float
2640         register.
2641
2642         * include/lightning/jit_sparc.h: Can only use %g2,%g3,%g4
2643         for scratch variables, as other "global" registers are
2644         reserved for the system, e.g. libc.
2645           Reorder float register naming to make it easier to
2646         access odd float registers, so that generating code for
2647         pusharg and getarg is easier for the IR.
2648
2649         * lib/jit_mips-cpu.c, lib/jit_ppc-cpu.c: Update to match
2650         new code in jit_sparc-cpu.c. It must call jit_get_reg
2651         with jit_class_nospill if using the register to move
2652         an unconditional branch address to it, as the reload
2653         will not happen (actually could happen in the delay
2654         slot...)
2655
2656         * lib/jit_sparc-cpu.c: Correct wrong macro definition for
2657         ldxr_s.
2658           Properly implement div* and implement rem. Div* needs
2659         to use the y register, and rem* needs to be synthesized.
2660           Correct b?sub* macro definitions.
2661
2662         * lib/jit_sparc-fpu.c: Correct reversed float to/from double
2663         conversion.
2664           Correct wrong jit_get_reg call asking for a gpr and then
2665         using the fpr with that number.
2666           Correct wrong branch displacement computation for
2667         conditional branches.
2668
2669         * lib/jit_sparc.c: Correct getarg_d and pushargi_d implementation.
2670           Add rem* entries to the switch converting IR to machine code.
2671
2672         * lib/lightning.c: Correct a problem detected when adding
2673         the jit_class_nospill flag to jit_get_reg, that was caused
2674         when having a branch to an "epilog" node, what would cause
2675         the code to think all registers in unknown state were live,
2676         while in truth, all registers in unknown state in the
2677         "just after return" point are actually dead.
2678
2679 2013-02-17 Paulo Andrade <pcpa@gnu.org>
2680
2681         * include/lightning/jit_sparc.h, lib/jit_sparc-cpu.c,
2682         lib/jit_sparc-fpu.c, lib/jit_sparc.c: New files implementing
2683         the basic framework of the sparc port.
2684
2685         * configure.ac, include/lightning.h, include/lightning/Makefile.am,
2686         include/lightning/jit_private.h, lib/jit_disasm.c: Update
2687         for the sparc port framework.
2688
2689         * lib/jit_mips.c: Correct reversed retr/reti logic.
2690
2691         * lib/jit_ppc.c: Correct misspelled __LITTLE_ENDIAN.
2692
2693         * lib/lightning.c: Always do byte hashing in hash_data, because
2694         the logic to "compress" strings causes large pointers to not
2695         be guaranteed aligned at 4 byte boundaries.
2696           Update for the sparc port framework.
2697
2698 2013-02-11 Paulo Andrade <pcpa@gnu.org>
2699
2700         * lib/jit_arm.c: Correct jit_pushargi_f in the arm hardfp abi.
2701         Most of the logic uses even numbered register numbers, so that
2702         a float and a double can be used in the same register, but
2703         the abi requires packing the float arguments, so jit_pushargi_f
2704         needs to allocate a temporary register to modify only the
2705         proper register argument (or be very smart to push two
2706         immediate arguments if applicable).
2707
2708 2013-02-11 Paulo Andrade <pcpa@gnu.org>
2709
2710         * include/lightning.h, lib/lightning.c: Implement the new
2711         jit_clear_state and jit_destroy_state calls. jit_clear_state
2712         releases all memory not required during jit_execution; that
2713         is, leaves only the mmap'ed data and code buffers allocated.
2714         jit_destroy_state releases the mmap'ed buffers as well as
2715         the jit_state_t object itself, that holds pointers to the
2716         code and data buffers, as well as annotation pointers (for
2717         disassembly or backtrace) in the data buffer.
2718
2719         * lib/jit_note.c: Correct invalid vector offset access.
2720
2721         * check/ccall.c, check/lightning.c, doc/ifib.c, doc/incr.c,
2722         doc/printf.c, doc/rfib.c, doc/rpn.c: Use the new jit_clear_state
2723         and jit_destroy_state calls, to demonstrate the new code to
2724         release all jit memory.
2725
2726         * doc/body.texi: Add basic documentation and usage description
2727         of jit_clear_state and jit_destroy_state.
2728
2729 2013-02-11 Paulo Andrade <pcpa@gnu.org>
2730
2731         * include/lightning/jit_private.h, lib/jit_note.c, lib/lightning.c:
2732           Store all annotation information in the mmap'ed area reserved for
2733         read only data. This adds code to not allocate memory for jit_note_t
2734         objects, and to relocate jit_line_t objects and its contents after
2735         calculating annotation information. The jit_line_t objects are
2736         relocated because it is not possible to always calculate before
2737         hand data layout because note information may be extended or
2738         redundant entries removed, as well as allowed to be added in
2739         non sequential order.
2740           A bug was also corrected in _jit_set_note, that was causing it
2741         to allocate new jit_line_t objects when not needed. It was still
2742         working correctly, but allocating way more memory than required.
2743
2744 2013-02-05 Paulo Andrade <pcpa@gnu.org>
2745
2746         *include/lightning.h, lib/lightning.c: Add the new jit_live code
2747         to explicitly mark a register as live. It is required to avoid
2748         assuming functions always return a value in the gpr and fpr return
2749         register, and to avoid the need of some very specialized codes
2750         that vary too much from backend to backend, to instruct the
2751         optimization code the return register is live.
2752
2753         * lib/jit_arm.c, lib/jit_mips.c, lib/jit_ppc.c, lib/jit_print.c,
2754         lib/jit_x86.c: Update for the new jit_live code.
2755
2756         * check/ret.ok, check/ret.tst: New files implementing a simple
2757         test case that would previously fail at least in ix86/x86_64.
2758
2759         * check/Makefile.am: Update for new "ret" test case.
2760
2761 2013-02-05 Paulo Andrade <pcpa@gnu.org>
2762
2763         * lib/jit_ppc-cpu.c, lib/jit_ppc.c: Validate and correct
2764         problems in the qmul and qdiv ppc implementation.
2765
2766 2013-02-04 Paulo Andrade <pcpa@gnu.org>
2767
2768         * include/lightning.h, include/lightning/jit_private.h,
2769         lib/jit_arm-cpu.c, lib/jit_arm.c, lib/jit_mips-cpu.c,
2770         lib/jit_mips.c, lib/jit_ppc-cpu.c, lib/jit_ppc.c,
2771         lib/jit_x86-cpu.c, lib/jit_x86.c, lib/lightning.c:
2772         Implement the new qmul and qdiv instructions that return signed
2773         and unsigned lo/hi multiplication result and div/rem division result.
2774         These should be useful for jit translation of code that needs to
2775         know if a multiplication overflows (no branch opcode added) or if
2776         a division is exact (easy check if remainder is zero).
2777
2778         * check/lightning.c, lib/jit_print.c, check/Makefile.am,
2779         check/all.tst: Update for the new qmul and qdiv instructions.
2780
2781         * check/qalu.inc, check/qalu_div.ok, check/qalu_div.tst,
2782         check/qalu_mul.ok, check/qalu_mul.tst: New files implementing
2783         simple test cases for qmul and qdiv.
2784
2785 2013-01-30 Paulo Andrade <pcpa@gnu.org>
2786
2787         * doc/body.texi: Correct "jmpi" description that incorrectly
2788         told it was possible to pass any address as jump target. The
2789         only way to do that is "movi+jmpr".
2790
2791 2013-01-30 Paulo Andrade <pcpa@gnu.org>
2792
2793         * lib/jit_x86-cpu.c: Correct undefined behavior code.
2794         http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56143
2795
2796 2013-01-29 Paulo Andrade <pcpa@gnu.org>
2797
2798         * configure.ac: Use AC_CONFIG_HEADERS instead of AC_CONFIG_HEADER
2799         to have HAVE_CONFIG_H defined with latest aclocal.
2800
2801         * include/lightning/jit_private.h, lib/lightning.c: Add new
2802         abstraction to use an heuristic to calculate amount of space
2803         required for jit generation, and code to reallocate buffer if
2804         did miscalculate it.
2805
2806         * lib/jit_arm.c, lib/jit_mips.c, lib/jit_ppc.c, lib/jit_x86.c:
2807         Update to use new code to estimate and resize of required buffer
2808         for jit code.
2809
2810         * lib/jit_x86-cpu.c: Minor cosmetic change to avoid adding a
2811         non required rex prefix when calling a function pointer stored
2812         in a register.
2813
2814 2013-01-24 Paulo Andrade <pcpa@gnu.org>
2815
2816         * check/Makefile.am: "make debug" target should pass only
2817         the main test tool program as argument for running gdb
2818
2819         * configure.ac: Add the --enable-assertions options.
2820
2821         * doc/Makefile.am, doc/body.texi, doc/lightning.texi:
2822         Major rewrite of the documentation to match the current
2823         implementation.
2824
2825         * doc/version.texi: Automatic date update.
2826
2827         * doc/ifib.c, doc/incr.c, doc/printf.c, doc/rfib.c, doc/rpn.c:
2828         Implementation of the documentation examples, that are also
2829         compiled during a normal build.
2830
2831         * doc/p-lightning.texi, doc/porting.texi, doc/toc.texi,
2832         doc/u-lightning.texi, doc/using.texi: These files were
2833         renamed in the documentation rewrite, as the documentation
2834         was significantly trimmed due to full removal of the porting
2835         chapters. Better porting documentation should be added but
2836         for the moment it was just removed the documentation not
2837         matching the implementation.
2838
2839 2013-01-18 Paulo Andrade <pcpa@gnu.org>
2840
2841         * lib/jit_note.c: Correct bounds check and wrong code keeping
2842         a pointer that could be changed after a realloc call.
2843
2844 2013-01-18 Paulo Andrade <pcpa@gnu.org>
2845
2846         * check/3to2.tst, check/add.tst, check/allocai.tst, check/bp.tst,
2847         check/call.tst, check/ccall.c, check/clobber.tst, check/divi.tst,
2848         check/fib.tst, check/ldsti.tst, check/ldstr-c.tst, check/ldstr.tst,
2849         check/ldstxi-c.tst, check/ldstxi.tst, check/ldstxr-c.tst,
2850         check/ldstxr.tst, check/lightning.c, check/rpn.tst, check/stack.tst,
2851         check/varargs.tst, include/lightning.h,
2852         include/lightning/jit_private.h, lib/jit_arm.c, lib/jit_disasm.c,
2853         lib/jit_mips.c, lib/jit_note.c, lib/jit_ppc.c, lib/jit_print.c,
2854         lib/jit_x86.c, lib/lightning.c: Extend the "jit_note" abstraction
2855         with the new "jit_name" call, that receives a string argument, and
2856         should usually be called to mark boundaries of functions of code
2857         generating jit (that is, it is not expected that the language
2858         generating jit map its functions to jit functions).
2859
2860 2013-01-17 Paulo Andrade <pcpa@gnu.org>
2861
2862         * check/add.tst, check/allocai.tst, check/bp.tst, check/divi.tst,
2863         check/fib.tst, check/lightning.c, include/lightning/jit_arm.h,
2864         include/lightning/jit_mips.h, include/lightning/jit_ppc.h,
2865         include/lightning/jit_private.h, include/lightning/jit_x86.h:
2866         Make JIT_RET, JIT_FRET and JIT_SP private. These should not be
2867         used in any operations due to frequently having special
2868         constraints (usually JIT_FRET). JIT_FP must be made available
2869         because it must be used as the base register to access stack
2870         space allocated with jit_allocai.
2871
2872 2013-01-14 Paulo Andrade <pcpa@gnu.org>
2873
2874         * include/lightning.h, lib/lightning.c: Add an extra align
2875         argument to the jit_data call (that should be made private),
2876         so that it should not align strings at 8 bytes.
2877           Correct the jit_note call to include the null ending byte
2878         when adding label/note names to the "jit data section".
2879
2880 2013-01-11 Paulo Andrade <pcpa@gnu.org>
2881
2882         * lib/jit_note.c: New file implementing a simple string+integer
2883         annotation, that should be used to map filename and line number
2884         to offsets in the generated jit.
2885
2886         * include/lightning.h, lib/lightning.c: Update for the new
2887         note code.
2888           Add an extra mandatory argument to init_jit, that is used
2889         as argument to bfd_openr.
2890           Change from generic void* to char* the argument to jit_note
2891         and add an extra integer argument, to map to filename and
2892         line number.
2893
2894         * check/ccall.c, check/lightning.c, include/lightning/jit_private.h,
2895         lib/jit_arm.c, lib/jit_disasm.c, lib/jit_mips.c, lib/jit_ppc.c,
2896         lib/jit_print.c, lib/jit_x86.c: lib/Makefile.am: Update for the
2897         new annotation code.
2898
2899         * configure.ac, check/Makefile.am: Update to work with latest
2900         automake.
2901
2902 2013-01-09 Paulo Andrade <pcpa@gnu.org>
2903
2904         * include/lightning.h, lib/jit_arm.c, jit_mips-fpu.c,
2905         lib/jit_mips.c, lib/jit_print.c, lib/jit_x86.c, lib/lightning.c:
2906         Remove the jit_code_getarg_{f,d} and jit_code_pusharg{i,r}_{f,d}
2907         calls, replacing them with the new, internal only, jit_movr_w_f,
2908         jit_mov{r,i}_f_w, jit_movr_ww_d, and jit_mov{i,r}_d_ww, that
2909         better describe the operation being done, and allow removing
2910         the hackish code to detect special conditions for arm when
2911         moving from/to vfp from/to a grp register pair.
2912         Rename jit_code_retval_{f,d} to jit_code_x86_retval_{f,d} as
2913         it is specific to 32 bit x86, and used to move abi return
2914         value in x87 register to a sse register.
2915
2916 2013-01-05 Paulo Andrade <pcpa@gnu.org>
2917
2918         * check/cccall.c, check/ccall.ok: New test case to validate
2919         interleaved calls from/to C code and jit.
2920
2921         * check/Makefile.am: Update for the new ccall test case.
2922
2923         * include/lightning.h, lib/lightning.c: Add the new jit_address
2924         call that returns the real/final address of a "note" in the
2925         generated jit. It requires a jit_node_t as returned by the
2926         jit_note call, and is only valid after calling jit_emit.
2927           Add an intermediate solution to properly handle arm
2928         soft and softfp modes that move a double to an integer register
2929         pair. Currently it just adds extra tests for the condition,
2930         but the proper solution should be to have extra lightning
2931         codes for these conditions, codes which should be only used
2932         by the backends that need it, and merged with the existing
2933         jit_pusharg*_{f,d}.
2934
2935         * include/lightning/jit_private.h: Add new jit_state_t flag
2936         to know it finished jit_emit, so that calls to jit_address
2937         are valid.
2938
2939         * lib/jit_mips.c: Correct abi implementation so that the
2940         new ccall test case pass. Major problem was using
2941         _jit->function.self.arg{i,f} as boolean values, but that
2942         would cause lightning.c:patch_registers() to incorrectly
2943         assume only one register was used as argument when calling
2944         jit_regarg_p(); _jit->function.self.arg{i,f} must be the
2945         number of registers used as arguments (in all backends).
2946
2947         * lib/jit_x86.c: Add workaround, by marking %rax as used,
2948         to a special condition, when running out of registers and the
2949         allocator trying to spill and reload %rax, but %rax was used
2950         as a pointer to a function, what would cause the reload to
2951         destroy the return value. This condition can be better
2952         generalized, but the current solution is good enough.
2953
2954         * include/lightning/jit_ppc.h, lib/jit_ppc-cpu.c, lib/jit_ppc.c:
2955         Rewrite logic to handle arguments, as the original code was
2956         written based on a SysV pdf about the generic powerpc ABI,
2957         what did "invent" a new abi for the previous test cases, but
2958         failed in the new ccall test in Darwin PPC. Now it properly
2959         handles 13 float registers for arguments, as well as proper
2960         computation of stack offsets when running out of registers
2961         for arguments.
2962
2963 2013-01-02 Paulo Andrade <pcpa@gnu.org>
2964
2965         * check/float.tst: Correct test case to match ppc also
2966         converting positive infinity to 0x7fffffff.
2967
2968         * lib/jit_arm-swf.c: Correct typos with double underscores.
2969
2970         * lib/lightning.c: Correct remaining wrong reverse jump logic.
2971
2972 2012-12-29 Paulo Andrade <pcpa@gnu.org>
2973
2974         * lib/lightning.c: Correct both, wrong and confusing logic
2975         to compute the reverse of a jump. Now it properly matches
2976         C semantics for "eq" (==) and "ne" (!=) and correct computation
2977         of reverse of "uneq" as "gt".
2978
2979         * check/branch.tst: Update "ne" float branch check that
2980         previously happened to be wrongly tested with a NaN argument.
2981
2982 2012-12-29 Paulo Andrade <pcpa@gnu.org>
2983
2984         * check/float.ok, check/float.tst: New test cases implementing
2985         extensive validation of float comparison and branch code
2986         generation as well as integer conversion, involving NaN and
2987         [+-]Inf.
2988
2989         * lib/jit_arm-swf.c, lib/jit_x86-sse.c, lib/jit_x86-x87.c:
2990         Correct bugs found by new float test case.
2991
2992         * lib/jit_x86.c: Correct cut&paste error added in commit to
2993         convert jit_arg* return value to a jit_node_t*, that would
2994         cause it to not properly handle double arguments in ix86.
2995
2996         * check/Makefile.am: Update for the new test case.
2997
2998 2012-12-28 Paulo Andrade <pcpa@gnu.org>
2999
3000         * check/lightning.c, include/lightning.h, lib/jit_arm.c,
3001         lib/jit_mips.c, lib/jit_ppc.c, lib/jit_print.c, lib/jit_x86.c,
3002         lib/lightning.c: Change return value of jit_arg{,_f,_d} to
3003         a jit_node_t* object, that should be used as argument to
3004         jit_getarg_{c,uc,s,us,i,ui,l,f,d}. This just requires changing
3005         from jit_int32_t to jit_pointer_t (or jit_node_t*) the "handle"
3006         for the getarg calls, with the benefit that it makes it easy
3007         to implement patching of the stack address of non register
3008         arguments, this way allowing to implement variable size stack
3009         frames if applicable; useful if there are too many registers and
3010         jit functions uses only a few callee save registers.
3011
3012 2012-12-27 Paulo Andrade <pcpa@gnu.org>
3013
3014         * lib/jit_arm.c, lib/jit_mips-cpu.c, lib/jit_mips.c: Correct
3015         regressions when patching jit_calli for a forward function.
3016
3017         * lib/jit_ppc-cpu.c: Correct wrong arguments to ANDI opcode
3018         in jit_getarg_u{c,s} implementation.
3019
3020 2012-12-23 Paulo Andrade <pcpa@gnu.org>
3021
3022         * check/call.ok, check/call.tst: New test cases to validate
3023         simple typed argument and return values in function calls.
3024
3025         * check/lightning.c: Properly handle jit_movi of labels for
3026         backward and forward code labels.
3027
3028         * check/Makefile.am: Update for new test case.
3029
3030 2012-12-23 Paulo Andrade <pcpa@gnu.org>
3031
3032         * check/carry.ok, check/carry.tst: New test case to validate
3033         carry condition handling.
3034
3035         * check/Makefile.am: Update for new test case.
3036
3037 2012-12-22 Paulo Andrade <pcpa@gnu.org>
3038
3039         * lib/jit_ppc-cpu.c, lib/jit_ppc.c: Implement logic for
3040         jit_htonr for big endian, so that ppc (big endian) pass the
3041         new clobber.tst test case.
3042
3043 2012-12-22 Paulo Andrade <pcpa@gnu.org>
3044
3045         * lib/jit_arm.c: Correct use of wrong argument offset
3046         variable in armv7l or float/double argument for varargs
3047         function in armv7hl.
3048           Correct jit_getarg* logic in software float mode to
3049         match expected behavior in other backends, that is, if
3050         a function is not called, it is safe to use a few lightning
3051         calls before a next jit_getarg* call, as done in the test
3052         case check/stack.tst. The proper solution should be to
3053         extend the parser in lib/lightning.c to check if there is
3054         some float operation that will call some (libgcc?) function,
3055         but software float arm should be a very uncommon backend for
3056         lightning, so, just load the already in place arguments
3057         saved to stack, assuming the register argument was clobbered
3058         (what should not be the case most times...).
3059
3060 2012-12-22 Paulo Andrade <pcpa@gnu.org>
3061
3062         * check/clobber.ok, check/clobber.tst: New test case doing
3063         extensive validation tests to ensure registers not used in
3064         a operation are not clobbered.
3065
3066         * check/Makefile.am: Update for new test case.
3067
3068 2012-12-21 Paulo Andrade <pcpa@gnu.org>
3069
3070         * lib/lightning.c: Partially rewrite/revert code to compute
3071         initial register live state at the start of a basic block.
3072         The original logic was corrupted when adding optimizations
3073         to do as few computations as possible in jit_update. The
3074         reglive field must be always a known set of live registers
3075         at the start of a basic block. The value that was incorrect
3076         was the regmask field, that must be the set of registers
3077         that are in unknown state, because they are not known live,
3078         neither set (or possibly not set) in the basic block, and
3079         *must* store the state at the start of the basic block.
3080
3081 2012-12-20 Paulo Andrade <pcpa@gnu.org>
3082
3083         * include/lightning/jit_ppc.h: Correct mismatch of JIT_F{1,5}
3084         with enum codes, that were correct, and returned by jit_f().
3085
3086         * lib/jit_ppc-cpu.c, lib/jit_ppc-fpu.c, lib/jit_ppc.c: Properly
3087         implement and better describe values when generating stack
3088         frames.
3089
3090 2012-12-18 Paulo Andrade <pcpa@gnu.org>
3091
3092         * check/stack.ok, check/stack.tst: New files to test data
3093         integrity on a deep chain of stack frames.
3094
3095         * lib/jit_arm.c, lib/jit_arm-cpu.c, lib/jit_mips.c,
3096         lib/jit_mips-cpu.c, lib/jit_ppc.c, lib/jit_ppc-cpu.c,
3097         lib/jit_x86.c, lib/jit_x86-cpu.c: Calculate _jit->function->stack
3098         in the emit stage, otherwise it will calculate it wrong if
3099         need to jit_allocai space to spill registers.
3100
3101         * lib/lightning.c: Correct wrong offset when updating the
3102         "current" jit function pointer in the code that may need to
3103         allocate stack space to spill registers.
3104
3105         * check/lightning.c: Correct off by one data space check.
3106
3107         * check/Makefile.am: Update for new test case.
3108
3109 2012-12-17 Paulo Andrade <pcpa@gnu.org>
3110
3111         * check/fop_abs.ok, check/fop_abs.tst, check/fop_sqrt.ok,
3112         check/fop_sqrt.tst: New files implementing simple test cases
3113         for the extra float operations.
3114
3115         * check/Makefile.am: Update for new test cases.
3116
3117         * check/alu.inc: Add an extra macro to check for unordered
3118         equality on tests where it is expected to use NaN as an
3119         argument.
3120
3121         * check/lightning.c: Minor change for proper/common argument
3122         syntax handling ommiting arguments to options.
3123
3124 2012-12-17 Paulo Andrade <pcpa@gnu.org>
3125
3126         * check/Makefile.am: Automatically generate pattern list
3127         of tests with alternate jit generation options. This should
3128         prevent typos and needing to change multiple places after
3129         a change.
3130
3131 2012-12-14 Paulo Andrade <pcpa@gnu.org>
3132
3133         * check/lightning.c: Remove the ".cpu name value" syntax,
3134         as it was not able to do proper changes before the jit
3135         internal data structure was initialized. Now it supports
3136         several getopt options to force using different jit
3137         generation options, effectively replacing the previous
3138         syntax.
3139
3140         * check/run-test: Add simple extra logic to handle differently
3141         named test scripts, used to test things like x87 coprocessor
3142         in ix86, and arm instruction set or software float in armv7l.
3143
3144         * configure.ac: Add some AC_RUN_IFELSE calls to figure at
3145         compile time if can test different code generation options,
3146         and update Makefile generation accordingly.
3147
3148         * check/Makefile.am, lib/jit_arm.c, lib/jit_x86.c: Update to
3149         properly work with the test tool updating the jit_cpu global
3150         information.
3151
3152         * check/check.arm.sh, check/check.swf.sh, check/check.x87.sh:
3153         New wrapper files passing -mthumb=0, mvfp=0 and -mx87=1 to
3154         the test tool, if applicable, so that it can validate alternate
3155         code generation options on test hosts that support them.
3156
3157 2012-12-14 Paulo Andrade <pcpa@gnu.org>
3158
3159         * lib/jit_x86-x87.c, lib/jit_x86.c: Correct test cases in ix86
3160         when using the x87 coprocessor instead of sse2+.
3161
3162 2012-12-14 Paulo Andrade <pcpa@gnu.org>
3163
3164         * include/lightning.h, include/lightning/jit_private.h,
3165         lib/jit_arm.c, lib/jit_mips.c, lib/jit_ppc.c, lib/jit_x86.c,
3166         lib/lightning.c: Make jit_ellipsis implementation not
3167         backend specific. It is not intended to handle va_list
3168         like objects at runtime, as jit_arg* and jit_getarg*
3169         return constant values resolved at parse time, so, effectively
3170         it is not possible to create printf like jit functions, as
3171         there is no va_start, va_arg, va_end, etc, abstraction. This
3172         limitation should be kept for the sake of making new ports
3173         easier.
3174
3175 2012-12-14 Paulo Andrade <pcpa@gnu.org>
3176
3177         * include/lightning.h, lib/lightning.c: Add two extra wrapper
3178         functions to avoid need for excess pointer to/from word casts.
3179
3180         * check/lightning.c: Only need for pointer to/from word cast
3181         now is jit_movi, update accordingly.
3182
3183 2012-12-13 Paulo Andrade <pcpa@gnu.org>
3184
3185         * check/varargs.ok, check/varargs.tst: New test cases implementing
3186         simple varargs calls with a large amount of arguments to exercise
3187         excess arguments on stack.
3188
3189         * include/lightning.h: Include config.h if HAVE_CONFIG_H is
3190         defined.
3191
3192         * lib/jit_arm.c: Allocate a fpr register, not a gpr one for
3193         temporary when pushing varargs arguments in the stack.
3194
3195         * lib/jit_arm-swf.c: Correct code changing the wrong offset
3196         in jit_absr_d and jit_negr_d in software float.
3197
3198         * lib/jit_mips.c: Correct calculation of offsets of arguments
3199         on stack.
3200
3201         * lib/jit_ppc.c: Correct bogus logic for "next" offset of arguments
3202         on stack and adjust for fixed offset of stack arguments.
3203
3204 2012-12-12 Paulo Andrade <pcpa@gnu.org>
3205
3206         * include/lightning.h, lib/jit_arm.c, lib/jit_mips.c,
3207         lib/jit_ppc.c, lib/jit_x86.c, lib/lightning.c: Change jit_prepare
3208         to no longer receive an argument. If receiving an argument, it
3209         should be an ABI specifier, not a boolean if varargs or not,
3210         and add the new jit_ellipsis call, to specify where the
3211         ellipsis is in the C prototype of the function being called.
3212         Note that currently it is not supported to define varargs
3213         functions and it will be ignored if calling jit_ellipsis not
3214         in a prepare/finish* block, but this should be addressed.
3215
3216         * check/allocai.tst, check/alu_add.tst, check/alu_and.tst,
3217         check/alu_com.tst, check/alu_div.tst, check/alu_lsh.tst,
3218         check/alu_mul.tst, check/alu_neg.tst, check/alu_or.tst,
3219         check/alu_rem.tst, check/alu_rsh.tst, check/alu_sub.tst,
3220         check/alu_xor.tst, check/alux_add.tst, check/alux_sub.tst,
3221         check/bp.tst, check/branch.tst, check/cvt.tst, check/divi.tst,
3222         check/fib.tst, check/ldsti.tst, check/ldstr-c.tst,
3223         check/ldstr.tst, check/ldstxi-c.tst, check/ldstxi.tst,
3224         check/ldstxr-c.tst, check/ldstxr.tst, check/rpn.tst,
3225         check/lightning.c: Update for the change to jit_prepare and
3226         addition of jit_ellipsis.
3227
3228 2012-12-11 Paulo Andrade <pcpa@gnu.org>
3229
3230         * lib/jit_ppc-cpu.c: Make movr a function that checks arguments
3231         so that other code can safely assume it is a noop if src and dst
3232         are the same register.
3233           Implement rem{r,i}{,_u} as a div{,u}/mul/sub.
3234           Correct ANDIS, ORIS and XORIS calls to cast the argument to
3235         unsigned before the shift to avoid an assertion if the argument
3236         had the topmost bit set.
3237           Implement lshi, rshi and rshi_u as functions to test for a
3238         zero argument, that would otherwise trigger an assertion when
3239         computing the shift value.
3240           Do a simple implementation of bm{s,c}{r,i} with a temporary,
3241         "andr" of arguments and jump based on comparison with zero.
3242           Correct typo in ldxi_c.
3243
3244         * lib/jit_ppc-fpu.c: Correct wrong arguments to FDIV* and STF*.
3245
3246         * lib/jit_ppc.c: Correct wrong check for 6 instead of 8 integer
3247         arguments in registers. If calling a varargs function and
3248         passing a float or double argument, also either store the
3249         value in the stack or in integer registers, as varargs functions
3250         do not fetch it from float registers.
3251           Add "case" for new functions and incorrectly missing ones.
3252           Call libgcc's __clear_cache, that should know what to do
3253         if the hardware needs flushing cache before execution.
3254
3255         * lib/lightning.c: Do a simple/trivial logic in jit_regset_scan1,
3256         that should make it easier for the compiler to optimize it, and
3257         that also corrects the previously wrong code for big endian, and
3258         that was causing problems in ppc due to not saving all callee save
3259         registers as it was not "finding" them in the regset due to the
3260         little endian assumption bug.
3261
3262 2012-12-11 Paulo Andrade <pcpa@gnu.org>
3263
3264         * configure.ac: Only default to using the builtin disassembler
3265         if on GNU/Linux. This should be temporary, due to requiring
3266         /proc/self/exe.
3267           Correctly check $target_cpu for powerpc.
3268
3269         * include/lightning/jit_ppc.h: Correctly implement jit_v_num.
3270
3271         * include/lightning/jit_private.h: Declare proper prototype
3272         for jit_init_debug and jit_finish_debug.
3273
3274         * lib/jit_ppc-cpu.c: Remove code to save/restore callee save
3275         float registers, as it is not required since those float
3276         registers are not usable currently.
3277           Change prolog and epilog generation to, at least comparing
3278         code, match what gcc generates in "gcc -O0", but it is still
3279         failing in Darwin PPC, apparently due to the __clear_cache
3280         call not being enough, as frequently it will also fail to
3281         execute, and the code buffer is all zeroes.
3282
3283         * lib/lightning.c: Do not fail in jit_regset_scan1 calls due
3284         to passing 64 as argument on computers with 64 registers.
3285
3286 2012-12-10 Paulo Andrade <pcpa@gnu.org>
3287
3288         * lib/jit_mips-cpu.c: Correct all current test cases.
3289           Call the "xori" not the "XORI" macro for jit_xori implementation,
3290         as the XORI macro handles only 16 bit unsigned values.
3291           Call the "movr" macro, not the "movi" macro in the special
3292         case of adding or subtracting zero.
3293           Use the proper temporary register in the jit_andr implementation.
3294
3295 2012-12-09 Paulo Andrade <pcpa@gnu.org>
3296
3297         * check/alu.inc, check/alu_add.ok, check/alu_add.tst,
3298         check/alu_and.ok, check/alu_and.tst, check/alu_com.ok,
3299         check/alu_com.tst, check/alu_div.ok, check/alu_div.tst,
3300         check/alu_lsh.ok, check/alu_lsh.tst, check/alu_mul.ok,
3301         check/alu_mul.tst, check/alu_neg.ok, check/alu_neg.tst,
3302         check/alu_or.ok, check/alu_or.tst, check/alu_rem.ok,
3303         check/alu_rem.tst, check/alu_rsh.ok, check/alu_rsh.tst,
3304         check/alu_sub.ok, check/alu_sub.tst, check/alu_xor.ok,
3305         check/alu_xor.tst, check/alux_add.ok, check/alux_add.tst,
3306         check/alux_sub.ok, check/alux_sub.tst, check/branch.ok,
3307         check/branch.tst: New test cases for arithmetic and branch
3308         tests.
3309
3310         * check/Makefile.am: Update for new test cases.
3311
3312         * include/lightning/jit_private.h: Make the jit_reg_free_p
3313         macro shared by all backends. Previously was added for the
3314         arm backend, but is useful in the x86_64 backend when checking
3315         state of "special purpose register".
3316         Also add the new jit_class_named register class, that must be
3317         or'ed with the register value if calling jit_get_reg expecting
3318         an specific value, because the specific register value may be
3319         zero, that previously was treated as no register requested.
3320
3321         * lib/jit_arm-cpu.c: Correct argument order for T2_MVN.
3322
3323         * lib/jit_arm-swf.c: Call the proper function for double
3324         divide. The "software float" implementation just calls
3325         libgcc functions.
3326
3327         * lib/jit_arm.c: Return float/double values in the float
3328         register if using the hard float ABI.
3329
3330         * lib/jit_x86-cpu.c: Change the can_sign_extend_int_p macro
3331         to not include -0x80000000L, because there is code that
3332         "abuses" it and thinks it can negate the immediate value
3333         after calling that macro.
3334           Correct implementation of jit_subi that had a wrong code
3335         patch logic doing subtraction with reversed arguments.
3336           Correct REX prefix calculation in the jit_muli implementation.
3337           Correct logic to get/unget %*ax and %*dx registers in divremr
3338         and divremi.
3339           Correct divremi that was using the symbolic, unique %*ax
3340         value in on place (not using the _REGNO name suffix).
3341           Correct cut&paste error causing it to use "xor" instead of
3342         "or" in one code path of the jit_ori implementation.
3343           Correct several flaws when clobbering registers and/or when
3344         one of the arguments was %*cx in the rotshr wrapper function
3345         implementing most shift operations.
3346
3347         * lib/lightning.c: No longer expect that the backend be smart
3348         enough to know what to do when asking for a named register
3349         if that register is already an argument or is live. It fails
3350         if it is an argument, or if register is live, fails if cannot
3351         spill.
3352           No longer incorrectly assume that eqr_{f,d} and ltgr_{f,d} are
3353         safe to inverse value tests in jump thread optimization.
3354
3355 2012-12-05 Paulo Andrade <pcpa@gnu.org>
3356
3357         * check/Makefile.am, check/cvt.ok, check/cvt.tst: Add new
3358         "cvt" test case to test conversion from/to int/float types.
3359
3360         * check/lightning.c: Only define truncr_{f,d}_l in 64 bit mode.
3361
3362         * include/lightning.h: Correct typo that caused it to define
3363         jit_truncr_{f,d}_l in 32 bit mode.
3364
3365         * lib/jit_arm-cpu.c: Avoid assertion failure in the signed/unsigned
3366         extend opcodes generation as it shares an interface for 3 argument
3367         opcode generation.
3368
3369         * lib/jit_x86-cpu.c: Correct wrong argument passed to
3370         jit_unget_reg in the andi implementation and wrong byte
3371         unsigned extend code generation.
3372
3373         * lib/jit_x86-sse.c: Correct conversion from "word" to float or
3374         double as is dependent on wordsize.
3375
3376 2012-12-05 Paulo Andrade <pcpa@gnu.org>
3377
3378         * check/ldstr-c.ok, check/ldstr-c.tst, check/ldstxi-c.ok,
3379         check/ldstxi-c.tst, check/ldstxr-c.ok, check/ldstxr-c.tst:
3380         New test case files testing load clobbering the base and/or
3381         index register;
3382
3383         * check/ldst.inc: New file with common definition for all the
3384         ldst* test cases.
3385
3386         check/Makefile.am, check/ldsti.tst, check/ldstr.tst,
3387         check/ldstxi.tst, check/ldstxr.tst: Update for new common
3388         definitions file and new register clobber ldst tests.
3389
3390 2012-12-05 Paulo Andrade <pcpa@gnu.org>
3391
3392         * lib/jit_mips-fpu.c: Correct wrong register order in stxr_{f,d}
3393         in the mips backend.
3394
3395 2012-12-05 Paulo Andrade <pcpa@gnu.org>
3396
3397         * lib/jit_arm-vfp.c: Correct regression found in armv7l with
3398         latest test cases.
3399
3400 2012-12-05 Paulo Andrade <pcpa@gnu.org>
3401
3402         * check/ldstxi.tst, check/ldstxr.tst: Correct wrong argument
3403         order for 32 bit mode tests.
3404
3405         * configure.ac: Correct check for ix86 target_cpu.
3406
3407 2012-12-05 Paulo Andrade <pcpa@gnu.org>
3408
3409         * check/ldstr.ok, check/ldstr.tst, check/ldsti.ok,
3410         check/ldsti.tst, check/ldstxr.ok, check/ldstxr.tst,
3411         check/ldstxi.ok, check/ldstxi.tst:
3412         New test case files exercising a very large amount of
3413         register combinations to verify load/store implementation.
3414
3415         * check/Makefile.am: Update for new test cases.
3416
3417         * lib/jit_x86-cpu.c: Correct wrong argument order when
3418         computing REX prefix for {ld,st}r_T codes;
3419
3420 2012-12-04 Paulo Andrade <pcpa@gnu.org>
3421
3422         * lib/jit_mips-fpu.c, lib/jit_mips.c: Implement missing mips
3423         jit_sqrtr_{f,d} codes.
3424
3425         * check/all.tst, include/lightning.h, lib/jit_print.c: Change
3426         declaration order and call order in all.tst of {add,sub}c and
3427         {add,sub}x. *c must be called before to set the carry and *x
3428         second to use the carry and keep it set. The wrong call order
3429         was causing all.tst to fail in mips, where a register is
3430         allocated to keep a global carry state.
3431
3432 2012-12-04 Paulo Andrade <pcpa@gnu.org>
3433
3434         * include/lightning/jit_mips.h, lib/jit_mips-cpu.c,
3435         lib/jit_mips-fpu.c, lib/jit_mips.c: Correct float/double
3436         argument handling and make the mips backend pass the initial
3437         test cases.
3438
3439         * include/lightning.h, ib/jit_print.c, lib/lightning.c:
3440         Add extra enum values for argument handling functions that
3441         could not be abstracted to the current codes, that is, when
3442         float values need to move from/to gpr from/to fpr. It would
3443         be more tempting to add such primitives, but they would have
3444         wordsize limitations, and it is not expected to add codes
3445         with one gpr argument for 64 bit and two for 32 bit.
3446
3447         * lib/jit_ppc.c: Check _jit->function before calling jit_epilog()
3448         to avoid a runtime exception.
3449
3450 2012-12-04 Paulo Andrade <pcpa@gnu.org>
3451
3452         * include/lightning/jit_mips.h, lib/jit_mips.c: Update to
3453         make the mips backend compile in a qemu image.
3454
3455         * lib/jit_ppc.c: Minor adaptations to help in having the
3456         ppc backend compilable.
3457
3458 2012-12-03 Paulo Andrade <pcpa@gnu.org>
3459
3460         * configure.ac, include/lightning/jit_private.h, lib/jit_arm-cpu.c,
3461         lib/jit_arm-swf.c, lib/jit_arm.c, check/Makefile.am: Correct
3462         implementation of the arm backend port to build and pass the
3463         current test cases. Tested on armv7 with softfp abi.
3464
3465         * lib/jit_disasm.c: Rename and change prototype of static
3466         disassemble function as in the arm backend it is required
3467         to access state information stored in the jit_state_t object.
3468
3469         * check/3to2.tst, check/add.tst: Correct test case code assuming
3470         JIT_RO and JIT_RET are the same, and even if they are the same,
3471         the logic was incorrect because it must always call jit_retval*
3472         to fetch a function call return before any other instruction.
3473         The arm backend hash a special condition if jit_retval is not
3474         called, because "r0" is not JIT_R0, but is JIT_RET and *also*
3475         the first argument for a called function, so JIT_RET must be
3476         only used as an argument to jit_retval.
3477
3478 2012-12-03 Paulo Andrade <pcpa@gnu.org>
3479
3480         * check/all.tst, check/lightning.c: Only declare or use 64 bit
3481         interfaces on 64 bit builds.
3482
3483         * check/fib.tst: Use simpler logic to not need preprocessor
3484         conditionals for 32 or 64 bit.
3485
3486         * include/lightning.h: Only declare 64 bit macros on a 64 bit
3487         build. Code using lightning must know about wordsize and the
3488         jit generation limitations, also, this way it generates a
3489         compile time failure, not a runtime assertion.
3490
3491         * include/lightning/jit_x86.h: Correct typo in macro name.
3492
3493         * lib/jit_arm.c, lib/jit_arm-cpu.c, lib/jit_mips.c,
3494         lib/jit_mips-cpu.c, lib/jit_ppc.c, lib/jit_ppc-cpu.c,
3495         lib/jit_x86.c, lib/jit_x86-cpu.c: Correct wrong code to get
3496         current jit function pointer.
3497
3498         * lib/lightning.c: Move call to the simplify() optimization
3499         to after register liveness is known. Previous code did work
3500         by accident but now with proper test cases the problem was
3501         noticed.
3502
3503         * lib/jit_disasm.c: Always cast bfd_vma to long long when
3504         passing it as printf argument.
3505
3506 2012-12-03 Paulo Andrade <pcpa@gnu.org>
3507
3508         * configure.ac, check/Makefile.am, check/check.sh,
3509         doc/Makefile.am, include/lightning/Makefile.am,
3510         lib/Makefile.am: Correct make distcheck.
3511
3512 2012-12-02 Paulo Andrade <pcpa@gnu.org>
3513
3514         * lib/jit_ppc.c: Assign copyright ownership to FSF.
3515
3516         * lib/jit_x86-cpu.c: Correct integer multiplication that was
3517         generating code with reversed register arguments.
3518
3519         * check/rpn.ok, check/rpn.tst: New test case file.
3520
3521 2012-12-02 Paulo Andrade <pcpa@gnu.org>
3522
3523         * lib/jit_x86-cpu.c, lib/jit_x86-sse.c, lib/jit_x86-x87.c:
3524         Actually change copyright owner to FSF as avertised.
3525
3526         *  lib/jit_arm-cpu.c,  lib/jit_arm-swf.c,
3527         lib/jit_arm-vfp.c, lib/jit_arm.c,
3528         lib/jit_mips-cpu.c, lib/jit_mips-fpu.c, lib/jit_mips.c,
3529         lib/jit_ppc-cpu.c, lib/jit_ppc-fpu.c, lib/jit_ppc.c: New
3530         files implementing initial code different jit backends.
3531
3532         * include/lightning/jit_private.h: Add extra field to the
3533         private jit_patch_t type, required by the arm port.
3534
3535         * lib/Makefile.am: Update for the new backend implementation
3536         files.
3537
3538 2012-12-02 Paulo Andrade <pcpa@gnu.org>
3539
3540         * check/Makefile.am: Add proper "make clean" rule and missing
3541         check.sh to EXTRA_DIST.
3542
3543 2012-12-02 Paulo Andrade <pcpa@gnu.org>
3544
3545         * .gitignore: Update pattern of ignored files.
3546
3547         * check/Makefile.am: Add rule to build liblightning.la dependency
3548         in case of running "make check" before building the library.
3549
3550 2012-12-02 Paulo Andrade <pcpa@gnu.org>
3551
3552         * lightning/Makefile.am, lightning/asm-common.h,
3553         lightning/core-common.h, lightning/fp-common.h,
3554         lightning/funcs-common.h, lightning/i386/Makefile.frag,
3555         lightning/i386/asm-32.h, lightning/i386/asm-64.h,
3556         lightning/i386/asm.h, lightning/i386/core-32.h,
3557         lightning/i386/core-64.h, lightning/i386/core.h,
3558         lightning/i386/fp-32.h, lightning/i386/fp-64.h,
3559         lightning/i386/fp.h, lightning/i386/funcs.h,
3560         lightning/ppc/asm.h, lightning/ppc/core.h,
3561         lightning/ppc/fp.h, lightning/ppc/funcs.h,
3562         lightning/sparc/asm.h, lightning/sparc/core.h,
3563         lightning/sparc/fp.h, lightning/sparc/funcs.h:
3564         Removed. The core logic is used in the new code, and new mips
3565         and arm ports will be added. At first, sparc will not be
3566         supported as it has not yet been ported to the new engine.
3567
3568 2012-12-02 Paulo Andrade <pcpa@gnu.org>
3569
3570         * tests/Makefile.am, tests/3to2.c, tests/3to2.ok, tests/add.c,
3571         tests/add.ok, tests/allocai.c, tests/allocai.ok, tests/bp.c,
3572         tests/bp.ok, tests/divi.c, tests/divi.ok, tests/fib.c, tests/fib.ok,
3573         tests/fibdelay.c, tests/fibdelay.ok, tests/fibit.c, tests/fibit.ok,
3574         tests/funcfp.c, tests/funcfp.ok, tests/incr.c, tests/incr.ok,
3575         tests/ldst.c, tests/ldst.ok, tests/ldxi.c, tests/ldxi.ok,
3576         tests/modi.c, tests/modi.ok, tests/movi.c, tests/movi.ok,
3577         tests/printf.c, tests/printf.ok, tests/printf2.c, tests/printf2.ok,
3578         tests/ret.c, tests/ret.ok, tests/rpn.c, tests/rpn.ok, tests/rpnfp.c,
3579         tests/rpnfp.ok, tests/sete.c, tests/sete.ok, tests/testfp.c,
3580         tests/testfp.ok, tests-run-test: Removed previous test suite, in
3581         favor of a newer one in the check subdirectory.
3582
3583         * check/3to2.ok, check/3to2.tst, check/add.ok, check/add.tst,
3584         check/allocai.ok, check/allocai.tst, check/bp.ok, check/bp.tst,
3585         check/divi.ok, check/divi.tst, check/fib.ok, check/fib.tst:
3586         New sample input for the new test program, loosely matching
3587         several of the previous test cases.
3588
3589         * check/Makefile.am: New test suite makefile.
3590
3591         * check/check.sh, check/run-test: New wrapper files for the
3592         new test suite.
3593
3594         * check/lightning.c: New file. The main driver of the new test
3595         suite, that compiles to a parser of a very simple assembly like
3596         language, generates jit and executes it.
3597
3598         * check/all.tst: New file. A generic debug and sample test file
3599         with a directive to prevent it from being executed, and useful to
3600         read disassembly of all possible instructions, using a fixed set
3601         of registers.
3602
3603         * include/Makefile.am, include/lightning.h,
3604         include/lightning/Makefile.am, include/lightning/jit_arm.h,
3605         include/lightning/jit_mips.h, include/lightning/jit_ppc.h,
3606         include/lightning/jit_private.h, include/lightning/jit_x86.h,
3607         lib/Makefile.am, lib/jit_disasm.c, lib/jit_print.c,
3608         lib/jit_x86-cpu.c, lib/jit_x86-sse.c, lib/jit_x86-x87.c,
3609         lib/jit_x86.c, lib/lightning.c: New files. These files are
3610         written from scratch, only by <pcpa@gnu.org>, and have now
3611         copyright assignment to the FSF. This is the core of the new
3612         lightning rework. Previously it was integrated in code with
3613         a garbage collector and several custom types like vectors and
3614         hash tables, so this first code merge with lightning converts
3615         that code into a library extracting only the jit bits, and at
3616         first only for x86_64 GNU/Linux.
3617
3618         * lightning.h, m4/lightning.m4: Removed. These are no longer
3619         required in the new lightning code.
3620
3621         .gitignore, Makefile.am, configure.ac: Update for the new
3622         lightning code.
3623
3624 2012-12-02 Paulo Andrade <pcpa@gnu.org>
3625         * .cvsignore: Removed for extra cleanup.
3626
3627         * build-aux: Rename directory to m4.
3628
3629         * m4: Renamed to "default" name and for consistency with merge
3630         with code rework to be imported in lightning.
3631
3632         * .gitignore, configure.ac, Makefile.am, doc/Makefile.am:
3633         Update for build-aux to m4 rename.
3634
3635 2012-12-01 Paulo Andrade <pcpa@gnu.org>
3636
3637         * opcode/Makefile.am, opcode/Makefile.in, opcode/ansidecl.h,
3638         opcode/bfd.h, opcode/dis-asm.h, opcode/dis-buf.c, opcode/disass.c,
3639         opcode/i386-dis.c, opcode/i386.h, opcode/ppc-dis.c, opcode/ppc-opc.c,
3640         opcode/ppc.h, opcode/sparc-dis.c, opcode/sparc-opc.c, opcode/sparc.h,
3641         opcode/sysdep.h: Removed. Do not bundle GNU binutils files.
3642
3643         * aclocal.m4, configure, Makefile.in, config.h.in, doc/Makefile.in,
3644         lightning/Makefile.in, tests/Makefile.in: Removed. Do not maintain
3645         autogenerated files that also generate too much diff noise when
3646         regenerated in git.
3647
3648         * build-aux/help2man, build-aux/texinfo.tex, build-aux/texi2dvi:
3649         Removed. Buildenvironment must have an up to date version from
3650         upstream installed.
3651
3652         * build-aux/config.guess, build-aux/config.sub, build-aux/depcomp,
3653         build-aux/install-sh build-aux/mdate-sh build-aux/missing: Removed.
3654         Do not maintain a copy of automake files in git. Release tarballs
3655         must use an up to date version.
3656
3657         * lightningize.in, doc/lightningize.1: Removed. Do not encourage
3658         bundling lightning in other packages. It should use a system package
3659         or a proper thirdy part subdirectory.
3660
3661         * INSTALL: Removed. Autoreconf removes it and creates a symlink
3662         when regenerating files, so, avoid conflicts in git and let
3663         automake create the symlink.
3664
3665         * .gitignore: Add INSTALL and autogenerated files.
3666
3667         * configure.ac, Makefile.am: Update for removal of opcode subdir,
3668         auto generated files and lightningize.
3669
3670         * tests/Makefile.am, tests/3to2.c, tests/add.c, tests/bp.c,
3671         tests/fib.c, tests/fibdelay.c, tests/fibit.c, tests/funcfp.c,
3672         tests/incr.c, tests/printf.c, tests/rpn.c, tests/rpnfp.c,
3673         tests/sete.c, tests/testfp.c: Update for removal of opcode subdir.
3674
3675         * doc/Makefile.am: Update for removal of lightningize.
3676
3677         * configure.ac, lightning/ppc/funcs.h, lightning/sparc/funcs.h,
3678         lightning/i386/fp.h, lightning/i386/core.h, lightning/i386/asm.h,
3679         tests/3to2.c, tests/add.c, tests/bp.c, tests/fib.c, tests/fibdelay.c,
3680         tests/fibit.c, tests/funcfp.c, tests/incr.c, tests/printf.c,
3681         tests/rpn.c, tests/rpnfp.c, tests/sete.c, tests/testfp.c:
3682         Remove LIGHTNING_CROSS, it is half supported and incomplete.
3683
3684         * tests/3to2.c, tests/funcfp.c, tests/rpnfp.c: Remove preprocessor
3685         check on JIT_FPR. If no hardware registers are available, the backend
3686         must provide an alternative for software float.
3687
3688         * lightning/ppc/core.h, lightning/sparc/core.h, tests/Makefile.am:
3689         Remove JIT_NEED_PUSH_POP. It is absolutely not trivial to implement
3690         properly on some backends due to stack alignment constraints, and
3691         whenever it is required, using jit_allocai and using a properly
3692         aligned stack vector, or a heap buffer, is better.
3693
3694         * tests/push-pop.c, tests/push-pop.ok: Removed due to
3695         JIT_NEED_PUSH_POP no longer available.
3696
3697 2011-02-28  Paolo Bonzini  <bonzini@gnu.org>
3698
3699         * lightning/i386/core-64.h: Add jit_add{c,x}{i,r}_l, jit_mulr_{l,ul}_,
3700         fix jit_mul{i,r}_{l,ul}.
3701
3702 2010-08-20  Paolo Bonzini  <bonzini@gnu.org>
3703
3704         * lightning/i386/fp-64.h: Return patch address from jit_bXYr_{f,d}.
3705         Reported by Paulo César Pereira de Andrade.
3706         * lightning/ppc/fp.h: Likewise.
3707         * lightning/sparc/fp.h: Implement FP branches.
3708
3709 2010-08-18  Paolo Bonzini  <bonzini@gnu.org>
3710
3711         * lightning/i386/fp-64.h: Fix jp in jit_bner_{f,d}.
3712
3713 2010-08-18  Paolo Bonzini  <bonzini@gnu.org>
3714
3715         * lightning/i386/fp-32.h: Fix -D_ASM_SAFETY compilation.
3716         Reported by Paulo César Pereira de Andrade.
3717
3718 2010-08-15  Paolo Bonzini  <bonzini@gnu.org>
3719
3720         * tests/ldst.c: Update.
3721         * tests/Makefile.am: Use -ffloat-store to compile it.
3722
3723 2010-08-15  Paolo Bonzini  <bonzini@gnu.org>
3724
3725         * lightning/i386/core.h (jit_ldr_c, jit_ldxr_c, jit_ldr_s,
3726         jit_ldxr_s): Move...
3727         * lightning/i386/core-32.h: ... here.
3728         * lightning/i386/core-64.h (jit_ldr_c, jit_ldxr_c, jit_ldr_s):
3729         Use movsbq and movswq.
3730
3731 2010-08-10  Paulo César Pereira de Andrade <pcpa@mandriva.com.br>
3732
3733         * lightning/i386/core-32.h (jit_replace): Use MOVLrr, not MOVLir.
3734         (jit_movbrm): Check index register as well.
3735         * lightning/i386/fp-64.h: Add jit_extr_f_d and jit_extr_d_f.
3736         * lightning/fp-common.h: Add jit_extr_f_d and jit_extr_d_f.
3737
3738 2010-07-28  Paolo Bonzini  <bonzini@gnu.org>
3739
3740         * tests/Makefile.am: Add ldst test.
3741         * tests/Makefile.in: Regenerate.
3742         * tests/ldst.c: New.
3743         * tests/ldst.ok: New.
3744
3745 2010-07-28  Paolo Bonzini  <bonzini@gnu.org>
3746
3747         * THANKS: Add Paulo Cesar Pereira de Andrade.
3748         * doc/porting.texi: Fix ordering of arguments in jit_stxi.
3749         * lightning/i386/core-32.h (jit_replace): Remove cmp argument.
3750         * lightning/i386/fp-64.h (jit_movi_f): Fix.
3751
3752 2010-07-26  Paolo Bonzini  <bonzini@gnu.org>
3753
3754         * lightning/i386/core-32.h (jit_replace): Move here (removed
3755         2009-03-01).
3756
3757 2010-07-19  Paolo Bonzini  <bonzini@gnu.org>
3758
3759         * build-aux/lightning.m4: Always set and replace lightning_frag.
3760         * Makefile.in: Regenerate.
3761         * aclocal.m4: Regenerate.
3762         * config.h.in: Regenerate.
3763         * configure: Regenerate.
3764         * doc/Makefile.in: Regenerate.
3765         * doc/lightningize.1: Regenerate.
3766         * doc/version.texi: Regenerate.
3767         * lightning/Makefile.in: Regenerate.
3768         * opcode/Makefile.in: Regenerate.
3769         * tests/Makefile.in: Regenerate.
3770
3771 2009-03-01  Paolo Bonzini  <bonzini@gnu.org>
3772
3773         * lightning/i386/core-64.h: Use Mike's macros for x86-64 too.
3774         * lightning/i386/core.h: Remove jit_replace.
3775
3776         2009-02-27  Mike Spivey  <mike@comlab.ox.ac.uk>
3777
3778         * lightning/i386/core.h: Rewrite shift-handling macros.
3779         * lightning/fp-common.h: Fix jit_extr_{f_d,d_f}.
3780
3781 2009-02-17  Mike Spivey  <mike@comlab.ox.ac.uk>
3782
3783         * lightning/i386/core.h: Fix blunder in operand order.
3784
3785 2009-02-17  Paolo Bonzini  <bonzini@gnu.org>
3786
3787         * lightning/i386/fp-32.h: Another fix to jit_fp_btest.
3788
3789 2009-02-17  Paolo Bonzini  <bonzini@gnu.org>
3790
3791         * lightning/fp-common.h: Define double branches if missing.
3792         * lightning/i386/asm.h: Define JC and JNC mnemonics.
3793         * lightning/i386/fp-32.h: Fix jit_fp_btest.  All reported
3794         by Mike Spivey.
3795
3796 2008-10-09  Paolo Bonzini  <bonzini@gnu.org>
3797
3798         * lightning/ppc/funcs.h (jit_flush_code): Subtract 1 from end.
3799         Reported by Eli Barzilay and Matthew Flatt.
3800
3801 2008-08-23  Nix  <nix@esperi.org.uk>
3802
3803         * lightning/i386/Makefile.frag: fp-32.h and fp-64.h are target files.
3804
3805 2008-07-02  Laurent Michel  <ldm@engr.uconn.edu>
3806
3807         * lightning/ppc/funcs.h (jit_flush_code): modified the computation
3808         of start/end. The pointer arithmetic was done without casting. It
3809         prevented compilation with recent gcc versions.
3810         * lightning/ppc/core.h (jit_pushr_i): The offset for the store was
3811         incorrect. Should have been 4 bytes below SP (not above).
3812         * lightning/ppc/core.h (jit_popr_i): The offset for the load was
3813         incorrect. Should have been 0 (not +8).
3814
3815 2008-06-17  Paolo Bonzini  <bonzini@gnu.org>
3816
3817         * lightning/i386/asm-64.h: Forward IMULQir to IMULQirr,
3818         fix REXQ order for IMULQirr.
3819
3820 2008-06-17  Paolo Bonzini  <bonzini@gnu.org>
3821
3822         * lightning/i386/core.h: Fix _rN vs. _rR.
3823
3824 2008-06-16  Paolo Bonzini  <bonzini@gnu.org>
3825
3826         * lightning/i386/core.h: Use jit_save in jit_replace.  Move JIT_R
3827         definition...
3828         * lightning/i386/core-32.h: ... here; define jit_save so that
3829         the core.h has no effect on the 32-bit backend.
3830         * lightning/i386/core-64.h: Place JIT_R1/JIT_R2 in R10/R11,
3831         place outgoing arguments in the right spot from the beginning,
3832         define jit_save, fix jit_reg8/jit_reg16.
3833
3834 2008-06-15  Paolo Bonzini  <bonzini@gnu.org>
3835
3836         * lightning/i386/core-64.h: Rewrite argument passing to
3837         support up to 6 arguments and generate less code.
3838
3839 2008-06-14  Laurent Michel  <ldm@thorgal.homelinux.org>
3840
3841         * lightning/i386/core-64.h (jit_movi_l): When the operand is 0,
3842         the XOR should be on a quadword.
3843         * lightning/i386/core-64.h (jit_prolog): Keep 16-byte stack
3844         alignment.
3845         (jit_ret): Always use LEAVE.
3846
3847 2008-06-13  Laurent Michel  <ldm@thorgal.homelinux.org>
3848
3849         * lightning/i386/core-64.h: Add (void) casts for C++ compatibility.
3850         * lightning/i386/asm.h: Likewise.
3851
3852 2008-06-12  Paolo Bonzini  <bonzini@gnu.org>
3853
3854         * lightning/i386/core.h: Move JIT_V definition...
3855         * lightning/i386/core-32.h: ... here.
3856         * lightning/i386/core-64.h: ... and here.  Avoid dancing between
3857         RSI/RDI and R12/R13, and place JIT_V1/JIT_V2 in R12/R13.
3858
3859 2008-06-11  Paolo Bonzini  <bonzini@gnu.org>
3860
3861         * build-aux/lightning.m4: Adjust LIGHTNING_BACKENDS, don't
3862         use suffix support to distinguish i386/x86_64.
3863         * lightning/i386/Makefile.frag: Use LIGHTNING_TARGET_FILES
3864         to distribute *-32.h and *-64.h files now.
3865         * lightning/i386/asm-i386: Moved to...
3866         * lightning/i386/asm.h: Include the appropriate subtarget file.
3867         * lightning/i386/core-i386: Moved to...
3868         * lightning/i386/core.h: Include the appropriate subtarget file.
3869         * lightning/i386/fp.h: New, include the appropriate subtarget file.
3870         * lightning/i386/asm-32: Do not include asm-i386.h.
3871         * lightning/i386/asm-64.h: Likewise.
3872         * lightning/i386/core-32: Do not include core-i386.h.
3873         * lightning/i386/core-64.h: Likewise.
3874         * lightning/Makefile.am: Adjust for renamed files.
3875
3876         * configure.ac: Define LIGHTNING_TARGET here.
3877         * opcode/disass.c: Change list of valid LIGHTNING_TARGET values.
3878
3879         * lightningize.in: Robustify against missing subtarget files.
3880
3881 2008-06-11  Paolo Bonzini  <bonzini@gnu.org>
3882
3883         * lightning/i386/core-32.h: Use MOVLir instead of jit_movi_l
3884         to implement jit_movi_p.
3885
3886 2008-06-11  Paolo Bonzini  <bonzini@gnu.org>
3887
3888         * lightning/i386/core-32.h: Use separate __APPLE__ and SysV
3889         prolog/ret macros.  Subtract 12 bytes in __APPLE__ case to
3890         keep stack aligned, and always use LEAVE in the epilog.
3891
3892 2008-06-11  Paolo Bonzini  <bonzini@gnu.org>
3893
3894         * lightning/i386/core-i386.h: Fix C++ incompatibility.
3895
3896 2008-06-10  Laurent Michel  <ldm@engr.uconn.edu>
3897
3898         * lightning/i386/core-i386.h: Fix jit_replace8 for
3899         case when one of the operands is _EAX.
3900
3901 2008-05-19  Paolo Bonzini  <bonzini@gnu.org>
3902
3903         * tests/run-test: Avoid CRLF issues on mingw.
3904
3905 2008-03-21  Paolo Bonzini  <bonzini@gnu.org>
3906
3907         * lightning/i386/core-64.h: Fix jit_{ld,st}{,x}i_{i,l}.
3908         Remove jit_ld{,x}i_ul.
3909         * lightning/core-common.h: Make jit_ld{,x}{i,r}_ul
3910         always a synonym of the _l variant.
3911         * doc/porting.texi: Document this.
3912
3913 2008-03-19  Paolo Bonzini  <bonzini@gnu.org>
3914
3915         * lightning/i386/core-64.h: Fix uses of jit_qop_.
3916
3917 2008-03-19  Paolo Bonzini  <bonzini@gnu.org>
3918
3919         * lightning/i386/core-64.h: Add boolean operations.
3920
3921 2008-03-19  Paolo Bonzini  <bonzini@gnu.org>
3922
3923         * lightning/i386/asm-64.h: Add LEAQmr.
3924
3925 2008-03-19  Paolo Bonzini  <bonzini@gnu.org>
3926
3927         * lightning/i386/core-64.h: Misc bugfixes.
3928
3929 2008-03-19  Paolo Bonzini  <bonzini@gnu.org>
3930
3931         * lightning/i386/core-i386.c: Remove jit_ldr_i, jit_ldxr_i.
3932         * lightning/i386/core-32.h: Add jit_ldr_i, jit_ldxr_i.
3933         * lightning/i386/core-64.h: Add jit_ld{r,xr,i,xi}_{ui,l,ul};
3934         move jit_ldr_i, jit_ldxr_i, jit_str_l, jit_stxr_l with others.
3935
3936 2008-03-19  Paolo Bonzini  <bonzini@gnu.org>
3937
3938         * lightning/asm-common.h: Add _s32P.
3939
3940 2008-03-19  Paolo Bonzini  <bonzini@gnu.org>
3941
3942         * lightning/i386/core-64.h: Implement long mul/div/mod.
3943
3944 2008-03-19  Paolo Bonzini  <bonzini@gnu.org>
3945
3946         * lightning/i386/asm-i386.h: Cast memory address to long for JCCim.
3947
3948 2008-03-15  Paolo Bonzini  <bonzini@gnu.org>
3949
3950         * lightning/asm-common.h: Add underscores around __unused__
3951         attribute.
3952
3953 2008-03-15  Paolo Bonzini  <bonzini@gnu.org>
3954
3955         * lightning/ppc/core.h: Avoid some "value computed is not used"
3956         warnings.
3957         * lightnings/tests/allocai.c: Silence other warnings.
3958
3959 2008-03-14  Paolo Bonzini  <bonzini@gnu.org>
3960
3961         * lightningize.in: Fix some problems (not all).
3962
3963 2008-03-14  Paolo Bonzini  <bonzini@gnu.org>
3964
3965         * lightning/i386/core-32.h: Avoid some "value computed is not used"
3966         warnings; reported by Sam Steingold.
3967
3968 2008-03-08  Paolo Bonzini  <bonzini@gnu.org>
3969
3970         * lightning/i386/core-32.h: Fix stxr_c(_EAX, _EBX, _ESI).
3971
3972 2008-02-13  Paolo Bonzini  <bonzini@gnu.org>
3973
3974         * lightning/i386/asm-32.h: Avoid redefinition of _r1, reported by
3975         Sam Steingold.
3976         * lightning/i386/asm-64.h: Likewise.
3977
3978 2008-02-08  Paolo Bonzini  <bonzini@gnu.org>
3979
3980         * lightning/i386/asm-i386.h: Don't define _VOID, reported
3981         by Reini Urban.
3982
3983 2008-02-03  Paolo Bonzini  <bonzini@gnu.org>
3984
3985         * build-aux/lightning.m4: Add --with-lightning-prefix option, suggested
3986         by Sam Steingold.
3987
3988 2008-01-14  Paolo Bonzini  <bonzini@gnu.org>
3989
3990         * lightning/i386/core-64.h: Use CALLsr, not CALLLsr.
3991
3992 2008-01-13  Paolo Bonzini  <bonzini@gnu.org>
3993
3994         * lightning/i386/core-i386.h: Move jit_calli and jit_callr...
3995         * lightning/i386/core-32.h: ... here.
3996         * lightning/i386/core-64.h: Redefine them.
3997
3998 2008-01-05  Paolo Bonzini  <bonzini@gnu.org>
3999
4000         * lightning/i386/fp-32.h: Fix sub(a,0,a).
4001         * lightning/tests/3to2.c: Add new testcases.
4002         * lightning/tests/3to2.ok: Add new testcases.
4003
4004 2008-01-02  Paolo Bonzini  <bonzini@gnu.org>
4005
4006         * lightning/i386/fp-32.h: Fix sub(a,b,a) with a ~= JIT_FPR0.
4007         * lightning/tests/3to2.c: New.
4008         * lightning/tests/3to2.ok: New.
4009
4010 2007-11-07  Paolo Bonzini  <bonzini@gnu.org>
4011
4012         * opcode/Makefile.am: Fix AM_CPPFLAGS.
4013
4014 2007-08-12  Paolo Bonzini  <bonzini@gnu.org>
4015
4016         * lightning/i386/core-i386.h: Improve encoding of set* instructions.
4017         * lightning/i386/core-64.h: Fix jit_bra_l.
4018         * tests/sete.c: New.
4019         * tests/sete.ok: New.
4020
4021 2007-06-29  Paolo Bonzini  <bonzini@gnu.org>
4022
4023         * tests/bp.c: Upgrade to GPL/LGPLv3.
4024         * lightning/i386/asm-32.h: Upgrade to GPL/LGPLv3.
4025         * lightning/i386/asm-64.h: Upgrade to GPL/LGPLv3.
4026         * lightning/i386/core-32.h: Upgrade to GPL/LGPLv3.
4027         * lightning/i386/core-64.h: Upgrade to GPL/LGPLv3.
4028         * lightning/i386/fp-64.h: Upgrade to GPL/LGPLv3.
4029         * lightning/sparc/asm.h: Upgrade to GPL/LGPLv3.
4030         * lightning/sparc/core.h: Upgrade to GPL/LGPLv3.
4031         * lightning/sparc/fp.h: Upgrade to GPL/LGPLv3.
4032         * lightning/sparc/funcs.h: Upgrade to GPL/LGPLv3.
4033         * lightning/i386/asm-i386.h: Upgrade to GPL/LGPLv3.
4034         * lightning/i386/core-i386.h: Upgrade to GPL/LGPLv3.
4035         * lightning/i386/fp-32.h: Upgrade to GPL/LGPLv3.
4036         * lightning/i386/funcs.h: Upgrade to GPL/LGPLv3.
4037         * lightning/ppc/asm.h: Upgrade to GPL/LGPLv3.
4038         * lightning/ppc/core.h: Upgrade to GPL/LGPLv3.
4039         * lightning/ppc/fp.h: Upgrade to GPL/LGPLv3.
4040         * lightning/ppc/funcs.h: Upgrade to GPL/LGPLv3.
4041         * lightning.h: Upgrade to GPL/LGPLv3.
4042         * tests/add.c: Upgrade to GPL/LGPLv3.
4043         * tests/fib.c: Upgrade to GPL/LGPLv3.
4044         * tests/testfp.c: Upgrade to GPL/LGPLv3.
4045         * tests/fibdelay.c: Upgrade to GPL/LGPLv3.
4046         * tests/fibit.c: Upgrade to GPL/LGPLv3.
4047         * tests/funcfp.c: Upgrade to GPL/LGPLv3.
4048         * tests/incr.c: Upgrade to GPL/LGPLv3.
4049         * tests/printf.c: Upgrade to GPL/LGPLv3.
4050         * tests/printf2.c: Upgrade to GPL/LGPLv3.
4051         * tests/rpn.c: Upgrade to GPL/LGPLv3.
4052         * tests/rpnfp.c: Upgrade to GPL/LGPLv3.
4053         * lightning/asm-common.h: Upgrade to GPL/LGPLv3.
4054         * lightning/core-common.h: Upgrade to GPL/LGPLv3.
4055         * lightning/fp-common.h: Upgrade to GPL/LGPLv3.
4056         * lightning/funcs-common.h: Upgrade to GPL/LGPLv3.
4057         * opcode/dis-buf.c: Upgrade to GPL/LGPLv3.
4058         * opcode/disass.c: Upgrade to GPL/LGPLv3.
4059         * opcode/i386-dis.c: Upgrade to GPL/LGPLv3.
4060         * opcode/sparc-dis.c: Upgrade to GPL/LGPLv3.
4061         * opcode/sparc-opc.c: Upgrade to GPL/LGPLv3.
4062         * lightningize.in: Upgrade to GPL/LGPLv3.
4063         * opcode/bfd.h: Upgrade to GPL/LGPLv3.
4064         * opcode/i386.h: Upgrade to GPL/LGPLv3.
4065         * opcode/sparc.h: Upgrade to GPL/LGPLv3.
4066
4067 2007-01-26  Thomas Girard  <thomas.g.girard@free.fr>
4068
4069         * lightning/Makefile.am: Add clean-local target.
4070
4071 2006-12-02  Paolo Bonzini  <bonzini@gnu.org>
4072
4073         * lightning/i386/asm-i386.h: Add CVTTS?2SIL.
4074         * lightning/i386/asm-64.h: Add CVTTS?2SIQ.
4075         * lightning/i386/fp-64.h: Use it.
4076
4077         * lightning/Makefile.am: Place files in nodist_lightning_HEADERS.
4078
4079 2006-11-23  Paolo Bonzini  <bonzini@gnu.org>
4080
4081         * lightning/core-common.h: Add casts in "*i_p" variants.
4082         * lightning/i386/asm-32.h: Add _r1.
4083         * lightning/i386/asm-64.h: Likewise, and add SSE instructions.
4084         * lightning/i386/asm-i386.h: Merge SSE instructions from Gwenole.
4085         Use short form for 16-bit AX instructions.  Remove _r1
4086         * lightning/i386/core-64.h: Add FP ABI support in its infancy.
4087         * lightning/i386/core-i386.h: Move jit_arg_f and jit_arg_d...
4088         * lightning/i386/core-32.h: ... and jit_prepare_f and jit_prepare_d...
4089         * lightning/i386/fp-32.h: ... here.
4090         * lightning/i386/fp-64.h: Write the code.
4091         * lightning/sparc/fp.h: Fix jit_extr_{f_d,d_f} register order.
4092
4093 2006-11-22  Paolo Bonzini  <bonzini@gnu.org>
4094
4095         * lightning/i386/asm-i386.h: Move x86-64 instructions...
4096         * lightning/i386/asm-64.h: ... here.
4097         * lightning/i386/fp-32.h: Fix bugfixes worked around in froofyJIT.
4098         Add JIT_FPRET.
4099         * lightning/sparc/fp.h: Likewise.
4100         * lightning/ppc/fp.h: Likewise.
4101         * lightning/fp-common.h: Adjust for JIT_FPRET.
4102         * tests/funcfp.c: Adjust for JIT_FPRET.
4103         * tests/rpnfp.c: Adjust for JIT_FPRET.
4104
4105 2006-11-20  Paolo Bonzini  <bonzini@gnu.org>
4106
4107         * lightning/i386/asm-i386.h:  Add an underscore to macros without
4108         a parameter.
4109
4110 2006-11-20  Paolo Bonzini  <bonzini@gnu.org>
4111
4112         * lightning/i386/core-i386.h: Move jit_movip, jit_check8, jit_reg8,
4113         jit_reg16, jit_movbrm...
4114         * lightning/i386/core-32.h: ... here.
4115         * lightning/i386/core-64.h: Redefine them.  Fix other bugs.
4116
4117         * tests/printf.c: Do not do a varargs call.
4118
4119 2006-11-20  Paolo Bonzini  <bonzini@gnu.org>
4120
4121         * lightning/i386/asm-i386.h: Check in rewrite from Basilisk II.
4122         * lightning/i386/asm-32.h: Adjust.
4123         * lightning/i386/asm-64.h: Adjust.
4124         * lightning/i386/fp-32.h: Adjust.
4125
4126         * lightning/i386/core-32.h: Adjust.  Add jit_{ld,ldx,st,stx}i*.
4127         * lightning/i386/core-64.h: Adjust.  Add jit_{ld,ldx,st,stx}i*.
4128         * lightning/i386/core-i386.h: Adjust. Remove these patterns.
4129
4130 2006-11-20  Paolo Bonzini  <bonzini@gnu.org>
4131
4132         * lightning/i386/asm-i386.h: Merge 64-bit cleanliness changes from
4133         mzscheme.
4134         Add SSE.
4135         * lightning/i386/asm-64.h: Likewise.
4136
4137 2006-11-20  Paolo Bonzini  <bonzini@gnu.org>
4138             Ludovic Courtes  <ludo@chbouib.org>
4139
4140         * lightning/i386/core-32.h: Disable jit_push and jit_pop if stack not
4141         needed.
4142         * lightning/i386/core-64.h: Disable jit_push and jit_pop if stack not
4143         needed.
4144         * lightning/sparc/core.h: Merge final implementation of jit_pushr and
4145         jit_popr.
4146         * lightning/ppc/core.h: Fix implementation of jit_pushr and jit_popr to
4147         work (more or less) across function calls.
4148
4149         * tests/push-pop.c, tests/push-pop.ok: New test.
4150         * tests/Makefile.am: Run it.
4151
4152 2006-11-20  Paolo Bonzini  <bonzini@gnu.org>
4153
4154         * lightning/asm-common.h: Make 64-bit safe.
4155         * lightning/i386/funcs.h: Make 64-bit safe.
4156
4157         * lightning/i386/asm-64.h: More merge from mzscheme.
4158         * lightning/i386/asm-i386.h: More merge from mzscheme.
4159         * lightning/i386/core-32.h: More merge from mzscheme.
4160         * lightning/i386/core-64.h: More merge from mzscheme.
4161         * lightning/i386/core-i386.h: More merge from mzscheme.
4162
4163         * tests/rpnfp.c, tests/testfp.c, tests/funcfp.c: Skip if no
4164         floating-point support.
4165
4166 2006-11-04  Paolo Bonzini  <bonzini@gnu.org>
4167
4168         * tests/rpn.c: Remove pushr/popr.
4169
4170 2006-11-04  Paolo Bonzini  <bonzini@gnu.org>
4171
4172         * lightning/ppc/core.h: Implement jit_allocai, define JIT_FP to be R1.
4173         * lightning/ppc/funcs.h: Store frame size into _jitl.  Store R1 before
4174         the STMW, so that the offset is unchanged when we patch the STMW.
4175         * lightning/i386/core.h: Define JIT_FP to be EBP.
4176         * lightning/i386/core-32.h: Implement jit_allocai, put LEAVE in the
4177         epilog if jit_allocai was used.
4178         * lightning/i386/core-64.h: Implement jit_allocai, put LEAVE in the
4179         epilog if jit_allocai was used.
4180
4181 2006-11-04  Ludovic Courtes  <ludo@chbouib.org>
4182
4183         * lightning/sparc/core.h: Implement jit_allocai.
4184         * tests/allocai.c: New.
4185         * tests/Makefile.am: Point to new tests.
4186
4187 2006-11-03  Paolo Bonzini  <bonzini@gnu.org>
4188
4189         * lightning/ppc/core.h: Fix jit_bms using BNE rather than BGT.
4190         "AND." does signed comparisons.
4191
4192 2006-10-31  Paolo Bonzini  <bonzini@gnu.org>
4193
4194         * doc/porting.texi: Rename JIT_FP to JIT_AP.
4195         * lightning/core-common.h: Likewise.
4196         * lightning/i386/core-i386.h: Likewise.
4197         * lightning/fp-common.h: Provide default versions of jit_getarg_[fd].
4198         * lightning/i386/fp-32.h: Don't provide jit_getarg_[fd].
4199         * lightning/ppc/fp.h: Likewise.
4200
4201 2006-10-31  Ludovic Courtes  <ludo@chbouib.org>
4202
4203         * doc/using.texi (The instruction set): Clarified the use of `JIT_RET' and
4204         documented `jit_retval'.
4205         * tests/ret.c (generate_function_proxy): After `jit_finish', use
4206         `jit_retval_i' to move FUNC's return value into the correct register.
4207
4208 2006-10-31  Paolo Bonzini  <bonzini@gnu.org>
4209             Ludovic Courtes  <ludo@chbouib.org>
4210
4211         * tests/divi.c, tests/divi.ok, tests/movi.c, tests/movi.ok: New.
4212         * tests/ldxi.c: Ensure large pointer is generated.
4213         * tests/Makefile.am: Point to new tests.
4214         * lightning.h: Include funcs-common.h before funcs.h.
4215         * lightning/sparc/core.h: Fix bugs in modi/divi.
4216
4217 2006-10-30  Paolo Bonzini  <bonzini@gnu.org>
4218
4219         * lightning/Makefile.am: Use "ln -sf".
4220         * lightning/core-common.h: Define jit_negr_l if necessary.
4221
4222 2006-10-30  Paolo Bonzini  <bonzini@gnu.org>
4223
4224         * lightning/i386/asm.h (MOVS*, MOVZ*): Use correct _r[124] macros.
4225
4226 2006-10-29  Paolo Bonzini  <bonzini@gnu.org>
4227
4228         * configure.ac: Use lightning.m4 macros.
4229         * lightning.m4: Refactor to use common code in configure.ac.  Move...
4230         * build-aux/lightning.m4: ... here.
4231         * lightningize.in: Support suffixes.
4232         * opcode/disass.in: Adapt to changes in configure.ac.
4233
4234         * lightning/ppc/funcs.h: Use __APPLE__ instead of _CALL_DARWIN.
4235         * lightning/i386/core-32.h: Likewise.
4236
4237 2006-10-26  Paolo Bonzini  <bonzini@gnu.org>
4238
4239         * configure.ac: Fix compilation test.
4240         * lightning/Makefile.am: Symlink LIGHTNING_TARGET_FILES in
4241         non-distribution mode.
4242         * lightning/i386/Makefile.frag: Use LIGHTNING_TARGET_FILES.
4243
4244 2006-10-26  Paolo Bonzini  <bonzini@gnu.org>
4245
4246         * configure.ac: Subst cpu.
4247         * lightning/core-common.h: Make tests pass on i386.
4248         * lightning/i386/asm-32.h: Make tests pass on i386.
4249         * lightning/i386/asm-64.h: Make tests pass on i386.
4250         * lightning/i386/asm-i386.h: Make tests pass on i386.
4251         * lightning/i386/core-32.h: Make tests pass on i386.
4252         * lightning/i386/core-64.h: Make tests pass on i386.
4253         * lightning/i386/core-i386.h: Make tests pass on i386.
4254         * tests/Makefile.am: Include files from cpu directory.
4255
4256 2006-10-26  Paolo Bonzini  <bonzini@gnu.org>
4257
4258         * lightning/i386/asm.h: Move to asm-i386.h
4259         * lightning/i386/asm-32.h: New, from Matthew Flatt.
4260         * lightning/i386/asm-64.h: New, from Matthew Flatt.
4261         * lightning/i386/core.h: Move to core-i386.h
4262         * lightning/i386/core-32.h: New, from Matthew Flatt.
4263         * lightning/i386/core-64.h: New, from Matthew Flatt.
4264         * lightning/i386/fp.h: Move to fp-32.h
4265         * lightning/i386/fp-64.h: New, dummy.
4266         * lightning/i386/Makefile.frag: New.
4267         * lightning/Makefile.am: Support per-target Makefile fragments.
4268         * configure.ac: Support per-target Makefile fragments and CPU suffixes.
4269
4270 2006-10-16  Paolo Bonzini  <bonzini@gnu.org>
4271
4272         * lightning/i386/i386.h (jit_flush_code): Fix syntax error. :-(
4273
4274 2006-07-06  Paolo Bonzini  <bonzini@gnu.org>
4275             Ludovic Courtes  <ludovic.courtes@laas.fr>
4276
4277         * doc/using.texi: Clarify "Using autoconf" section
4278         and rename it to "Bundling lightning"
4279         * lightning.m4: Work also if lightning is not bundled.
4280
4281 2006-07-06  Paolo Bonzini  <bonzini@gnu.org>
4282             Ludovic Courtes  <ludovic.courtes@laas.fr>
4283
4284         * lightning/ppc/core.h (_jit_mod): Replace with...
4285         (_jit_mod_big, _jit_mod_small): ... these.
4286         (jit_modi_i, jit_modi_ui): Rewrite.
4287         * tests/modi.c, tests/modi.ok: New tests.
4288
4289 2006-05-18  Matthew Flatt  <mflatt@cs.utah.edu>
4290
4291         * lightning/i386/asm.h: Fix test for extending the mprotect area
4292         towards lower addresses.
4293
4294 2006-05-16  Bruno Haible  <bruno@clisp.org>
4295
4296         * lightning/asm-common.h: Don't use __func__ nor __FUNCTION__ if
4297         not compiling with GNU C.
4298
4299 2006-02-16  Paolo Bonzini  <bonzini@gnu.org>
4300
4301         * lightning/ppc/core.h: Fix jit_ldxi_* with big displacement.
4302
4303 2006-01-23  Paolo Bonzini  <bonzini@gnu.org>
4304
4305         * configure.ac: Fix comments in config.h.in.
4306
4307 2005-11-25  Paolo Bonzini  <bonzini@gnu.org>
4308
4309         * lightning/sparc/fp.h: Fix header comment.
4310         * lightning/ppc/fp.h: Fix header comment.
4311
4312 2005-04-27  Paolo Bonzini  <bonzini@gnu.org>
4313
4314         * lightning/i386/asm.h (JCm, JCSm, JNCm, JNCSm): New.
4315
4316 2004-11-26  Paolo Bonzini  <bonzini@gnu.org>
4317
4318         * lightning/ppc/funcs.h (_jit_epilog): Remove unused variable.
4319
4320 2004-11-13  Paolo Bonzini  <bonzini@gnu.org>
4321
4322         * lightning/i386/funcs.h [__linux__]: Include sys/mman.h.
4323
4324 2004-11-09  Paolo Bonzini  <bonzini@gnu.org>
4325
4326         * lightning/sparc/fp.h: Fix fp-to-integer conversions.
4327         * lightning/ppc/testfp.c: Test fp-to-integer conversions
4328         of integer numbers.
4329         * lightning/ppc/testfp.ok: Adjust for the above.
4330
4331 2004-11-08  Paolo Bonzini  <bonzini@gnu.org>
4332
4333         * lightning/ppc/testfp.c: Always flush code before
4334         testing it.
4335
4336 2004-11-08  Paolo Bonzini  <bonzini@gnu.org>
4337
4338         * lightning/ppc/fp.h: Do not clobber f31.
4339
4340 2004-11-08  Paolo Bonzini  <bonzini@gnu.org>
4341
4342         * lightning.h: New name of...
4343         * lightning-inst.h: ... this file.
4344         * lightning.h.in: Removed.
4345
4346         * opcodes/disass.c: Include config.h.
4347         * tests/add.c: Include config.h.
4348         * tests/bp.c: Include config.h.
4349         * tests/fib.c: Include config.h.
4350         * tests/fibdelay.c: Include config.h.
4351         * tests/fibit.c: Include config.h.
4352         * tests/funcfp.c: Include config.h.
4353         * tests/incr.c: Include config.h.
4354         * tests/printf.c: Include config.h.
4355         * tests/printf2.c: Include config.h.
4356         * tests/rpn.c: Include config.h.
4357         * tests/rpnfp.c: Include config.h.
4358         * tests/testfp.c: Include config.h.
4359
4360 2004-10-12  Paolo Bonzini  <bonzini@gnu.org>
4361
4362         * lightning/i386/fp.h: Fix bugs in conditional branches.
4363
4364 2004-10-10  Paolo Bonzini  <bonzini@gnu.org>
4365
4366         * lightning/i386/funcs.h: Fix pasto in jit_flush_code.
4367
4368 2004-10-08  Paolo Bonzini  <bonzini@gnu.org>
4369
4370         * lightning/ppc/fp.h: Optimized conditional branches.
4371
4372 2004-09-20  Paolo Bonzini  <bonzini@gnu.org>
4373
4374         * lightning/ppc/asm.h: Fix more typos.
4375
4376 2004-09-20  Paolo Bonzini  <bonzini@gnu.org>
4377
4378         * lightning/ppc/asm.h: Fix typos, replace `26' with JIT_AUX.
4379
4380 2004-09-20  Paolo Bonzini  <bonzini@gnu.org>
4381
4382         * lightning/ppc/fp.h: Added conditional branches.
4383
4384 2004-09-18  Laurent Michel  <ldm@thorgal.homelinux.org>
4385
4386         * lightning/ppc/fp.h (jit_unler_d, jit_unltr_d, jit_unger_d,
4387         jit_ungtr_d, jit_ltgt_d, jit_uneq_d): Implemented missing tests
4388         to fully support testfp.
4389         (jit_floorr_d_i, jit_ceilr_d_i, jit_roundr_d_i, jit_truncr_d_i):
4390         New macros.
4391         * lightning/ppc/asm.h: Added missing opcodes FCTIWZ and MTFSFI.
4392         * lightning/ppc/funcs.h (_jit_prolog): Fixed minor mistake in
4393         the initialization of _jitl.nextarg_geti, relying on the
4394         JIT_AUX macro as well to get the register offset.
4395
4396 2004-09-07  Paolo Bonzini  <bonzini@gnu.org>
4397
4398         * lightning/ppc/funcs.h: Fix typo.
4399
4400 2004-09-06  Paolo Bonzini  <bonzini@gnu.org>
4401
4402         * tests/funcfp.c: Use %g.  Remove C99 variable declarations.
4403         * tests/testfp.c: Don't use __builtin_nan.
4404
4405         * lightning/ppc/core.h: Add three V registers.
4406         * lightning/ppc/funcs.h: Adjust.
4407
4408         * lightning/sparc/core.h: Some fixes related to FP argument passing.
4409         Move R0 to %g2, use %o7 for JIT_BIG2.
4410         * lightning/sparc/fp.h: Some fixes related to FP argument passing.
4411
4412 2004-09-02  Paolo Bonzini  <bonzini@gnu.org>
4413
4414         * lightning/sparc/core.h: Add another V register,
4415         move R0 to %o7.
4416
4417 2004-07-15  Paolo Bonzini  <bonzini@gnu.org>
4418
4419         * lightning/i386/funcs.h: Implement jit_flush_code,
4420         in order to support Fedora's exec-shield.
4421
4422 2004-07-14  Paolo Bonzini  <bonzini@gnu.org>
4423
4424         * lightning/core-common.h: Add more jit_extr_*_* macros.
4425         * lightning/doc/using.texi: Be clearer about the order
4426         of arguments in jit_extr_*_*.
4427         * lightning/doc/porting.texi: Add more jit_extr_*_* macros.
4428         * lightning/i386/fp.h: Fix typo in jit_extr_i_d.
4429
4430 2004-07-14  Paolo Bonzini  <bonzini@gnu.org>
4431
4432         * lightning/ppc/funcs.h: Adjust offset of LR into
4433         stack frame if running under the Darwin ABI.
4434
4435 2004-07-13  Paolo Bonzini  <bonzini@gnu.org>
4436
4437         * lightning/i386/fp.h: Rename jit_exti_d to jit_extr_i_d.
4438
4439 2004-07-13  Paolo Bonzini  <bonzini@gnu.org>
4440
4441         * lightning/ppc/core.h: Fix thinko.
4442
4443         * lightning/i386/core.h: Fix jit_lti_ui.
4444         * lightning/core-common.h: Add missing macros.
4445
4446         * lightning/ppc/fp.h: Rename jit_neg_* to jit_negr_*.
4447         * lightning/i386/fp.h: Rename jit_neg_* to jit_negr_*.
4448         * lightning/sparc/fp.h: Rename jit_neg_* to jit_negr_*.
4449         * lightning/fp-common.h: Rename jit_neg_* to jit_negr_*.
4450         * doc/porting.texi: Add undocumented macros.
4451
4452 2004-07-12  Paolo Bonzini  <bonzini@gnu.org>
4453
4454         * doc/porting.texi: Add missing macros.
4455
4456 2004-07-12  Paolo Bonzini  <bonzini@gnu.org>
4457
4458         * lightning/ppc/funcs.h: Don't generate trampolines.
4459         Separate prolog and epilog generation.
4460         * lightning/ppc/core.h: Generate epilog explicitly.
4461         Don't reserve r31 anymore.
4462         * lightning/core-common.h: Remove call to jit_setup_code.
4463
4464 2004-07-09  Paolo Bonzini  <bonzini@gnu.org>
4465
4466         * lightning/lightning.h.in: Avoid preprocessor warnings.
4467         * lightning/lightning-inst.h: Likewise.
4468
4469         * lightning/i386/core.h: Define JIT_R, JIT_R_NUM, JIT_V,
4470         JIT_V_NUM.
4471         * lightning/ppc/core.h: Likewise.
4472         * lightning/sparc/core.h: Likewise.
4473         * lightning/i386/fp.h: Define JIT_FPR, JIT_FPR_NUM.
4474         * lightning/ppc/fp.h: Likewise.
4475         * lightning/sparc/fp.h: Likewise.
4476         * lightning/core-common.h: Define fixed register names.
4477         * lightning/fp-common.h: Likewise for FP regs.
4478
4479 2004-07-09  Paolo Bonzini  <bonzini@gnu.org>
4480
4481         * lightning/ppc/funcs.h: Fix location where return address
4482         is stored.
4483         * lightning/i386/asm.h: Add a trailing _ to opcodes without
4484         any parameter.
4485         * lightning/i386/core.h: Adjust for the above.
4486
4487 2004-04-15  Paolo Bonzini  <bonzini@gnu.org>
4488
4489         * lightning/i386/fp.h: Change "and" to "_and"
4490         to satisfy C++ compilers.
4491
4492 2004-04-14  Paolo Bonzini  <bonzini@gnu.org>
4493
4494         * lightning/sparc/fp.h: Use memcpy to implement jit_movi.
4495         * lightning/ppc/fp.h: Use memcpy to implement jit_movi.
4496         Move floating-point opcodes...
4497         * lightning/ppc/asm.h: ... here.
4498
4499 2004-04-14  Paolo Bonzini  <bonzini@gnu.org>
4500
4501         * lightning/core-common.h: Add jit_finishr.
4502         * lightning/ppc/core.h: Add jit_callr and jit_finishr.
4503         * lightning/i386/core.h: Add jit_callr.
4504         * lightning/sparc/core.h: Add jit_callr.  Fix typo.
4505
4506 2004-04-14  Paolo Bonzini  <bonzini@gnu.org>
4507
4508         * lightning/i386/core.h: Fix pasto in jit_b*_ui.
4509
4510 2004-03-30  Laurent Michel
4511
4512         * lightning/ppc: Implement PowerPC floating point
4513         (ChangeLog entry missing).
4514
4515 2004-03-12  Paolo Bonzini  <bonzini@gnu.org>
4516
4517         * lightning/fp-common.h: Load/store macros are not the
4518         same for floats and doubles anywhere, but jit_retval may be.
4519         * lightning/i386/asm.h: Fix = mistaken for == in ESCrri.
4520         * lightning/i386/core.h: Fix typo in jit_prepare_[fd].
4521         * lightning/i386/fp.h: Rewritten.
4522         * tests/testfp.c: Add tests for unordered comparisons.
4523         * tests/testfp.ok: Add results.
4524
4525 2004-03-15  Paolo Bonzini  <bonzini@gnu.org>
4526
4527         Merge changes from Laurent Michel.
4528
4529         * lightning/asm-common.h: Add _jit_I_noinc.
4530         * lightning/core-common.h: Support jit_init,
4531         jit_setup_code, jit_patch_at.  Return patchable IP from
4532         jit_movi_p.
4533         * lightning/funcs-common.h: Provide defaults
4534         for jit_setup_code, jit_start_pfx, jit_end_pfx
4535         * lightning/i386/core.h: Add jit_patch_at, jit_patch_movi.
4536         * lightning/ppc/core.h: Likewise.
4537         * lightning/sparc/core.h: Likewise.
4538         * lightning/ppc/asm.h: Fix generation of branch destination
4539         displacements in _FB and _BB
4540         * lightning/ppc/core.h: Generate trampolines in the user
4541         area.
4542         * lightning/ppc/funcs.h: Add a few casts.
4543         * tests/bc.c: New testcase.
4544
4545         * lightning/i386/asm.h: Wrap into #ifndef LIGHTNING_DEBUG.
4546         * lightning/ppc/asm.h: Wrap into #ifndef LIGHTNING_DEBUG.
4547         * lightning/sparc/asm.h: Wrap into #ifndef LIGHTNING_DEBUG.
4548
4549
4550 2004-03-09  Paolo Bonzini  <bonzini@gnu.org>
4551
4552         * lightning/sparc/fp.h: Rewrite.  Move macros for
4553         FP code generation...
4554         * lightning/sparc/asm.h: ... here.
4555         * lightning/sparc/core.h: Rename jit_prepare to
4556         jit_prepare_i, jit_retval to jit_retval_i.
4557         * lightning/ppc/core.h: Rename jit_prepare to
4558         jit_prepare_i, jit_retval to jit_retval_i.
4559         * lightning/i386/core.h: Rename jit_prepare to
4560         jit_prepare_i, jit_retval to jit_retval_i.
4561         * lightning/core-common.h: Provide backwards
4562         compatible synonyms for the above.
4563         * lightning/fp-common.h: Rewrite.
4564         * lightning-inst.h: Include fp unconditionally.
4565         * lightning.h.in: Include fp unconditionally.
4566         * tests/Makefile.am: Enable fp tests.
4567         * tests/fib.c: Use jit_retval_i.
4568         * tests/fibit.c: Cast codeBuffer to char *.
4569         * tests/funcfp.c: Use new fp macros.
4570         * tests/printf.c: Use jit_retval_i.
4571         * tests/rpnfp.c: Use new fp macros.
4572         * tests/testfp.c: Use new fp macros.
4573
4574 2004-03-02  Paolo Bonzini  <bonzini@gnu.org>
4575
4576         * lightning/i386/core.h: generate correct code when
4577         doing lt/le/ge/etc. on ESI and EDI.  Use MOVZX/MOVSX
4578         where possible.
4579         * lightning/i386/asm.h: Add macros for MOVZX/MOVSX.
4580         Move macros for x87 here, and add many of them.
4581         * lightning/i386/fp.h: Use new macros for x87.
4582
4583 2004-02-06  Paolo Bonzini  <bonzini@gnu.org>
4584
4585         * lightning/i386/core.h: avoid generating MOV reg, reg.
4586         * lightning/sparc/core.h: fix several bugs.
4587         * lightning/ppc/core.h: fix several bugs.
4588         * tests/rpn.c: rewritten.
4589
4590 2004-01-08  Paolo Bonzini  <bonzini@gnu.org>
4591
4592         * tests/rpnfp.c: new example, suggested by Basile
4593         Starynkevitch.
4594         * tests/rpnfp.ok: new example.
4595
4596 2003-12-12  Paolo Bonzini  <bonzini@gnu.org>
4597
4598         * tests/add.c: new test, suggested by Steve Dekorte.
4599         * tests/add.c: new test.
4600
4601 2003-11-14  Paolo Bonzini  <bonzini@gnu.org>
4602             John Redford <eirenik@hotmail.com>
4603
4604         * lightning/asm-common.h: change the 'pc' field of _jit to
4605         be a union of various data types, because ISO C99 doesn't
4606         permit using ++ on a = cast.  Change the incremented casts of
4607         _jit.pc to be _jit.x.uc_pc, _jit.x.us_pc, etc.
4608         * all files: change all non-cast instances of _jit.pc to be
4609         _jit.x.pc.
4610         * lightning/i386/core.h: remove casts from jit_might.
4611
4612 2003-05-25  Paolo Bonzini  <bonzini@gnu.org>
4613
4614         * lightning/i386/core.h: use JITSORRY in jit_replace
4615         * lightning/asm-common.h: define JITSORRY
4616
4617 2003-05-14  Paolo Bonzini  <bonzini@gnu.org>
4618
4619         * lightning/i386/core.h: fix missing comma in several
4620         load/store macros.
4621         * lightning/core-common.h: fix long/unsigned long/pointer
4622         jit_pushr/jit_popr.
4623         * lightning/ppc/funcs.h: correctly align stack pointer
4624
4625 No changelogs for the assemblers (lightning directory) until 1.0
4626
4627 2003-03-27  Paolo Bonzini  <bonzini@gnu.org>
4628
4629         * tests/printf2.c: new test
4630
4631 2001-05-03  Paolo Bonzini  <bonzini@gnu.org>
4632
4633         * tests/printf.c: made the message platform independent
4634
4635 2001-01-19  Paolo Bonzini  <bonzini@gnu.org>
4636
4637         * configure.in: support cross-assembling
4638
4639         * disass/bfd.h, disass/dis-asm.h, disass/dis-buf.c,
4640         disass/i386-dis.c, disass/i386.h, disass/ppc-dis.c,
4641         disass/ppc.h, disass/ppc-opc.c, disass/sparc-dis.c,
4642         disass/sparc.h, disass/sparc-opc.c: new files, from GDB
4643
4644         * disass/disass.c, disass/Makefile.am: new files
4645
4646         * tests/fib.c, tests/fibit.c, tests/incr.c, tests/printf.c,
4647         tests/rpn.c, tests/testfp.c, tests/Makefile.am: support
4648         disassembling