mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-05-03 13:20:26 +02:00
Rerun tests on supported backends after bogus self test correction
2013-10-07 Paulo Andrade <pcpa@gnu.org> * check/self.c: Extend tests to validate jit_callee_save_p does not cause an assertion on valid arguments, and test extra registers defined on some backends. * configure.ac: Do not ignore environment CFLAGS when checking if need to test runtime configurable options, like use x87 when sse2 is available, arm instruction set instead of thumb, etc. * include/lightning/jit_arm.h: Correct wrong jit_f macro definition. * include/lightning/jit_ia64.h, include/lightning/jit_ppc.h: Correct wrong jit_r macro definition. * lib/jit_x86-x87.c, lib/jit_x86.c: Actually use the reserved stack space for integer to/from float conversion. The stack space was also changed to ensure it is 8 bytes aligned. Also, for Solaris x86 in 32 bit mode, an alternate truncr_d was implemented because for some reason it is failing with SIGILL if using the "fisttpl" instructions, that must be available on p6 or newer, but for the sake of making all tests pass, implement a 486 or newer sequence if "sun" is defined.
This commit is contained in:
parent
52bfc67192
commit
0e94048174
9 changed files with 156 additions and 15 deletions
27
ChangeLog
27
ChangeLog
|
@ -1,3 +1,30 @@
|
|||
2013-10-07 Paulo Andrade <pcpa@gnu.org>
|
||||
|
||||
* check/self.c: Extend tests to validate jit_callee_save_p
|
||||
does not cause an assertion on valid arguments, and test
|
||||
extra registers defined on some backends.
|
||||
|
||||
* configure.ac: Do not ignore environment CFLAGS when
|
||||
checking if need to test runtime configurable options,
|
||||
like use x87 when sse2 is available, arm instruction set
|
||||
instead of thumb, etc.
|
||||
|
||||
* include/lightning/jit_arm.h: Correct wrong jit_f macro
|
||||
definition.
|
||||
|
||||
* include/lightning/jit_ia64.h, include/lightning/jit_ppc.h:
|
||||
Correct wrong jit_r macro definition.
|
||||
|
||||
* lib/jit_x86-x87.c, lib/jit_x86.c: Actually use the
|
||||
reserved stack space for integer to/from float conversion.
|
||||
The stack space was also changed to ensure it is 8 bytes
|
||||
aligned. Also, for Solaris x86 in 32 bit mode, an alternate
|
||||
truncr_d was implemented because for some reason it is
|
||||
failing with SIGILL if using the "fisttpl" instructions,
|
||||
that must be available on p6 or newer, but for the sake of
|
||||
making all tests pass, implement a 486 or newer sequence
|
||||
if "sun" is defined.
|
||||
|
||||
2013-10-03 Paulo Andrade <pcpa@gnu.org>
|
||||
|
||||
* include/lightning/jit_mips.h, lib/jit_mips-cpu.c,
|
||||
|
|
67
check/self.c
67
check/self.c
|
@ -5,44 +5,93 @@
|
|||
int
|
||||
main(int argc, char *argv[])
|
||||
{
|
||||
jit_state_t *_jit;
|
||||
|
||||
/* Same JIT_XY are not constants */
|
||||
init_jit(argv[0]);
|
||||
|
||||
_jit = jit_new_state();
|
||||
assert(JIT_R0 == jit_r(0));
|
||||
(void)jit_callee_save_p(JIT_R0);
|
||||
assert(JIT_R1 == jit_r(1));
|
||||
(void)jit_callee_save_p(JIT_R1);
|
||||
assert(JIT_R2 == jit_r(2));
|
||||
(void)jit_callee_save_p(JIT_R2);
|
||||
#if defined(JIT_R3)
|
||||
assert(JIT_R3 == jit_r(3));
|
||||
(void)jit_callee_save_p(JIT_R3);
|
||||
# if defined(JIT_R4)
|
||||
assert(JIT_R4 == jit_r(4));
|
||||
(void)jit_callee_save_p(JIT_R4);
|
||||
# if defined(JIT_R5)
|
||||
assert(JIT_R5 == jit_r(5));
|
||||
(void)jit_callee_save_p(JIT_R5);
|
||||
# if defined(JIT_R6)
|
||||
assert(JIT_R6 == jit_r(6));
|
||||
(void)jit_callee_save_p(JIT_R6);
|
||||
# if defined(JIT_R7)
|
||||
assert(JIT_R7 == jit_r(7));
|
||||
(void)jit_callee_save_p(JIT_R7);
|
||||
# endif
|
||||
# endif
|
||||
# endif
|
||||
# endif
|
||||
#endif
|
||||
assert(JIT_V0 == jit_v(0));
|
||||
assert(jit_callee_save_p(JIT_V0));
|
||||
assert(JIT_V1 == jit_v(1));
|
||||
assert(jit_callee_save_p(JIT_V1));
|
||||
assert(JIT_V2 == jit_v(2));
|
||||
assert(jit_callee_save_p(JIT_V2));
|
||||
#if defined(JIT_V3)
|
||||
assert(JIT_V3 == jit_v(3));
|
||||
assert(jit_callee_save_p(JIT_V3));
|
||||
# if defined(JIT_V4)
|
||||
assert(JIT_V4 == jit_v(4));
|
||||
assert(jit_callee_save_p(JIT_V4));
|
||||
# if defined(JIT_V5)
|
||||
assert(JIT_V5 == jit_v(5));
|
||||
assert(jit_callee_save_p(JIT_V5));
|
||||
# if defined(JIT_V6)
|
||||
assert(JIT_V6 == jit_v(6));
|
||||
assert(jit_callee_save_p(JIT_V6));
|
||||
# if defined(JIT_V7)
|
||||
assert(JIT_V7 == jit_v(7));
|
||||
assert(jit_callee_save_p(JIT_V7));
|
||||
# if defined(JIT_V8)
|
||||
assert(JIT_V8 == jit_v(8));
|
||||
assert(jit_callee_save_p(JIT_V8));
|
||||
# if defined(JIT_V9)
|
||||
assert(JIT_V9 == jit_v(9));
|
||||
assert(jit_callee_save_p(JIT_V9));
|
||||
# if defined(JIT_V10)
|
||||
assert(JIT_V10 == jit_v(10));
|
||||
assert(jit_callee_save_p(JIT_V10));
|
||||
# if defined(JIT_V11)
|
||||
assert(JIT_V11 == jit_v(11));
|
||||
assert(jit_callee_save_p(JIT_V11));
|
||||
# if defined(JIT_V12)
|
||||
assert(JIT_V12 == jit_v(12));
|
||||
assert(jit_callee_save_p(JIT_V12));
|
||||
# if defined(JIT_V13)
|
||||
assert(JIT_V13 == jit_v(13));
|
||||
assert(jit_callee_save_p(JIT_V13));
|
||||
# if defined(JIT_V14)
|
||||
assert(JIT_V14 == jit_v(14));
|
||||
assert(jit_callee_save_p(JIT_V14));
|
||||
# if defined(JIT_V15)
|
||||
assert(JIT_V15 == jit_v(15));
|
||||
assert(jit_callee_save_p(JIT_V15));
|
||||
# if defined(JIT_V16)
|
||||
assert(JIT_V16 == jit_v(16));
|
||||
assert(jit_callee_save_p(JIT_V16));
|
||||
# endif
|
||||
# endif
|
||||
# endif
|
||||
# endif
|
||||
# endif
|
||||
# endif
|
||||
# endif
|
||||
# endif
|
||||
# endif
|
||||
# endif
|
||||
|
@ -51,18 +100,36 @@ main(int argc, char *argv[])
|
|||
# endif
|
||||
#endif
|
||||
assert(JIT_F0 == jit_f(0));
|
||||
(void)jit_callee_save_p(JIT_F0);
|
||||
assert(JIT_F1 == jit_f(1));
|
||||
(void)jit_callee_save_p(JIT_F1);
|
||||
assert(JIT_F2 == jit_f(2));
|
||||
(void)jit_callee_save_p(JIT_F2);
|
||||
assert(JIT_F3 == jit_f(3));
|
||||
(void)jit_callee_save_p(JIT_F3);
|
||||
assert(JIT_F4 == jit_f(4));
|
||||
(void)jit_callee_save_p(JIT_F4);
|
||||
assert(JIT_F5 == jit_f(5));
|
||||
(void)jit_callee_save_p(JIT_F5);
|
||||
#if defined(JIT_F6)
|
||||
assert(JIT_F6 == jit_f(6));
|
||||
(void)jit_callee_save_p(JIT_F6);
|
||||
# if defined(JIT_F7)
|
||||
assert(JIT_F7 == jit_f(7));
|
||||
(void)jit_callee_save_p(JIT_F7);
|
||||
# if defined(JIT_F8)
|
||||
assert(JIT_F8 == jit_f(8));
|
||||
(void)jit_callee_save_p(JIT_F8);
|
||||
# if defined(JIT_F9)
|
||||
assert(JIT_F9 == jit_f(9));
|
||||
(void)jit_callee_save_p(JIT_F9);
|
||||
# endif
|
||||
# endif
|
||||
# endif
|
||||
#endif
|
||||
|
||||
jit_clear_state();
|
||||
jit_destroy_state();
|
||||
finish_jit();
|
||||
|
||||
return (0);
|
||||
|
|
|
@ -137,7 +137,7 @@ ac_cv_test_arm_arm=
|
|||
ac_cv_test_arm_swf=
|
||||
|
||||
save_CFLAGS=$CFLAGS
|
||||
CFLAGS="-I$PWD/include -D_GNU_SOURCE"
|
||||
CFLAGS="$CFLAGS -I$PWD/include -D_GNU_SOURCE"
|
||||
if test x$cpu = x; then
|
||||
AC_MSG_ERROR([cpu $target_cpu not supported])
|
||||
elif test $cpu = x86; then
|
||||
|
|
|
@ -84,7 +84,9 @@
|
|||
# define __BYTE_ORDER __BIG_ENDIAN
|
||||
# elif defined(__BIG_ENDIAN__) /* ia64 hp-ux */
|
||||
# define __BYTE_ORDER __BIG_ENDIAN
|
||||
# elif defined(__i386__) /* x86 solaris */
|
||||
# elif defined(__i386__) /* 32 bit x86 solaris */
|
||||
# define __BYTE_ORDER __LITTLE_ENDIAN
|
||||
# elif defined(__x86_64__) /* 64 bit x86 solaris */
|
||||
# define __BYTE_ORDER __LITTLE_ENDIAN
|
||||
# elif defined(__MIPSEB) /* mips irix */
|
||||
# define __BYTE_ORDER __BIG_ENDIAN
|
||||
|
|
|
@ -37,7 +37,7 @@ typedef enum {
|
|||
#define jit_v(i) (_R7 + (i))
|
||||
#define jit_v_num() 3
|
||||
#define jit_arg_f_reg_p(i) ((i) >= 0 && (i) < 4)
|
||||
#define jit_f(i) (jit_cpu.abi ? _D8 + (i) : _D7 + (i))
|
||||
#define jit_f(i) (jit_cpu.abi ? _D8 + ((i)<<1) : _D0 - ((i)<<1))
|
||||
#define jit_f_num() 8
|
||||
_R12, /* ip - temporary */
|
||||
#define JIT_R0 _R4
|
||||
|
|
|
@ -37,7 +37,7 @@ typedef enum {
|
|||
#define JIT_V2 _R46
|
||||
#define JIT_V3 _R47
|
||||
#define jit_r_num() 4
|
||||
#define jit_r(n) (_R40 - (n))
|
||||
#define jit_r(n) (_R40 + (n))
|
||||
#define jit_v_num() 4
|
||||
#define jit_v(n) (_R44 + (n))
|
||||
_R0, /* constant - Always 0 */
|
||||
|
|
|
@ -28,7 +28,11 @@
|
|||
*/
|
||||
typedef enum {
|
||||
#define jit_arg_reg_p(i) ((i) >= 0 && (i) < 8)
|
||||
#define jit_r(i) (_R11 + (i))
|
||||
#if __ppc__
|
||||
# define jit_r(i) (_R11 + (i))
|
||||
#else
|
||||
# define jit_r(i) (_R28 + (i))
|
||||
#endif
|
||||
#define jit_r_num() 3
|
||||
#if __ppc__
|
||||
# define jit_v(i) (_R30 - (i))
|
||||
|
|
|
@ -18,6 +18,11 @@
|
|||
*/
|
||||
|
||||
#if PROTO
|
||||
# if __WORDSIZE == 32
|
||||
# define CVT_OFFSET -12
|
||||
# else
|
||||
# define CVT_OFFSET -8
|
||||
# endif
|
||||
# define _ST0_REGNO 0
|
||||
# define _ST1_REGNO 1
|
||||
# define _ST2_REGNO 2
|
||||
|
@ -27,11 +32,16 @@
|
|||
# define _ST6_REGNO 6
|
||||
# define _ST7_REGNO 7
|
||||
# define x87rx(code, md, rb, ri, ms) _x87rx(_jit, code, md, rb, ri, ms)
|
||||
# define fldcwm(md, rb, ri, ms) x87rx(015, md, rb, ri, ms)
|
||||
# define fstcwm(md, rb, ri, ms) _fstcwm(_jit, md, rb, ri, ms)
|
||||
static void
|
||||
_fstcwm(jit_state_t*, jit_int32_t, jit_int32_t, jit_int32_t, jit_int32_t);
|
||||
# define fldsm(md, rb, ri, ms) x87rx(010, md, rb, ri, ms)
|
||||
# define fstsm(md, rb, ri, ms) x87rx(012, md, rb, ri, ms)
|
||||
# define fldlm(md, rb, ri, ms) x87rx(050, md, rb, ri, ms)
|
||||
# define fstlm(md, rb, ri, ms) x87rx(052, md, rb, ri, ms)
|
||||
# define fisttplm(md, rb, ri, ms) x87rx(031, md, rb, ri, ms)
|
||||
# define fistlm(md, rb, ri, ms) x87rx(032, md, rb, ri, ms)
|
||||
# define fisttpqm(md, rb, ri, ms) x87rx(071, md, rb, ri, ms)
|
||||
# define fildlm(md, rb, ri, ms) x87rx(030, md, rb,ri, ms)
|
||||
# define fildqm(md, rb, ri, ms) x87rx(075, md, rb,ri, ms)
|
||||
|
@ -402,6 +412,15 @@ _x87_b##name##i_##type(jit_state_t *_jit, \
|
|||
# define dopi(name) fpr_opi(name, d, 64)
|
||||
# define dbopi(name) fpr_bopi(name, d, 64)
|
||||
|
||||
static void
|
||||
_fstcwm(jit_state_t *_jit, jit_int32_t md,
|
||||
jit_int32_t rb, jit_int32_t ri, jit_int32_t ms)
|
||||
{
|
||||
ic(0x9b);
|
||||
rex(0, 1, rb, ri, _NOREG);
|
||||
x87rx(017, md, rb, ri, ms);
|
||||
}
|
||||
|
||||
static void
|
||||
_x87rx(jit_state_t *_jit, jit_int32_t code, jit_int32_t md,
|
||||
jit_int32_t rb, jit_int32_t ri, jit_int32_t ms)
|
||||
|
@ -630,34 +649,52 @@ _x87_sqrtr_d(jit_state_t *_jit, jit_int32_t r0, jit_int32_t r1)
|
|||
static void
|
||||
_x87_truncr_d_i(jit_state_t *_jit, jit_int32_t r0, jit_int32_t r1)
|
||||
{
|
||||
pushr(_RAX_REGNO);
|
||||
#if defined(sun)
|
||||
/* for the sake of passing test cases in x87 mode, otherwise only sse
|
||||
* is supported */
|
||||
fstcwm(-4, _RBP_REGNO, _NOREG, _SCL1);
|
||||
ldxi_s(r0, _RBP_REGNO, -4);
|
||||
extr_uc(r0, r0);
|
||||
# define FPCW_CHOP 0xc00
|
||||
ori(r0, r0, FPCW_CHOP);
|
||||
stxi_s(-8, _RBP_REGNO, r0);
|
||||
fldcwm(-8, _RBP_REGNO, _NOREG, _SCL1);
|
||||
if (r1 == _ST0_REGNO)
|
||||
fistlm(CVT_OFFSET, _RBP_REGNO, _NOREG, _SCL1);
|
||||
else {
|
||||
fxchr(r1);
|
||||
fistlm(CVT_OFFSET, _RBP_REGNO, _NOREG, _SCL1);
|
||||
fxchr(r1);
|
||||
}
|
||||
fldcwm(-4, _RBP_REGNO, _NOREG, _SCL1);
|
||||
ldxi(r0, _RBP_REGNO, CVT_OFFSET);
|
||||
#else
|
||||
fldr(r1);
|
||||
fisttplm(0, _RSP_REGNO, _NOREG, _SCL1);
|
||||
popr(r0);
|
||||
fisttplm(CVT_OFFSET, _RBP_REGNO, _NOREG, _SCL1);
|
||||
ldxi_i(r0, _RBP_REGNO, CVT_OFFSET);
|
||||
#endif
|
||||
}
|
||||
|
||||
# if __WORDSIZE == 64
|
||||
static void
|
||||
_x87_truncr_d_l(jit_state_t *_jit, jit_int32_t r0, jit_int32_t r1)
|
||||
{
|
||||
pushr(_RAX_REGNO);
|
||||
fldr(r1);
|
||||
fisttpqm(0, _RSP_REGNO, _NOREG, _SCL1);
|
||||
popr(r0);
|
||||
fisttpqm(CVT_OFFSET, _RBP_REGNO, _NOREG, _SCL1);
|
||||
ldxi(r0, _RBP_REGNO, CVT_OFFSET);
|
||||
}
|
||||
# endif
|
||||
|
||||
static void
|
||||
_x87_extr_d(jit_state_t *_jit, jit_int32_t r0, jit_int32_t r1)
|
||||
{
|
||||
pushr(r1);
|
||||
stxi(CVT_OFFSET, _RBP_REGNO, r1);
|
||||
# if __WORDSIZE == 32
|
||||
fildlm(0, _RSP_REGNO, _NOREG, _SCL1);
|
||||
fildlm(CVT_OFFSET, _RBP_REGNO, _NOREG, _SCL1);
|
||||
# else
|
||||
fildqm(0, _RSP_REGNO, _NOREG, _SCL1);
|
||||
fildqm(CVT_OFFSET, _RBP_REGNO, _NOREG, _SCL1);
|
||||
# endif
|
||||
fstpr(r0 + 1);
|
||||
popr(r1);
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
|
@ -310,7 +310,11 @@ _jit_prolog(jit_state_t *_jit)
|
|||
_jitc->function->self.argi = _jitc->function->self.argf =
|
||||
_jitc->function->self.aoff = _jitc->function->self.alen = 0;
|
||||
/* sse/x87 conversion */
|
||||
#if __WORDSIZE == 32
|
||||
_jitc->function->self.aoff = -12;
|
||||
#else
|
||||
_jitc->function->self.aoff = -8;
|
||||
#endif
|
||||
_jitc->function->self.call = jit_call_default;
|
||||
jit_alloc((jit_pointer_t *)&_jitc->function->regoff,
|
||||
_jitc->reglen * sizeof(jit_int32_t));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue