From 0a0a9fb41f366de174939ad9c39d817ce64e2a87 Mon Sep 17 00:00:00 2001 From: Thomas Cort Date: Sun, 23 Jul 2006 04:45:36 +0000 Subject: [PATCH] Implement the redirector for alpha. Continue to implement more functions in jit/jit-rules-alpha.c. There is enough done on the alpha port to compile the following function "void func(void) { return; }" and call it 1,000,000 times without anything crashing. jit_dump_function shows a properly generated prolog and epilog. --- ChangeLog | 7 ++ jit/jit-apply-alpha.c | 130 +++++++++++++++++++++++++++++++-- jit/jit-apply-alpha.h | 18 ++++- jit/jit-apply-func.h | 4 + jit/jit-gen-alpha.h | 7 ++ jit/jit-rules-alpha.c | 157 +++++++++++++++++++++++++++++++++++++--- jit/jit-rules-alpha.h | 24 +++--- jit/jit-rules-alpha.ins | 77 ++++---------------- 8 files changed, 332 insertions(+), 92 deletions(-) diff --git a/ChangeLog b/ChangeLog index bda8e4f..4d14d2c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2006-07-23 Thomas Cort + + * jit/jit-apply-alpha.c jit/jit-apply-alpha.h jit/jit-apply-func.h + jit/jit-gen-alpha.h jit/jit-rules-alpha.c jit/jit-rules-alpha.h + jit/jit-rules-alpha.ins Implement the redirector for alpha. + Continue to implement more functions in jit/jit-rules-alpha.c. + 2006-07-15 Thomas Cort * jit/jit-apply-alpha.c jit/jit-gen-alpha.h jit/jit-rules-alpha.h diff --git a/jit/jit-apply-alpha.c b/jit/jit-apply-alpha.c index 9a7646b..66c79bb 100644 --- a/jit/jit-apply-alpha.c +++ b/jit/jit-apply-alpha.c @@ -82,18 +82,138 @@ void _jit_create_closure(unsigned char *buf, void *func, void *closure, void *_t void *_jit_create_redirector(unsigned char *buf, void *func, void *user_data, int abi) { alpha_inst inst = (alpha_inst) buf; - /* NOT IMPLEMENTED YET! */ + /* Allocate space for a new stack frame. (1 instruction) */ + alpha_lda(inst,ALPHA_SP,ALPHA_SP,-(16*8)); - /* Set up a new stack frame */ + /* Save the return address. (1 instruction) */ + alpha_stq(inst,ALPHA_RA,ALPHA_SP,0*8); + + /* Save the frame pointer. (1 instruction) */ + alpha_stq(inst,ALPHA_FP,ALPHA_SP,1*8); + + /* Save the integer save registers (6 instructions) */ + alpha_stq(inst,ALPHA_S0,ALPHA_SP,2*8); + alpha_stq(inst,ALPHA_S1,ALPHA_SP,3*8); + alpha_stq(inst,ALPHA_S2,ALPHA_SP,4*8); + alpha_stq(inst,ALPHA_S3,ALPHA_SP,5*8); + alpha_stq(inst,ALPHA_S4,ALPHA_SP,6*8); + alpha_stq(inst,ALPHA_S5,ALPHA_SP,7*8); + + /* Save the floating point save registers (8 instructions) */ + alpha_stt(inst,ALPHA_FS0,ALPHA_SP, 8*8); + alpha_stt(inst,ALPHA_FS1,ALPHA_SP, 9*8); + alpha_stt(inst,ALPHA_FS2,ALPHA_SP,10*8); + alpha_stt(inst,ALPHA_FS3,ALPHA_SP,11*8); + alpha_stt(inst,ALPHA_FS4,ALPHA_SP,12*8); + alpha_stt(inst,ALPHA_FS5,ALPHA_SP,13*8); + alpha_stt(inst,ALPHA_FS6,ALPHA_SP,14*8); + alpha_stt(inst,ALPHA_FS7,ALPHA_SP,15*8); + + /* Set the frame pointer (1 instruction) */ + alpha_mov(inst,ALPHA_SP,ALPHA_FP); + + /* Force any pending hardware exceptions to be raised. (1 instruction) */ + alpha_trapb(inst); + + /* Compute and load the global pointer */ + alpha_ldah(inst,ALPHA_GP,ALPHA_PV,0); + alpha_lda( inst,ALPHA_GP,ALPHA_GP,0); - /* Push the user data onto the stack "(int)(jit_nint)user_data" */ + /* Allocate space for a new stack frame. */ + alpha_lda(inst,ALPHA_SP,ALPHA_SP,-(13*8)); + + /* Save the return address. */ + alpha_stq(inst,ALPHA_RA,ALPHA_SP,0*8); + + /* Save integer register arguments as local variables */ + alpha_stq(inst,ALPHA_A0,ALPHA_SP,1*8); + alpha_stq(inst,ALPHA_A1,ALPHA_SP,2*8); + alpha_stq(inst,ALPHA_A2,ALPHA_SP,3*8); + alpha_stq(inst,ALPHA_A3,ALPHA_SP,4*8); + alpha_stq(inst,ALPHA_A4,ALPHA_SP,5*8); + alpha_stq(inst,ALPHA_A5,ALPHA_SP,6*8); + + /* Save floating-point register arguments as local variables */ + alpha_stt(inst,ALPHA_FA0,ALPHA_SP, 7*8); + alpha_stt(inst,ALPHA_FA1,ALPHA_SP, 8*8); + alpha_stt(inst,ALPHA_FA2,ALPHA_SP, 9*8); + alpha_stt(inst,ALPHA_FA3,ALPHA_SP,10*8); + alpha_stt(inst,ALPHA_FA4,ALPHA_SP,11*8); + alpha_stt(inst,ALPHA_FA5,ALPHA_SP,12*8); /* Call the redirector handling function */ + alpha_call(inst, func); + + /* Restore the return address */ + alpha_ldq(inst,ALPHA_RA,ALPHA_SP,0*8); + + /* Restore integer register arguments */ + alpha_ldq(inst,ALPHA_A0,ALPHA_SP,1*8); + alpha_ldq(inst,ALPHA_A1,ALPHA_SP,2*8); + alpha_ldq(inst,ALPHA_A2,ALPHA_SP,3*8); + alpha_ldq(inst,ALPHA_A3,ALPHA_SP,4*8); + alpha_ldq(inst,ALPHA_A4,ALPHA_SP,5*8); + alpha_ldq(inst,ALPHA_A5,ALPHA_SP,6*8); + + /* Restore floating-point register arguments */ + alpha_ldt(inst,ALPHA_FA0,ALPHA_SP, 7*8); + alpha_ldt(inst,ALPHA_FA1,ALPHA_SP, 8*8); + alpha_ldt(inst,ALPHA_FA2,ALPHA_SP, 9*8); + alpha_ldt(inst,ALPHA_FA3,ALPHA_SP,10*8); + alpha_ldt(inst,ALPHA_FA4,ALPHA_SP,11*8); + alpha_ldt(inst,ALPHA_FA5,ALPHA_SP,12*8); + + /* restore the stack pointer */ + alpha_lda(inst,ALPHA_SP,ALPHA_SP,(13*8)); + + /* Set the stack pointer */ + alpha_mov(inst,ALPHA_FP,ALPHA_SP); + + /* Restore the return address. (1 instruction) */ + alpha_ldq(inst,ALPHA_RA,ALPHA_SP,0*8); + + /* Restore the frame pointer. (1 instruction) */ + alpha_ldq(inst,ALPHA_FP,ALPHA_SP,1*8); + + /* Restore the integer save registers (6 instructions) */ + alpha_ldq(inst,ALPHA_S0,ALPHA_SP,2*8); + alpha_ldq(inst,ALPHA_S1,ALPHA_SP,3*8); + alpha_ldq(inst,ALPHA_S2,ALPHA_SP,4*8); + alpha_ldq(inst,ALPHA_S3,ALPHA_SP,5*8); + alpha_ldq(inst,ALPHA_S4,ALPHA_SP,6*8); + alpha_ldq(inst,ALPHA_S5,ALPHA_SP,7*8); + + /* Restore the floating point save registers (8 instructions) */ + alpha_ldt(inst,ALPHA_FS0,ALPHA_SP, 8*8); + alpha_ldt(inst,ALPHA_FS1,ALPHA_SP, 9*8); + alpha_ldt(inst,ALPHA_FS2,ALPHA_SP,10*8); + alpha_ldt(inst,ALPHA_FS3,ALPHA_SP,11*8); + alpha_ldt(inst,ALPHA_FS4,ALPHA_SP,12*8); + alpha_ldt(inst,ALPHA_FS5,ALPHA_SP,13*8); + alpha_ldt(inst,ALPHA_FS6,ALPHA_SP,14*8); + alpha_ldt(inst,ALPHA_FS7,ALPHA_SP,15*8); + + /* Restore the stack pointer (1 instruction) */ + alpha_lda(inst,ALPHA_SP,ALPHA_SP,16*8); + + /* Force any pending hardware exceptions to be raised. (1 instruction) */ + alpha_trapb(inst); /* Jump to the function that the redirector indicated */ - alpha_jsr(inst,ALPHA_RA,ALPHA_R0,1); + alpha_jsr(inst,ALPHA_RA,ALPHA_V0,1); + + /* Return the start of the buffer as the redirector entry point */ + return (void *)buf; +} + +void _jit_pad_buffer(unsigned char *buf, int len) { + alpha_inst inst = (alpha_inst) buf; - return (void *)inst; + if (len > 0) { + do { + alpha_nop(inst); + } while (--len); + } } #endif /* alpha */ diff --git a/jit/jit-apply-alpha.h b/jit/jit-apply-alpha.h index f541ff0..01fc109 100644 --- a/jit/jit-apply-alpha.h +++ b/jit/jit-apply-alpha.h @@ -21,6 +21,22 @@ #ifndef _JIT_APPLY_ALPHA_H #define _JIT_APPLY_ALPHA_H -/* NOT IMPLEMENTED YET! */ +/* + * The maximum number of bytes that are needed to represent a closure, + * and the alignment to use for the closure. + */ +#define jit_closure_size (32 /* instructions */ * 4 /* bytes per instruction */) +#define jit_closure_align 32 + +/* + * 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 (100 /* instructions */ * 4 /* bytes per instruction */) + +/* + * We should pad unused code space with NOP's. + */ +#define jit_should_pad 1 #endif /* _JIT_APPLY_ALPHA_H */ diff --git a/jit/jit-apply-func.h b/jit/jit-apply-func.h index 100c3fa..ebfb73a 100644 --- a/jit/jit-apply-func.h +++ b/jit/jit-apply-func.h @@ -29,6 +29,10 @@ #include "jit-apply-arm.h" +#elif defined(__alpha) || defined(__alpha__) + +#include "jit-apply-alpha.h" + #elif defined(__x86_64) || defined(__x86_64__) #include "jit-apply-x86-64.h" diff --git a/jit/jit-gen-alpha.h b/jit/jit-gen-alpha.h index fffab31..f32511e 100644 --- a/jit/jit-gen-alpha.h +++ b/jit/jit-gen-alpha.h @@ -21,6 +21,8 @@ #ifndef _JIT_GEN_ALPHA_H #define _JIT_GEN_ALPHA_H +#include "jit-rules.h" + #ifdef __cplusplus extern "C" { #endif @@ -139,6 +141,10 @@ typedef enum { typedef unsigned int * alpha_inst; +/* misc function prototypes */ +void alpha_output_branch(jit_function_t, alpha_inst, int, jit_insn_t, int); +void jump_to_epilog(jit_gencode_t, alpha_inst, jit_block_t); + #define ALPHA_REG_MASK 0x1f #define ALPHA_REGA_SHIFT 0x15 #define ALPHA_REGB_SHIFT 0x10 @@ -179,6 +185,7 @@ typedef unsigned int * alpha_inst; #define ALPHA_OP_CMPBGE 0x10 #define ALPHA_OP_S8ADDL 0x10 #define ALPHA_OP_S8SUBL 0x10 +#define ALPHA_OP_CMPLT 0x10 #define ALPHA_OP_CMPULT 0x10 #define ALPHA_OP_ADDQ 0x10 #define ALPHA_OP_S4ADDQ 0x10 diff --git a/jit/jit-rules-alpha.c b/jit/jit-rules-alpha.c index 24e48a1..581a1e0 100644 --- a/jit/jit-rules-alpha.c +++ b/jit/jit-rules-alpha.c @@ -66,6 +66,13 @@ int _alpha_has_ieeefp() { return (__implver >= 2); } +/* + * Round a size up to a multiple of the stack word size. + */ +#define ROUND_STACK(size) \ + (((size) + (sizeof(alpha_inst) - 1)) & ~(sizeof(alpha_inst) - 1)) + + /* * Setup or teardown the alpha code output process. */ @@ -79,6 +86,19 @@ int _alpha_has_ieeefp() { #define jit_cache_end_output() \ gen->posn.ptr = (char*) inst +/* + * Load the instruction pointer from the generation context. + */ +#define jit_gen_load_inst_ptr(gen,inst) \ + inst = (alpha_inst) (gen)->posn.ptr; + +/* + * Save the instruction pointer back to the generation context. + */ +#define jit_gen_save_inst_ptr(gen,inst) \ + (gen)->posn.ptr = (unsigned char *) inst; + + /* * Initialize the backend. This is normally used to configure registers * that may not appear on all CPU's in a given family. For example, only @@ -168,10 +188,9 @@ void *_jit_gen_prolog(jit_gencode_t gen, jit_function_t func, void *buf) { * epilog until the full function has been processed. */ void _jit_gen_epilog(jit_gencode_t gen, jit_function_t func) { - alpha_inst inst; void **fixup, **next; - inst = (alpha_inst) gen->posn.ptr; + jit_cache_setup_output(20); /* Perform fixups on any blocks that jump to the epilog */ fixup = (void **)(gen->epilog_fixup); @@ -181,7 +200,7 @@ void _jit_gen_epilog(jit_gencode_t gen, jit_function_t func) { fixup = next; } - /* Set the stack pointer */ + /* Set the stack pointer (1 instruction) */ alpha_mov(inst,ALPHA_FP,ALPHA_SP); /* Restore the return address. (1 instruction) */ @@ -216,6 +235,8 @@ void _jit_gen_epilog(jit_gencode_t gen, jit_function_t func) { /* Return from the current function (1 instruction) */ alpha_ret(inst,ALPHA_RA,1); + + jit_cache_end_output(); } /* @@ -230,8 +251,37 @@ void _jit_gen_epilog(jit_gencode_t gen, jit_function_t func) { * signature alone; especially if the called function is vararg. */ int _jit_create_call_return_insns(jit_function_t func, jit_type_t signature, jit_value_t *args, unsigned int num_args, jit_value_t return_value, int is_nested) { - /* NOT IMPLEMENTED YET */ - return 0; + jit_type_t return_type; + int ptr_return; + + return_type = jit_type_normalize(jit_type_get_return(signature)); + ptr_return = jit_type_return_via_pointer(return_type); + + /* Bail out now if we don't need to worry about return values */ + if (!return_value || ptr_return) { + return 0; + } + + /* + * Structure values must be flushed into the frame, and + * everything else ends up in a register + */ + if (jit_type_is_struct(return_type) || jit_type_is_union(return_type)) { + if (!jit_insn_flush_struct(func, return_value)) { + return 0; + } + } else if (return_type->kind == JIT_TYPE_FLOAT32 || return_type->kind == JIT_TYPE_FLOAT64 || return_type->kind == JIT_TYPE_NFLOAT) { + if (!jit_insn_return_reg(func, return_value, 32 /* fv0 */)) { + return 0; + } + } else if (return_type->kind != JIT_TYPE_VOID) { + if (!jit_insn_return_reg(func, return_value, 0 /* v0 */)) { + return 0; + } + } + + /* Everything is back where it needs to be */ + return 1; } /* @@ -265,7 +315,36 @@ void _jit_gen_spill_global(jit_gencode_t gen, int reg, jit_value_t value) { * position, and will then generate the appropriate spill instructions. */ void _jit_gen_spill_reg(jit_gencode_t gen, int reg, int other_reg, jit_value_t value) { - /* NOT IMPLEMENTED YET */; + int offset; + + /* Make sure that we have sufficient space */ + jit_cache_setup_output(32); + + /* If the value is associated with a global register, then copy to that */ + if (value->has_global_register) { + alpha_mov(inst,_jit_reg_info[reg].cpu_reg,_jit_reg_info[value->global_reg].cpu_reg); + jit_cache_end_output(); + return; + } + + /* Fix the value in place within the local variable frame */ + _jit_gen_fix_value(value); + + /* Output an appropriate instruction to spill the value */ + offset = (int)(value->frame_offset); + + if (reg < 32) { /* if integer register */ + alpha_stq(inst,reg,ALPHA_FP,offset); + if (other_reg != -1) { + offset += sizeof(void *); + alpha_stq(inst,other_reg,ALPHA_FP,offset); + } + } else /* floating point register */ { + /* TODO requires floating point support */ + } + + jit_cache_end_output(); + return; } /* @@ -362,6 +441,7 @@ void _jit_gen_end_block(jit_gencode_t gen, jit_block_t block) { * _jit_gen_fix_value. */ void _jit_gen_load_value(jit_gencode_t gen, int reg, int other_reg, jit_value_t value) { + short int offset; /* Make sure that we have sufficient space */ jit_cache_setup_output(32); @@ -399,7 +479,47 @@ void _jit_gen_load_value(jit_gencode_t gen, int reg, int other_reg, jit_value_t /* mov from value->reg to _jit_reg_info[reg].cpu_reg */ alpha_mov(inst,value->reg,_jit_reg_info[reg].cpu_reg); - } /* TODO else load from mem */ + } else { + + /* Fix the position of the value in the stack frame */ + _jit_gen_fix_value(value); + offset = (int)(value->frame_offset); + + /* Load the value into the specified register */ + switch (jit_type_normalize(value->type)->kind) { + + case JIT_TYPE_SBYTE: +/* TODO add alpha_ldb alpha_ldb(inst,_jit_reg_info[reg].cpu_reg,ALPHA_SP,offset); + */ break; + case JIT_TYPE_UBYTE: + alpha_ldbu(inst,_jit_reg_info[reg].cpu_reg,ALPHA_SP,offset); + break; + case JIT_TYPE_SHORT: +/* TODO add alpha_ldw alpha_ldw(inst,_jit_reg_info[reg].cpu_reg,ALPHA_SP,offset); + */ break; + case JIT_TYPE_USHORT: + alpha_ldwu(inst,_jit_reg_info[reg].cpu_reg,ALPHA_SP,offset); + break; + case JIT_TYPE_INT: + alpha_ldl(inst,_jit_reg_info[reg].cpu_reg,ALPHA_SP,offset); + break; + case JIT_TYPE_UINT: +/* TODO add alpha_ldlu alpha_ldlu(inst,_jit_reg_info[reg].cpu_reg,ALPHA_SP,offset); +*/ break; + case JIT_TYPE_LONG: + alpha_ldq(inst,_jit_reg_info[reg].cpu_reg,ALPHA_SP,offset); + break; + case JIT_TYPE_ULONG: +/* TODO add alpha_ldqu alpha_ldqu(inst,_jit_reg_info[reg].cpu_reg,ALPHA_SP,offset); +*/ break; + + /* TODO requires floating-point support */ + case JIT_TYPE_FLOAT32: + case JIT_TYPE_FLOAT64: + case JIT_TYPE_NFLOAT: + break; + } + } jit_cache_end_output(); } @@ -430,7 +550,16 @@ void *_jit_gen_redirector(jit_gencode_t gen, jit_function_t func) { * for the result to be placed in an appropriate register or memory destination. */ void _jit_gen_insn(jit_gencode_t gen, jit_function_t func, jit_block_t block, jit_insn_t insn) { - /* NOT IMPLEMENTED YET */; + + switch (insn->opcode) { + #define JIT_INCLUDE_RULES + #include "jit-rules-alpha.inc" + #undef JIT_INCLUDE_RULES + + default: + fprintf(stderr, "TODO(%x) at %s, %d\n", (int)(insn->opcode), __FILE__, (int)__LINE__); + break; + } } /* @@ -440,6 +569,16 @@ void _jit_gen_exch_top(jit_gencode_t gen, int reg, int pop) { /* NOT IMPLEMENTED YET */; } +void _jit_gen_fix_value(jit_value_t value) { + + if (!(value->has_frame_offset) && !(value->is_constant)) { + jit_nint size = (jit_nint)(ROUND_STACK(jit_type_get_size(value->type))); + value->block->func->builder->frame_size += size; + value->frame_offset = -(value->block->func->builder->frame_size); + value->has_frame_offset = 1; + } +} + /* * Output a branch instruction. */ @@ -473,7 +612,7 @@ void alpha_output_branch(jit_function_t func, alpha_inst inst, int opcode, jit_i /* * Jump to the current function's epilog. */ -void alpha_jump_to_epilog(jit_gencode_t gen, alpha_inst inst, jit_block_t block) { +void jump_to_epilog(jit_gencode_t gen, alpha_inst inst, jit_block_t block) { short int offset; /* diff --git a/jit/jit-rules-alpha.h b/jit/jit-rules-alpha.h index c196654..74dc560 100644 --- a/jit/jit-rules-alpha.h +++ b/jit/jit-rules-alpha.h @@ -96,16 +96,16 @@ extern "C" { { "gp", 29, -1, JIT_REG_FIXED}, \ { "sp", 30, -1, JIT_REG_FIXED | JIT_REG_STACK_PTR}, \ { "zero", 31, -1, JIT_REG_FIXED}, \ - { "fv0", 0, -1, JIT_REG_FIXED}, \ - { "fv1", 1, -1, JIT_REG_FIXED}, \ - { "fs0", 2, -1, JIT_REG_ALPHA_FLOAT | JIT_REG_GLOBAL}, \ - { "fs1", 3, -1, JIT_REG_ALPHA_FLOAT | JIT_REG_GLOBAL}, \ - { "fs2", 4, -1, JIT_REG_ALPHA_FLOAT | JIT_REG_GLOBAL}, \ - { "fs3", 5, -1, JIT_REG_ALPHA_FLOAT | JIT_REG_GLOBAL}, \ - { "fs4", 6, -1, JIT_REG_ALPHA_FLOAT | JIT_REG_GLOBAL}, \ - { "fs5", 7, -1, JIT_REG_ALPHA_FLOAT | JIT_REG_GLOBAL}, \ - { "fs6", 8, -1, JIT_REG_ALPHA_FLOAT | JIT_REG_GLOBAL}, \ - { "fs7", 9, -1, JIT_REG_ALPHA_FLOAT | JIT_REG_GLOBAL}, \ + { "fv0", 0, -1, JIT_REG_FIXED}, \ + { "fv1", 1, -1, JIT_REG_FIXED}, \ + { "fs0", 2, -1, JIT_REG_ALPHA_FLOAT | JIT_REG_GLOBAL}, \ + { "fs1", 3, -1, JIT_REG_ALPHA_FLOAT | JIT_REG_GLOBAL}, \ + { "fs2", 4, -1, JIT_REG_ALPHA_FLOAT | JIT_REG_GLOBAL}, \ + { "fs3", 5, -1, JIT_REG_ALPHA_FLOAT | JIT_REG_GLOBAL}, \ + { "fs4", 6, -1, JIT_REG_ALPHA_FLOAT | JIT_REG_GLOBAL}, \ + { "fs5", 7, -1, JIT_REG_ALPHA_FLOAT | JIT_REG_GLOBAL}, \ + { "fs6", 8, -1, JIT_REG_ALPHA_FLOAT | JIT_REG_GLOBAL}, \ + { "fs7", 9, -1, JIT_REG_ALPHA_FLOAT | JIT_REG_GLOBAL}, \ { "ft0", 10, -1, JIT_REG_ALPHA_FLOAT | JIT_REG_CALL_USED}, \ { "ft1", 11, -1, JIT_REG_ALPHA_FLOAT | JIT_REG_CALL_USED}, \ { "ft2", 12, -1, JIT_REG_ALPHA_FLOAT | JIT_REG_CALL_USED}, \ @@ -200,10 +200,8 @@ extern "C" { */ #define JIT_CDECL_WORD_REG_PARAMS {9,10,11,12,13,14,-1} #define JIT_MAX_WORD_REG_PARAMS 6 - -/* TODO: find the proper values for these */ #define JIT_INITIAL_STACK_OFFSET 0 -#define JIT_INITIAL_FRAME_SIZE 0 +#define JIT_INITIAL_FRAME_SIZE (14*8) #ifdef __cplusplus }; diff --git a/jit/jit-rules-alpha.ins b/jit/jit-rules-alpha.ins index b3b6d2f..10c0cbf 100644 --- a/jit/jit-rules-alpha.ins +++ b/jit/jit-rules-alpha.ins @@ -26,26 +26,26 @@ JIT_OP_TRUNC_SBYTE: unary [reg] -> { - alpha_slli(code,$1,56,$1); - alpha_srai(code,$1,56,$1); + alpha_slli(inst,$1,56,$1); + alpha_srai(inst,$1,56,$1); } JIT_OP_TRUNC_UBYTE: unary [reg] -> { - alpha_li8(code,ALPHA_AT,0xff); - alpha_and(code,$1,ALPHA_AT,$1); + _alpha_li8(inst,ALPHA_AT,0xff); + alpha_and(inst,$1,ALPHA_AT,$1); } JIT_OP_TRUNC_SHORT: unary [reg] -> { - alpha_slli(code,$1,56,$1); - alpha_srai(code,$1,56,$1); + alpha_slli(inst,$1,56,$1); + alpha_srai(inst,$1,56,$1); } JIT_OP_TRUNC_USHORT: unary [reg] -> { - alpha_slli(code,$1,56,$1); - alpha_srli(code,$1,56,$1); + alpha_slli(inst,$1,56,$1); + alpha_srli(inst,$1,56,$1); } /* @@ -184,7 +184,7 @@ JIT_OP_IXOR: binary JIT_OP_INOT: unary [reg] -> { - alpha_li32(inst,ALPHA_AT,0xffffffff); + _alpha_li32(inst,ALPHA_AT,0xffffffff); alpha_xor(inst,ALPHA_AT,$1,$1); } @@ -213,7 +213,7 @@ JIT_OP_LXOR: binary JIT_OP_LNOT: unary [reg] -> { - alpha_li64(inst,ALPHA_AT,0xffffffff); + _alpha_li64(inst,ALPHA_AT,0xffffffff); alpha_xor(inst,ALPHA_AT,$1,$1); } @@ -308,41 +308,8 @@ JIT_OP_BR_ILE_UN: binary_branch } -JIT_OP_BR_IGT: binary_branch - [reg, reg] -> { - /* $1 > $2 -> $at */ - alpha_cmpgt(inst, $1, $2, ALPHA_AT); - - /* branch if $at == 1 */ - alpha_output_branch(func, inst, ALPHA_OP_BEQ, insn, ALPHA_AT); - } - -JIT_OP_BR_IGT_UN: binary_branch - [reg, reg] -> { - /* $1 > $2 -> $at */ - alpha_cmpugt(inst, $1, $2, ALPHA_AT); - - /* branch if $at == 1 */ - alpha_output_branch(func, inst, ALPHA_OP_BEQ, insn, ALPHA_AT); - } - -JIT_OP_BR_IGE: binary_branch - [reg, reg] -> { - /* $1 >= $2 -> $at */ - alpha_cmpge(inst, $1, $2, ALPHA_AT); - - /* branch if $at == 1 */ - alpha_output_branch(func, inst, ALPHA_OP_BEQ, insn, ALPHA_AT); - } - -JIT_OP_BR_IGE_UN: binary_branch - [reg, reg] -> { - /* $1 => $2 -> $at */ - alpha_cmpugt(inst, $1, $2, ALPHA_AT); - - /* branch if $at == 1 */ - alpha_output_branch(func, inst, ALPHA_OP_BEQ, insn, ALPHA_AT); - } +/* TODO: JIT_OP_BR_IGT JIT_OP_BR_IGT_UN */ +/* TODO: JIT_OP_BR_IGE JIT_OP_BR_IGE_UN */ /* @@ -381,25 +348,7 @@ JIT_OP_ILE_UN: binary alpha_cmpule(inst,$3,$2,$1); } -JIT_OP_IGT: binary - [=reg, reg, reg] -> { - alpha_cmpgt(inst,$3,$2,$1); - } - -JIT_OP_IGT_UN: binary - [=reg, reg, reg] -> { - alpha_cmpugt(inst,$3,$2,$1); - } - -JIT_OP_IGE: binary - [=reg, reg, reg] -> { - alpha_cmpge(inst,$3,$2,$1); - } - -JIT_OP_IGE_UN: binary - [=reg, reg, reg] -> { - alpha_cmpuge(inst,$3,$2,$1); - } +/* TODO: JIT_OP_IGT JIT_OP_IGT_UN JIT_OP_IGE JIT_OP_IGE_UN */ /* * Mathematical opcodes. -- 2.47.3