]> git.unchartedbackwaters.co.uk Git - francis/libjit.git/commitdiff
Add macros for int to fp and fp to int conversions. Use _jit_pad_bufer.
authorThomas Cort <linuxgeek@gmail.com>
Mon, 21 Aug 2006 14:23:44 +0000 (14:23 +0000)
committerThomas Cort <linuxgeek@gmail.com>
Mon, 21 Aug 2006 14:23:44 +0000 (14:23 +0000)
ChangeLog
jit/jit-gen-alpha.h
jit/jit-rules-alpha.c

index e8149aebf841b87acaba25e81fd501cfc5628d37..8e241bfbfc9df50d00337d6d733c6330f75b0689 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2006-08-21  Thomas Cort  <linuxgeek@gmail.com>
+       * jit/jit-rules-alpha.c jit/jit-gen-alpha.h: Add macros for
+       int to fp and fp to int conversions. Use _jit_pad_bufer.
+
 2006-08-20  Thomas Cort  <linuxgeek@gmail.com>
 
        * jit/jit-apply-alpha.c jit/jit-apply-alpha.h jit/jit-rules-alpha.h
index 3662b1619660dbbe735e2cd9dacf0cf7268b23be..ae93dfd80ada8a4f7f90eff44bda23b3d4fc9032 100644 (file)
@@ -157,6 +157,7 @@ void jump_to_epilog(jit_gencode_t, alpha_inst, jit_block_t);
 #define ALPHA_LIT_SHIFT                0x0d
 
 #define ALPHA_FUNC_MASK                0x7f
+#define ALPHA_FP_FUNC_MASK     0x7ff
 #define ALPHA_FUNC_SHIFT       0x5
 
 #define ALPHA_FUNC_MEM_BRANCH_MASK     0x3
@@ -254,11 +255,16 @@ void jump_to_epilog(jit_gencode_t, alpha_inst, jit_block_t);
 #define ALPHA_OP_UMULH         0x13
 #define ALPHA_OP_MULLV         0x13
 #define ALPHA_OP_MULLQV                0x13
+#define ALPHA_OP_ITOFS         0x14
+#define ALPHA_OP_ITOFF         0x14
+#define ALPHA_OP_ITOFT         0x14
 #define ALPHA_OP_TRAPB         0x18
 #define ALPHA_OP_JMP           0x1a
 #define ALPHA_OP_JSR           0x1a
 #define ALPHA_OP_RET           0x1a
 #define ALPHA_OP_JSRCO         0x1a
+#define ALPHA_OP_FTOIT         0x1c
+#define ALPHA_OP_FTOIS         0x1c
 #define ALPHA_OP_LDF           0x20
 #define ALPHA_OP_LDG           0x21
 #define ALPHA_OP_LDS           0x22
@@ -379,6 +385,11 @@ void jump_to_epilog(jit_gencode_t, alpha_inst, jit_block_t);
 #define ALPHA_FUNC_MULLV       0x40
 #define ALPHA_FUNC_MULQV       0x60
 
+/* integer to floating point operations -- use with ALPHA_OP_* == 0x14 */
+#define ALPHA_FUNC_ITOFS       0x4
+#define ALPHA_FUNC_ITOFF       0x14
+#define ALPHA_FUNC_ITOFT       0x24
+
 /* trap barrier -- use with ALPHA_OP_* == 0x18 */
 #define ALPHA_FUNC_TRAPB       0x0
 
@@ -388,6 +399,9 @@ void jump_to_epilog(jit_gencode_t, alpha_inst, jit_block_t);
 #define ALPHA_FUNC_RET         0x2
 #define ALPHA_FUNC_JSRCO       0x3
 
+/* floating point to integer operations -- use with ALPHA_OP_* == 0x1c */
+#define ALPHA_FUNC_FTOIT       0x70
+#define ALPHA_FUNC_FTOIS       0x78
 
 /* encode registers */
 #define alpha_encode_reg_a(reg) \
