Merge pull request #1868 from BillSeurer/ppc-floats
authorAlex Rønne Petersen <alex@alexrp.com>
Thu, 11 Jun 2015 21:24:26 +0000 (23:24 +0200)
committerAlex Rønne Petersen <alex@alexrp.com>
Thu, 11 Jun 2015 21:24:26 +0000 (23:24 +0200)
[ppc] Basic powerpc64 little endian enablement

mono/mini/mini-ppc.c
mono/mini/mini-ppc.h
mono/tests/Makefile.am

index 0cf56a986d5a435a545d2b028bc0c927c6d35f30..72e64a2c16980c17c26a097b88a177ec39b2aec0 100644 (file)
@@ -2147,11 +2147,8 @@ mono_arch_decompose_opts (MonoCompile *cfg, MonoInst *ins)
 {
        switch (ins->opcode) {
        case OP_ICONV_TO_R_UN: {
-#if G_BYTE_ORDER == G_BIG_ENDIAN
+               // This value is OK as-is for both big and little endian because of how it is stored
                static const guint64 adjust_val = 0x4330000000000000ULL;
-#else
-               static const guint64 adjust_val = 0x0000000000003043ULL;
-#endif
                int msw_reg = mono_alloc_ireg (cfg);
                int adj_reg = mono_alloc_freg (cfg);
                int tmp_reg = mono_alloc_freg (cfg);
@@ -2162,8 +2159,14 @@ mono_arch_decompose_opts (MonoCompile *cfg, MonoInst *ins)
                        basereg = mono_alloc_ireg (cfg);
                        MONO_EMIT_NEW_BIALU_IMM (cfg, OP_IADD_IMM, basereg, cfg->frame_reg, offset);
                }
+#if G_BYTE_ORDER == G_BIG_ENDIAN
                MONO_EMIT_NEW_STORE_MEMBASE (cfg, OP_STOREI4_MEMBASE_REG, basereg, offset, msw_reg);
                MONO_EMIT_NEW_STORE_MEMBASE (cfg, OP_STOREI4_MEMBASE_REG, basereg, offset + 4, ins->sreg1);
+#else
+               // For little endian the words are reversed
+               MONO_EMIT_NEW_STORE_MEMBASE (cfg, OP_STOREI4_MEMBASE_REG, basereg, offset + 4, msw_reg);
+               MONO_EMIT_NEW_STORE_MEMBASE (cfg, OP_STOREI4_MEMBASE_REG, basereg, offset, ins->sreg1);
+#endif
                MONO_EMIT_NEW_LOAD_R8 (cfg, adj_reg, &adjust_val);
                MONO_EMIT_NEW_LOAD_MEMBASE_OP (cfg, OP_LOADR8_MEMBASE, tmp_reg, basereg, offset);
                MONO_EMIT_NEW_BIALU (cfg, OP_FSUB, ins->dreg, tmp_reg, adj_reg);
@@ -2213,7 +2216,11 @@ mono_arch_decompose_opts (MonoCompile *cfg, MonoInst *ins)
                        MONO_EMIT_NEW_BIALU_IMM (cfg, OP_IADD_IMM, basereg, cfg->frame_reg, offset);
                }
                MONO_EMIT_NEW_STORE_MEMBASE (cfg, OP_STORER8_MEMBASE_REG, basereg, offset, ins->sreg1);
+#if G_BYTE_ORDER == G_BIG_ENDIAN
                MONO_EMIT_NEW_LOAD_MEMBASE_OP (cfg, OP_LOADI4_MEMBASE, msw_reg, basereg, offset);
+#else
+               MONO_EMIT_NEW_LOAD_MEMBASE_OP (cfg, OP_LOADI4_MEMBASE, msw_reg, basereg, offset+4);
+#endif
                MONO_EMIT_NEW_UNALU (cfg, OP_CHECK_FINITE, -1, msw_reg);
                MONO_EMIT_NEW_UNALU (cfg, OP_FMOVE, ins->dreg, ins->sreg1);
                ins->opcode = OP_NOP;
index dc83f788509399e4f201a71dc391d4aa4f971c59..0c611f251a54f7e70eb00d4d4671301c648dfb55 100644 (file)
@@ -145,6 +145,7 @@ typedef struct MonoCompileArch {
 #define PPC_LAST_FPARG_REG ppc_f13
 #define PPC_PASS_STRUCTS_BY_VALUE 1
 #define PPC_THREAD_PTR_REG ppc_r13
+#define MONO_ARCH_HAVE_SIGCTX_TO_MONOCTX 1
 #else
 #define PPC_RET_ADDR_OFFSET 4
 #define PPC_STACK_PARAM_OFFSET 8
index 1da8f045d701416864bcb7a08eca9d6fbb52db7c..f350e4fa4be767c8e24385673a124040d34e02ce 100644 (file)
@@ -458,6 +458,11 @@ if POWERPC
 PLATFORM_DISABLED_TESTS=finalizer-abort.exe finalizer-exception.exe finalizer-exit.exe
 endif
 
+if POWERPC64
+# These tests hang
+PLATFORM_DISABLED_TESTS=monitor.exe finalizer-abort.exe finalizer-exception.exe finalizer-exit.exe
+endif
+
 if ARM
 PLATFORM_DISABLED_TESTS=filter-stack.exe
 endif