[ppc] Fix chkfinite for little endian
authorBill Seurer <seurer@linux.vnet.ibm.com>
Wed, 3 Jun 2015 14:37:12 +0000 (09:37 -0500)
committerBill Seurer <seurer@linux.vnet.ibm.com>
Thu, 11 Jun 2015 14:25:54 +0000 (09:25 -0500)
mono/mini/mini-ppc.c

index 719689ad8578ecd3730f4c0084cf2af17823d872..2b40df361ddb97a5e9006c3ed6319a4316a915be 100644 (file)
@@ -2215,7 +2215,16 @@ 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_STORER8_MEMBASE_REG, basereg, offset, ins->sreg1);
+//             Option to store 4 byte values
+//             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_MEMBASE_OP (cfg, OP_LOADI4_MEMBASE, msw_reg, basereg, offset);
                MONO_EMIT_NEW_UNALU (cfg, OP_CHECK_FINITE, -1, msw_reg);
                MONO_EMIT_NEW_UNALU (cfg, OP_FMOVE, ins->dreg, ins->sreg1);