From 4d5b4360fc534ef603b7c598c14a3788e7133f8f Mon Sep 17 00:00:00 2001 From: Thomas Cort Date: Tue, 22 Aug 2006 23:41:32 +0000 Subject: [PATCH] * jit/jit-apply-alpha.c jit/jit-apply-alpha.h: Fix jit_redirector_size. alpha_call is 6 instructions, not 1. 5 to load the addr, 1 to call. * jit/jit-gen-alpha.h: add macros for fp sign copy and arithmetic. * jit/jit-rules-alpha.c: remove TODO() from unused functions. --- ChangeLog | 9 +++++++++ jit/jit-apply-alpha.c | 2 +- jit/jit-apply-alpha.h | 2 +- jit/jit-gen-alpha.h | 35 +++++++++++++++++++++++++++++++++++ jit/jit-rules-alpha.c | 22 +++++++--------------- 5 files changed, 53 insertions(+), 17 deletions(-) diff --git a/ChangeLog b/ChangeLog index cf9c3c3..251f90e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +2006-08-23 Thomas Cort + + * jit/jit-apply-alpha.c jit/jit-apply-alpha.h: Fix jit_redirector_size. + alpha_call is 6 instructions, not 1. 5 to load the addr, 1 to call. + + * jit/jit-gen-alpha.h: add macros for fp sign copy and arithmetic. + + * jit/jit-rules-alpha.c: remove TODO() from unused functions. + 2006-08-23 Aleksey Demakov * jit/jit-internal.h (struct _jit_function): change the type of diff --git a/jit/jit-apply-alpha.c b/jit/jit-apply-alpha.c index 9c07a20..7e30369 100644 --- a/jit/jit-apply-alpha.c +++ b/jit/jit-apply-alpha.c @@ -119,7 +119,7 @@ void *_jit_create_redirector(unsigned char *buf, void *func, void *user_data, in /* Force any pending hardware exceptions to be raised. (1 instruction) */ alpha_trapb(inst); - /* Call the redirector handling function (1 instruction) */ + /* Call the redirector handling function (6 instruction) */ alpha_call(inst, func); /* Restore the return address. (1 instruction) */ diff --git a/jit/jit-apply-alpha.h b/jit/jit-apply-alpha.h index 63d5e4c..0f4d542 100644 --- a/jit/jit-apply-alpha.h +++ b/jit/jit-apply-alpha.h @@ -32,7 +32,7 @@ * The number of bytes that are needed for a redirector stub. * This includes any extra bytes that are needed for alignment. */ -#define jit_redirector_size (41 /* instructions */ * 4 /* bytes per instruction */) +#define jit_redirector_size (46 /* instructions */ * 4 /* bytes per instruction */) /* * We should pad unused code space with NOP's. diff --git a/jit/jit-gen-alpha.h b/jit/jit-gen-alpha.h index ae93dfd..d1b13a3 100644 --- a/jit/jit-gen-alpha.h +++ b/jit/jit-gen-alpha.h @@ -258,6 +258,15 @@ void jump_to_epilog(jit_gencode_t, alpha_inst, jit_block_t); #define ALPHA_OP_ITOFS 0x14 #define ALPHA_OP_ITOFF 0x14 #define ALPHA_OP_ITOFT 0x14 +#define ALPHA_OP_ADDS 0x16 +#define ALPHA_OP_SUBS 0x16 +#define ALPHA_OP_ADDT 0x16 +#define ALPHA_OP_SUBT 0x16 +#define ALPHA_OP_MULT 0x16 +#define ALPHA_OP_DIVT 0x16 +#define ALPHA_OP_CPYS 0x17 +#define ALPHA_OP_CPYSN 0x17 +#define ALPHA_OP_CPYSE 0x17 #define ALPHA_OP_TRAPB 0x18 #define ALPHA_OP_JMP 0x1a #define ALPHA_OP_JSR 0x1a @@ -390,6 +399,19 @@ void jump_to_epilog(jit_gencode_t, alpha_inst, jit_block_t); #define ALPHA_FUNC_ITOFF 0x14 #define ALPHA_FUNC_ITOFT 0x24 +/* floating point arithmetic operations -- use with ALPHA_OP_* == 0x16 */ +#define ALPHA_FUNC_ADDS 0x80 +#define ALPHA_FUNC_SUBS 0x81 +#define ALPHA_FUNC_ADDT 0xA0 +#define ALPHA_FUNC_SUBT 0xA1 +#define ALPHA_FUNC_MULT 0xA2 +#define ALPHA_FUNC_DIVT 0xA3 + +/* floating point sign copy operations -- use with ALPHA_OP_* == 0x17 */ +#define ALPHA_FUNC_CPYS 0x20 +#define ALPHA_FUNC_CPYSN 0x21 +#define ALPHA_FUNC_CPYSE 0x22 + /* trap barrier -- use with ALPHA_OP_* == 0x18 */ #define ALPHA_FUNC_TRAPB 0x0 @@ -651,6 +673,19 @@ void jump_to_epilog(jit_gencode_t, alpha_inst, jit_block_t); #define alpha_itoff(inst,sreg,fdreg) alpha_encode_fpop(inst,ALPHA_OP_ITOFF,ALPHA_FUNC_ITOFF,sreg,ALPHA_ZERO,fdreg) #define alpha_itoft(inst,sreg,fdreg) alpha_encode_fpop(inst,ALPHA_OP_ITOFT,ALPHA_FUNC_ITOFT,sreg,ALPHA_ZERO,fdreg) +/* Floating point arithmetic instructions */ +#define alpha_adds(inst,fsreg0,fsreg1,fdreg) alpha_encode_fpop(inst,ALPHA_OP_ADDS,ALPHA_FUNC_ADDS,fsreg0,fsreg1,fdreg) +#define alpha_subs(inst,fsreg0,fsreg1,fdreg) alpha_encode_fpop(inst,ALPHA_OP_SUBS,ALPHA_FUNC_SUBS,fsreg0,fsreg1,fdreg) +#define alpha_addt(inst,fsreg0,fsreg1,fdreg) alpha_encode_fpop(inst,ALPHA_OP_ADDT,ALPHA_FUNC_ADDT,fsreg0,fsreg1,fdreg) +#define alpha_subt(inst,fsreg0,fsreg1,fdreg) alpha_encode_fpop(inst,ALPHA_OP_SUBT,ALPHA_FUNC_SUBT,fsreg0,fsreg1,fdreg) +#define alpha_mult(inst,fsreg0,fsreg1,fdreg) alpha_encode_fpop(inst,ALPHA_OP_MULT,ALPHA_FUNC_MULT,fsreg0,fsreg1,fdreg) +#define alpha_divt(inst,fsreg0,fsreg1,fdreg) alpha_encode_fpop(inst,ALPHA_OP_DIVT,ALPHA_FUNC_DIVT,fsreg0,fsreg1,fdreg) + +/* Floating point sign copy instructions */ +#define alpha_cpys(inst,fsreg0,fsreg1,fdreg) alpha_encode_fpop(inst,ALPHA_OP_CPYS,ALPHA_FUNC_CPYS,fsreg0,fsreg1,fdreg) +#define alpha_cpysn(inst,fsreg0,fsreg1,fdreg) alpha_encode_fpop(inst,ALPHA_OP_CPYSN,ALPHA_FUNC_CPYSN,fsreg0,fsreg1,fdreg) +#define alpha_cpyse(inst,fsreg0,fsreg1,fdreg) alpha_encode_fpop(inst,ALPHA_OP_CPYSE,ALPHA_FUNC_CPYSE,fsreg0,fsreg1,fdreg) + /* load immediate pseudo instruction. */ #define _alpha_li64(code,dreg,val) \ do { \ diff --git a/jit/jit-rules-alpha.c b/jit/jit-rules-alpha.c index c49c906..d9c7371 100644 --- a/jit/jit-rules-alpha.c +++ b/jit/jit-rules-alpha.c @@ -267,18 +267,17 @@ int _jit_setup_indirect_pointer(jit_function_t func, jit_value_t value) { return 0; } -/* - * TODO: write what this function is supposed to do - */ +void _jit_gen_exch_top(jit_gencode_t gen, int reg, int pop) { + /* not used by alpha */; +} + + void _jit_gen_spill_top(jit_gencode_t gen, int reg, jit_value_t value, int pop) { - TODO(); + /* not used by alpha */; } -/* - * TODO: write what this function is supposed to do - */ void _jit_gen_spill_global(jit_gencode_t gen, int reg, jit_value_t value) { - TODO(); + /* not used by alpha */; } /* @@ -548,13 +547,6 @@ void _jit_gen_insn(jit_gencode_t gen, jit_function_t func, jit_block_t block, ji } } -/* - * TODO: write what this function is supposed to do - */ -void _jit_gen_exch_top(jit_gencode_t gen, int reg, int pop) { - TODO(); -} - void _jit_gen_fix_value(jit_value_t value) { if (!(value->has_frame_offset) && !(value->is_constant)) { -- 2.47.3