[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[dotgnu-pnet-commits] pnet ./ChangeLog engine/jitc_arith.c
From: |
Klaus Treichel |
Subject: |
[dotgnu-pnet-commits] pnet ./ChangeLog engine/jitc_arith.c |
Date: |
Sat, 31 Dec 2005 10:25:40 +0000 |
CVSROOT: /cvsroot/dotgnu-pnet
Module name: pnet
Branch:
Changes by: Klaus Treichel <address@hidden> 05/12/31 10:25:40
Modified files:
. : ChangeLog
engine : jitc_arith.c
Log message:
Add first version of the arithmetic functions.
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/dotgnu-pnet/pnet/ChangeLog.diff?tr1=1.3263&tr2=1.3264&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/dotgnu-pnet/pnet/engine/jitc_arith.c.diff?tr1=1.1&tr2=1.2&r1=text&r2=text
Patches:
Index: pnet/ChangeLog
diff -u pnet/ChangeLog:1.3263 pnet/ChangeLog:1.3264
--- pnet/ChangeLog:1.3263 Sat Dec 31 09:16:04 2005
+++ pnet/ChangeLog Sat Dec 31 10:25:39 2005
@@ -1,3 +1,7 @@
+2005-12-31 Kirill Kononenko <address@hidden>
+
+ * engine/jitc_arith.c: Implement first version of the arithmetic
functions.
+
2005-12-31 Klaus Treichel <address@hidden>
* engine/jitc_branch.c: switch value1 and value2 in the jit_insn_
compare
Index: pnet/engine/jitc_arith.c
diff -u pnet/engine/jitc_arith.c:1.1 pnet/engine/jitc_arith.c:1.2
--- pnet/engine/jitc_arith.c:1.1 Mon Dec 19 18:00:35 2005
+++ pnet/engine/jitc_arith.c Sat Dec 31 10:25:39 2005
@@ -26,6 +26,164 @@
static void JITCoder_Binary(ILCoder *coder, int opcode,
ILEngineType type1,
ILEngineType type2)
{
+
+ ILJITCoder *jitCoder = _ILCoderToILJITCoder(coder);
+
+ switch(opcode)
+ {
+ case IL_OP_ADD:
+ {
+ jitCoder->jitStack[jitCoder->stackTop - 2] =
jit_insn_add(jitCoder->jitFunction,
+
jitCoder->jitStack[jitCoder->stackTop - 2],
+
jitCoder->jitStack[jitCoder->stackTop - 1]);
+ JITC_ADJUST(jitCoder, -1);
+ }
+ break;
+
+ case IL_OP_ADD_OVF:
+ {
+ jitCoder->jitStack[jitCoder->stackTop - 2] =
jit_insn_add_ovf(jitCoder->jitFunction,
+
jitCoder->jitStack[jitCoder->stackTop - 2],
+
jitCoder->jitStack[jitCoder->stackTop - 1]);
+ JITC_ADJUST(jitCoder, -1);
+
+ }
+ break;
+
+ case IL_OP_ADD_OVF_UN:
+ {
+ jitCoder->jitStack[jitCoder->stackTop - 2] =
jit_insn_add_ovf(jitCoder->jitFunction,
+
jitCoder->jitStack[jitCoder->stackTop - 2],
+
jitCoder->jitStack[jitCoder->stackTop - 1]);
+ JITC_ADJUST(jitCoder, -1);
+ }
+ break;
+
+ case IL_OP_SUB:
+ {
+ jitCoder->jitStack[jitCoder->stackTop - 2] =
jit_insn_sub(jitCoder->jitFunction,
+
jitCoder->jitStack[jitCoder->stackTop - 2],
+
jitCoder->jitStack[jitCoder->stackTop - 1]);
+ JITC_ADJUST(jitCoder, -1);
+
+ }
+ break;
+
+ case IL_OP_SUB_OVF:
+ {
+ jitCoder->jitStack[jitCoder->stackTop - 2] =
jit_insn_sub_ovf(jitCoder->jitFunction,
+
jitCoder->jitStack[jitCoder->stackTop - 2],
+
jitCoder->jitStack[jitCoder->stackTop - 1]);
+ JITC_ADJUST(jitCoder, -1);
+
+ }
+ break;
+
+ case IL_OP_SUB_OVF_UN:
+ {
+ jitCoder->jitStack[jitCoder->stackTop - 2] =
jit_insn_sub_ovf(jitCoder->jitFunction,
+
jitCoder->jitStack[jitCoder->stackTop - 2],
+
jitCoder->jitStack[jitCoder->stackTop - 1]);
+ JITC_ADJUST(jitCoder, -1);
+ }
+ break;
+
+ case IL_OP_MUL:
+ {
+ jitCoder->jitStack[jitCoder->stackTop - 2] =
jit_insn_mul(jitCoder->jitFunction,
+
jitCoder->jitStack[jitCoder->stackTop - 2],
+
jitCoder->jitStack[jitCoder->stackTop - 1]);
+ JITC_ADJUST(jitCoder, -1);
+ }
+ break;
+
+ case IL_OP_MUL_OVF:
+ {
+ jitCoder->jitStack[jitCoder->stackTop - 2] =
jit_insn_mul_ovf(jitCoder->jitFunction,
+
jitCoder->jitStack[jitCoder->stackTop - 2],
+
jitCoder->jitStack[jitCoder->stackTop - 1]);
+ JITC_ADJUST(jitCoder, -1);
+ }
+ break;
+
+ case IL_OP_MUL_OVF_UN:
+ {
+
+ jitCoder->jitStack[jitCoder->stackTop - 2] =
jit_insn_mul_ovf(jitCoder->jitFunction,
+
jitCoder->jitStack[jitCoder->stackTop - 2],
+
jitCoder->jitStack[jitCoder->stackTop - 1]);
+ JITC_ADJUST(jitCoder, -1);
+ }
+ break;
+
+ case IL_OP_DIV:
+
+ {
+ jitCoder->jitStack[jitCoder->stackTop - 2] =
jit_insn_div(jitCoder->jitFunction,
+
jitCoder->jitStack[jitCoder->stackTop - 2],
+
jitCoder->jitStack[jitCoder->stackTop - 1]);
+ JITC_ADJUST(jitCoder, -1);
+ }
+ break;
+
+ case IL_OP_DIV_UN:
+ {
+
+ jitCoder->jitStack[jitCoder->stackTop - 2] =
jit_insn_div(jitCoder->jitFunction,
+
jitCoder->jitStack[jitCoder->stackTop - 2],
+
jitCoder->jitStack[jitCoder->stackTop - 1]);
+ JITC_ADJUST(jitCoder, -1);
+ }
+ break;
+
+ case IL_OP_REM:
+ {
+ jitCoder->jitStack[jitCoder->stackTop - 2] =
jit_insn_rem_ieee(jitCoder->jitFunction,
+
jitCoder->jitStack[jitCoder->stackTop - 2],
+
jitCoder->jitStack[jitCoder->stackTop - 1]);
+ JITC_ADJUST(jitCoder, -1);
+ }
+ break;
+
+ case IL_OP_REM_UN:
+ {
+ jitCoder->jitStack[jitCoder->stackTop - 2] =
jit_insn_rem_ieee(jitCoder->jitFunction,
+
jitCoder->jitStack[jitCoder->stackTop - 2],
+
jitCoder->jitStack[jitCoder->stackTop - 1]);
+ JITC_ADJUST(jitCoder, -1);
+ }
+ break;
+
+ case IL_OP_AND:
+ {
+ jitCoder->jitStack[jitCoder->stackTop - 2] =
jit_insn_and(jitCoder->jitFunction,
+
jitCoder->jitStack[jitCoder->stackTop - 2],
+
jitCoder->jitStack[jitCoder->stackTop - 1]);
+ JITC_ADJUST(jitCoder, -1);
+ }
+ break;
+
+ case IL_OP_OR:
+ {
+
+ jitCoder->jitStack[jitCoder->stackTop - 2] =
jit_insn_or(jitCoder->jitFunction,
+
jitCoder->jitStack[jitCoder->stackTop - 2],
+
jitCoder->jitStack[jitCoder->stackTop - 1]);
+ JITC_ADJUST(jitCoder, -1);
+ }
+ break;
+
+ case IL_OP_XOR:
+ {
+
+ jitCoder->jitStack[jitCoder->stackTop - 2] =
jit_insn_xor(jitCoder->jitFunction,
+
jitCoder->jitStack[jitCoder->stackTop - 2],
+
jitCoder->jitStack[jitCoder->stackTop - 1]);
+ JITC_ADJUST(jitCoder, -1);
+ }
+ break;
+
+ }
}
/*
@@ -34,6 +192,42 @@
static void JITCoder_BinaryPtr(ILCoder *coder, int opcode,
ILEngineType type1,
ILEngineType type2)
{
+ ILJITCoder *jitCoder = _ILCoderToILJITCoder(coder);
+
+ switch(opcode)
+ {
+ case IL_OP_ADD:
+ {
+ jitCoder->jitStack[jitCoder->stackTop - 2] =
jit_insn_add(jitCoder->jitFunction,
+
jitCoder->jitStack[jitCoder->stackTop - 2],
+
jitCoder->jitStack[jitCoder->stackTop - 1]);
+ JITC_ADJUST(jitCoder, -1);
+ }
+ case IL_OP_ADD_OVF_UN:
+ {
+ jitCoder->jitStack[jitCoder->stackTop - 2] =
jit_insn_add_ovf(jitCoder->jitFunction,
+
jitCoder->jitStack[jitCoder->stackTop - 2],
+
jitCoder->jitStack[jitCoder->stackTop - 1]);
+ JITC_ADJUST(jitCoder, -1);
+ }
+ break;
+
+ case IL_OP_SUB:
+ {
+ jitCoder->jitStack[jitCoder->stackTop - 2] =
jit_insn_sub(jitCoder->jitFunction,
+
jitCoder->jitStack[jitCoder->stackTop - 2],
+
jitCoder->jitStack[jitCoder->stackTop - 1]);
+ JITC_ADJUST(jitCoder, -1);
+ }
+ case IL_OP_SUB_OVF_UN:
+ {
+ jitCoder->jitStack[jitCoder->stackTop - 2] =
jit_insn_sub_ovf(jitCoder->jitFunction,
+
jitCoder->jitStack[jitCoder->stackTop - 2],
+
jitCoder->jitStack[jitCoder->stackTop - 1]);
+ JITC_ADJUST(jitCoder, -1);
+ }
+ break;
+ }
}
/*
@@ -42,6 +236,38 @@
static void JITCoder_Shift(ILCoder *coder, int opcode,
ILEngineType type1,
ILEngineType type2)
{
+ ILJITCoder *jitCoder = _ILCoderToILJITCoder(coder);
+
+ /* Determine how to perform the operation */
+ switch(opcode)
+ {
+ case IL_OP_SHL:
+ {
+ jitCoder->jitStack[jitCoder->stackTop - 2] =
jit_insn_shl(jitCoder->jitFunction,
+
jitCoder->jitStack[jitCoder->stackTop - 2],
+
jitCoder->jitStack[jitCoder->stackTop - 1]);
+ JITC_ADJUST(jitCoder, -1);
+ }
+ break;
+
+ case IL_OP_SHR:
+ {
+ jitCoder->jitStack[jitCoder->stackTop - 2] =
jit_insn_shr(jitCoder->jitFunction,
+
jitCoder->jitStack[jitCoder->stackTop - 2],
+
jitCoder->jitStack[jitCoder->stackTop - 1]);
+ JITC_ADJUST(jitCoder, -1);
+ }
+ break;
+
+ case IL_OP_SHR_UN:
+ {
+ jitCoder->jitStack[jitCoder->stackTop - 2] =
jit_insn_shr(jitCoder->jitFunction,
+
jitCoder->jitStack[jitCoder->stackTop - 2],
+
jitCoder->jitStack[jitCoder->stackTop - 1]);
+ JITC_ADJUST(jitCoder, -1);
+ }
+ break;
+ }
}
/*
@@ -49,6 +275,32 @@
*/
static void JITCoder_Unary(ILCoder *coder, int opcode, ILEngineType type)
{
+ ILJITCoder *jitCoder = _ILCoderToILJITCoder(coder);
+
+ switch(opcode)
+ {
+ case IL_OP_NEG:
+ {
+ jitCoder->jitStack[jitCoder->stackTop - 1] =
jit_insn_neg(jitCoder->jitFunction,
+
jitCoder->jitStack[jitCoder->stackTop - 1]);
+ }
+ break;
+
+ case IL_OP_NOT:
+ {
+ jitCoder->jitStack[jitCoder->stackTop - 1] =
jit_insn_not(jitCoder->jitFunction,
+
jitCoder->jitStack[jitCoder->stackTop - 1]);
+ }
+ break;
+
+ case IL_OP_CKFINITE:
+ {
+ /* Check the stack Top-most F value to see if it is
finite */
+ jitCoder->jitStack[jitCoder->stackTop - 1] =
jit_insn_is_finite(jitCoder->jitFunction,
+
jitCoder->jitStack[jitCoder->stackTop - 1]);
+ }
+ break;
+ }
}
#endif /* IL_JITC_CODE */
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [dotgnu-pnet-commits] pnet ./ChangeLog engine/jitc_arith.c,
Klaus Treichel <=