Extracted from a patch by Kornél Pál <kornelpal@gmail.com>.
* mini-x86.c (mono_arch_output_basic_block): Adjust precision of int to float
conversion to 32 bits.
* cpu-x86.md: Increase the size of int_conv_to_r4.
* basic-float.cs: Add a test for this.
Fixed part of #467201.
svn path=/trunk/mono/; revision=127560
Extracted from a patch by Kornél Pál <kornelpal@gmail.com>.
- * mini-x86.c (emono_arch_output_basic_block): Adjust precision of long to double
+ * mini-x86.c (mono_arch_output_basic_block): Adjust precision of int to float
+ conversion to 32 bits.
+
+ * cpu-x86.md: Increase the size of int_conv_to_r4.
+
+ * basic-float.cs: Add a test for this.
+
+ Fixed part of #467201.
+
+2009-02-20 Rodrigo Kumpera <rkumpera@novell.com>
+
+ Extracted from a patch by Kornél Pál <kornelpal@gmail.com>.
+
+ * mini-x86.c (mono_arch_output_basic_block): Adjust precision of long to double
conversion to 64 bits.
* basic-float.cs: Add a test for this.
return 0;
}
+ static int INT_VAL = 0x13456799;
+
+ static int test_0_int4_to_float_convertion ()
+ {
+ double d = (double)(float)INT_VAL;
+
+ if (d != 323315616)
+ return 1;
+ return 0;
+ }
}
int_conv_to_i1: dest:i src1:y len:3
int_conv_to_i2: dest:i src1:i len:3
int_conv_to_i4: dest:i src1:i len:2
-int_conv_to_r4: dest:f src1:i len:7
+int_conv_to_r4: dest:f src1:i len:13
int_conv_to_r8: dest:f src1:i len:7
int_conv_to_u4: dest:i src1:i
int_conv_to_u2: dest:i src1:i len:3
case OP_LOADR4_MEMBASE:
x86_fld_membase (code, ins->inst_basereg, ins->inst_offset, FALSE);
break;
- case OP_ICONV_TO_R4: /* FIXME: change precision */
+ case OP_ICONV_TO_R4:
+ x86_push_reg (code, ins->sreg1);
+ x86_fild_membase (code, X86_ESP, 0, FALSE);
+ /* Change precision */
+ x86_fst_membase (code, X86_ESP, 0, FALSE, TRUE);
+ x86_fld_membase (code, X86_ESP, 0, FALSE);
+ x86_alu_reg_imm (code, X86_ADD, X86_ESP, 4);
+ break;
case OP_ICONV_TO_R8:
x86_push_reg (code, ins->sreg1);
x86_fild_membase (code, X86_ESP, 0, FALSE);