Author: lupus
Date: 2006-11-16 06:45:21 -0500 (Thu, 16 Nov 2006)
New Revision: 67979
Modified:
trunk/mono/mono/mini/ChangeLog
trunk/mono/mono/mini/jit-icalls.c
trunk/mono/mono/mini/jit-icalls.h
trunk/mono/mono/mini/mini-arm.c
trunk/mono/mono/mini/mini.c
Log:
Thu Nov 16 12:42:13 CET 2006 Paolo Molaro <[EMAIL PROTECTED]>
* jit-icalls.c, jit-icalls.h, mini-arm.c, mini.c:
more soft-float support fixes.
Modified: trunk/mono/mono/mini/ChangeLog
===================================================================
--- trunk/mono/mono/mini/ChangeLog 2006-11-16 11:05:31 UTC (rev 67978)
+++ trunk/mono/mono/mini/ChangeLog 2006-11-16 11:45:21 UTC (rev 67979)
@@ -1,4 +1,9 @@
+Thu Nov 16 12:42:13 CET 2006 Paolo Molaro <[EMAIL PROTECTED]>
+
+ * jit-icalls.c, jit-icalls.h, mini-arm.c, mini.c:
+ more soft-float support fixes.
+
Wed Nov 15 18:45:47 GMT 2006 Paolo Molaro <[EMAIL PROTECTED]>
* mini-arm.c, inssel-arm.brg: ABI fix for longs and doubles
Modified: trunk/mono/mono/mini/jit-icalls.c
===================================================================
--- trunk/mono/mono/mini/jit-icalls.c 2006-11-16 11:05:31 UTC (rev 67978)
+++ trunk/mono/mono/mini/jit-icalls.c 2006-11-16 11:45:21 UTC (rev 67979)
@@ -457,6 +457,12 @@
return (double)a;
}
+double
+mono_conv_to_r4 (int a)
+{
+ return (double)(float)a;
+}
+
gint8
mono_fconv_i1 (double a)
{
@@ -589,6 +595,14 @@
*ptr = (float)val;
}
+/* returns the integer bitpattern that is passed in the regs or stack */
+guint32
+mono_fload_r4_arg (double val)
+{
+ float v = (float)val;
+ return *(guint32*)&v;
+}
+
#endif
/**
Modified: trunk/mono/mono/mini/jit-icalls.h
===================================================================
--- trunk/mono/mono/mini/jit-icalls.h 2006-11-16 11:05:31 UTC (rev 67978)
+++ trunk/mono/mono/mini/jit-icalls.h 2006-11-16 11:45:21 UTC (rev 67979)
@@ -71,6 +71,8 @@
double mono_conv_to_r8 (gint32 a) MONO_INTERNAL;
+double mono_conv_to_r4 (gint32 a) MONO_INTERNAL;
+
float mono_lconv_to_r4 (gint64 a) MONO_INTERNAL;
double mono_conv_to_r8_un (guint32 a) MONO_INTERNAL;
@@ -139,5 +141,7 @@
void mono_fstore_r4 (double val, float *ptr);
+guint32 mono_fload_r4_arg (double val);
+
#endif /* __MONO_JIT_ICALLS_H__ */
Modified: trunk/mono/mono/mini/mini-arm.c
===================================================================
--- trunk/mono/mono/mini/mini-arm.c 2006-11-16 11:05:31 UTC (rev 67978)
+++ trunk/mono/mono/mini/mini-arm.c 2006-11-16 11:45:21 UTC (rev 67979)
@@ -803,7 +803,9 @@
call->used_iregs |= 1 << (ainfo->reg +
1);
if (arg->type == STACK_R8) {
if (ainfo->size == 4) {
+#ifndef MONO_ARCH_SOFT_FLOAT
arg->opcode = OP_OUTARG_R4;
+#endif
} else {
call->used_iregs |= 1 <<
(ainfo->reg + 1);
}
Modified: trunk/mono/mono/mini/mini.c
===================================================================
--- trunk/mono/mono/mini/mini.c 2006-11-16 11:05:31 UTC (rev 67978)
+++ trunk/mono/mono/mini/mini.c 2006-11-16 11:45:21 UTC (rev 67979)
@@ -2410,13 +2410,31 @@
MonoInst *arg;
MONO_INST_NEW_CALL (cfg, call, ret_type_to_call_opcode (sig->ret,
calli, virtual));
-
+
+#ifdef MONO_ARCH_SOFT_FLOAT
+ /* we need to convert the r4 value to an int value */
+ {
+ int i;
+ for (i = 0; i < sig->param_count; ++i) {
+ if (sig->params [i]->type == MONO_TYPE_R4) {
+ MonoInst *iargs [1];
+ int temp;
+ iargs [0] = args [i + sig->hasthis];
+
+ temp = mono_emit_jit_icall (cfg, bblock,
mono_fload_r4_arg, iargs, ip);
+ NEW_TEMPLOAD (cfg, arg, temp);
+ args [i + sig->hasthis] = arg;
+ }
+ }
+ }
+#endif
+
call->inst.cil_code = ip;
call->args = args;
call->signature = sig;
call = mono_arch_call_opcode (cfg, bblock, call, virtual);
type_to_eval_stack_type (sig->ret, &call->inst);
-
+
for (arg = call->out_args; arg;) {
MonoInst *narg = arg->next;
arg->next = NULL;
@@ -2686,7 +2704,7 @@
}
#define LDLOC_SOFT_FLOAT(cfg,ins,idx,ip) do {\
- if (header->locals [(idx)]->type == MONO_TYPE_R4) { \
+ if (header->locals [(idx)]->type == MONO_TYPE_R4 &&
!header->locals [(idx)]->byref) { \
int temp; \
NEW_LOCLOADA (cfg, (ins), (idx)); \
temp = handle_load_float (cfg, bblock, (ins), (ip));
\
@@ -2694,7 +2712,7 @@
} \
} while (0)
#define STLOC_SOFT_FLOAT(cfg,ins,idx,ip) do {\
- if (header->locals [(idx)]->type == MONO_TYPE_R4) { \
+ if (header->locals [(idx)]->type == MONO_TYPE_R4 &&
!header->locals [(idx)]->byref) { \
int temp; \
NEW_LOCLOADA (cfg, (ins), (idx)); \
handle_store_float (cfg, bblock, (ins), *sp, (ip));
\
@@ -2702,7 +2720,7 @@
} \
} while (0)
#define LDARG_SOFT_FLOAT(cfg,ins,idx,ip) do {\
- if (param_types [(idx)]->type == MONO_TYPE_R4) { \
+ if (param_types [(idx)]->type == MONO_TYPE_R4 && !param_types
[(idx)]->byref) { \
int temp; \
NEW_ARGLOADA (cfg, (ins), (idx)); \
temp = handle_load_float (cfg, bblock, (ins), (ip));
\
@@ -3028,6 +3046,11 @@
if (MONO_TYPE_ISSTRUCT (signature->params [i])) {
return FALSE;
}
+#ifdef MONO_ARCH_SOFT_FLOAT
+ /* this complicates things, fix later */
+ if (signature->params [i]->type == MONO_TYPE_R4)
+ return FALSE;
+#endif
}
/*
@@ -11627,6 +11650,7 @@
mono_register_opcode_emulation (OP_FMUL, "__emul_fmul", "double double
double", mono_fmul, FALSE);
mono_register_opcode_emulation (OP_FNEG, "__emul_fneg", "double
double", mono_fneg, FALSE);
mono_register_opcode_emulation (CEE_CONV_R8, "__emul_conv_r8", "double
int32", mono_conv_to_r8, FALSE);
+ mono_register_opcode_emulation (CEE_CONV_R4, "__emul_conv_r4", "double
int32", mono_conv_to_r4, FALSE);
mono_register_opcode_emulation (OP_FCONV_TO_R4, "__emul_fconv_to_r4",
"double double", mono_fconv_r4, FALSE);
mono_register_opcode_emulation (OP_FCONV_TO_I1, "__emul_fconv_to_i1",
"int8 double", mono_fconv_i1, FALSE);
mono_register_opcode_emulation (OP_FCONV_TO_I2, "__emul_fconv_to_i2",
"int16 double", mono_fconv_i2, FALSE);
@@ -11653,6 +11677,7 @@
register_icall (mono_fload_r4, "mono_fload_r4", "double ptr", FALSE);
register_icall (mono_fstore_r4, "mono_fstore_r4", "void double ptr",
FALSE);
+ register_icall (mono_fload_r4_arg, "mono_fload_r4_arg", "uint32
double", FALSE);
#endif
#if SIZEOF_VOID_P == 4
_______________________________________________
Mono-patches maillist - [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches