OP_{SHR, USHR, SHL} now denotes 32bit operations,
OP_{SHR, USHR, SHL}_64 represent 64bit operations.

This is necessary because we cannot provide "optimised" reg, EXPR_LOCAL
rules for 64bit shifts easily on x86.

Signed-off-by: Arthur HUILLET <arthur.huil...@free.fr>
---
 arch/x86/insn-selector_32.brg |   15 +++++++++++++++
 include/jit/expression.h      |    3 +++
 jit/arithmetic-bc.c           |    6 +++---
 test/jit/arithmetic-bc-test.c |    6 +++---
 4 files changed, 24 insertions(+), 6 deletions(-)

diff --git a/arch/x86/insn-selector_32.brg b/arch/x86/insn-selector_32.brg
index c1500d1..1ed7027 100644
--- a/arch/x86/insn-selector_32.brg
+++ b/arch/x86/insn-selector_32.brg
@@ -329,16 +329,31 @@ reg:      OP_SHL(reg, EXPR_LOCAL) 1
        shift_reg_local(state, s, tree, INSN_SHL_REG_REG);
 }
 
+reg:   OP_SHL_64(reg, reg) 1
+{
+       assert(!"SHL_64 todo");
+}
+
 reg:   OP_SHR(reg, EXPR_LOCAL) 1
 {
        shift_reg_local(state, s, tree, INSN_SAR_REG_REG);
 }
 
+reg:   OP_SHR_64(reg, reg) 1
+{
+       assert(!"SHR_64 todo");
+}
+
 reg:   OP_USHR(reg, EXPR_LOCAL) 1
 {
        shift_reg_local(state, s, tree, INSN_SHR_REG_REG);
 }
 
+reg:   OP_USHR_64(reg, reg) 1
+{
+       assert(!"USHR_64 todo");
+}
+
 reg:   OP_OR(reg, EXPR_LOCAL) 1
 {
        struct expression *expr;
diff --git a/include/jit/expression.h b/include/jit/expression.h
index e39843e..834ce48 100644
--- a/include/jit/expression.h
+++ b/include/jit/expression.h
@@ -45,8 +45,11 @@ enum binary_operator {
        OP_REM_64,
 
        OP_SHL,
+       OP_SHL_64,
        OP_SHR,
+       OP_SHR_64,
        OP_USHR,
+       OP_USHR_64,
        OP_AND,
        OP_OR,
        OP_XOR,
diff --git a/jit/arithmetic-bc.c b/jit/arithmetic-bc.c
index 54b3dcd..a93ff82 100644
--- a/jit/arithmetic-bc.c
+++ b/jit/arithmetic-bc.c
@@ -176,7 +176,7 @@ int convert_ishl(struct parse_context *ctx)
 
 int convert_lshl(struct parse_context *ctx)
 {
-       return convert_binop(ctx, J_LONG, OP_SHL);
+       return convert_binop(ctx, J_LONG, OP_SHL_64);
 }
 
 int convert_ishr(struct parse_context *ctx)
@@ -186,7 +186,7 @@ int convert_ishr(struct parse_context *ctx)
 
 int convert_lshr(struct parse_context *ctx)
 {
-       return convert_binop(ctx, J_LONG, OP_SHR);
+       return convert_binop(ctx, J_LONG, OP_SHR_64);
 }
 
 int convert_iushr(struct parse_context *ctx)
@@ -196,7 +196,7 @@ int convert_iushr(struct parse_context *ctx)
 
 int convert_lushr(struct parse_context *ctx)
 {
-       return convert_binop(ctx, J_LONG, OP_USHR);
+       return convert_binop(ctx, J_LONG, OP_USHR_64);
 }
 
 int convert_iand(struct parse_context *ctx)
diff --git a/test/jit/arithmetic-bc-test.c b/test/jit/arithmetic-bc-test.c
index c1af209..6de2dff 100644
--- a/test/jit/arithmetic-bc-test.c
+++ b/test/jit/arithmetic-bc-test.c
@@ -141,19 +141,19 @@ void test_convert_neg(void)
 void test_convert_shl(void)
 {
        assert_convert_binop(J_INT, OP_SHL, OPC_ISHL);
-       assert_convert_binop(J_LONG, OP_SHL, OPC_LSHL);
+       assert_convert_binop(J_LONG, OP_SHL_64, OPC_LSHL);
 }
 
 void test_convert_shr(void)
 {
        assert_convert_binop(J_INT, OP_SHR, OPC_ISHR);
-       assert_convert_binop(J_LONG, OP_SHR, OPC_LSHR);
+       assert_convert_binop(J_LONG, OP_SHR_64, OPC_LSHR);
 }
 
 void test_convert_ushr(void)
 {
        assert_convert_binop(J_INT, OP_USHR, OPC_IUSHR);
-       assert_convert_binop(J_LONG, OP_USHR, OPC_LUSHR);
+       assert_convert_binop(J_LONG, OP_USHR_64, OPC_LUSHR);
 }
 
 void test_convert_and(void)
-- 
1.6.2.2


------------------------------------------------------------------------------
Stay on top of everything new and different, both inside and 
around Java (TM) technology - register by April 22, and save
$200 on the JavaOne (SM) conference, June 2-5, 2009, San Francisco.
300 plus technical and hands-on sessions. Register today. 
Use priority code J9JMT32. http://p.sf.net/sfu/p
_______________________________________________
Jatovm-devel mailing list
Jatovm-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jatovm-devel

Reply via email to