@@ -411,6 +425,9 @@ void jump_to_epilog(jit_gencode_t, alpha_inst, jit_block_t);
 #define alpha_encode_func(func) \
        ((func & ALPHA_FUNC_MASK) << ALPHA_FUNC_SHIFT)
 
+#define alpha_encode_fp_func(func) \
+       ((func & ALPHA_FP_FUNC_MASK) << ALPHA_FUNC_SHIFT)
+
 #define alpha_encode_func_mem_branch(func,hint) \
        (((func & ALPHA_FUNC_MEM_BRANCH_MASK) << ALPHA_FUNC_MEM_BRANCH_SHIFT) | \
                (hint & ALPHA_HINT_MASK))
@@ -428,6 +445,11 @@ void jump_to_epilog(jit_gencode_t, alpha_inst, jit_block_t);
                alpha_encode_reg_b(sreg1)| alpha_encode_reg_c(dreg)  | \
                alpha_encode_func(func))
 
+#define alpha_encode_fpops(inst,op,func,sreg0,sreg1,dreg) \
+       *(inst)++ = (alpha_encode_op(op) | alpha_encode_reg_a(sreg0) | \
+               alpha_encode_reg_b(sreg1)| alpha_encode_reg_c(dreg)  | \
+               alpha_encode_fp_func(func))
+
 #define alpha_encode_mem_branch(inst,op,func,dreg,sreg,hint) \
        *(inst)++ = (alpha_encode_op(op) | alpha_encode_reg_a(dreg) | \
                alpha_encode_reg_b(sreg) | \
@@ -621,10 +643,15 @@ void jump_to_epilog(jit_gencode_t, alpha_inst, jit_block_t);
 #define alpha_bge(inst,reg,offset)             alpha_encode_branch(inst,ALPHA_OP_BGE,reg,offset)
 #define alpha_bgt(inst,reg,offset)             alpha_encode_branch(inst,ALPHA_OP_BGT,reg,offset)
 
-/*
- * load immediate pseudo instruction.
- */
+/* Floating point conversion instructions */
+#define alpha_ftoit(inst,fsreg,dreg)           alpha_encode_fpop(inst,ALPHA_OP_FTOIT,ALPHA_FUNC_FTOIT,fsreg,ALPHA_ZERO,dreg)
+#define alpha_ftois(inst,fsreg,dreg)           alpha_encode_fpop(inst,ALPHA_OP_FTOIS,ALPHA_FUNC_FTOIS,fsreg,ALPHA_ZERO,dreg)
+
+#define alpha_itofs(inst,sreg,fdreg)           alpha_encode_fpop(inst,ALPHA_OP_ITOFS,ALPHA_FUNC_ITOFS,sreg,ALPHA_ZERO,fdreg)
+#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)
 
+/* load immediate pseudo instruction. */
 #define _alpha_li64(code,dreg,val)                             \
 do {                                                           \
        unsigned long c1 = val;                                 \
index 1d77464c0848a2467df783469da4ebbb6adaa993..c49c906c2366593da60c60df6167541827a7ba59 100644 (file)
@@ -586,12 +586,7 @@ void alpha_output_branch(jit_function_t func, alpha_inst inst, int opcode, jit_i
                *addr = (long) block->fixup_list;
                inst++; inst++;
 
-               alpha_nop(inst);
-               alpha_nop(inst);
-               alpha_nop(inst);
-               alpha_nop(inst);
-               alpha_nop(inst);
-               alpha_nop(inst);
+               _jit_pad_buffer((char*)inst,6);
        }
 }
 
@@ -630,12 +625,7 @@ void jump_to_epilog(jit_gencode_t gen, alpha_inst inst, jit_block_t block) {
        *addr = (long) gen->epilog_fixup;
        inst++; inst++;
 
-       alpha_nop(inst);
-       alpha_nop(inst);
-       alpha_nop(inst);
-       alpha_nop(inst);
-       alpha_nop(inst);
-       alpha_nop(inst);        /* to be overwritten later with jmp */
+       _jit_pad_buffer((char*)inst,6); /* to be overwritten later with jmp */
 
        (gen)->posn.ptr = (char*) inst;
 }