Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/mono.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZoltan Varga <vargaz@gmail.com>2013-03-26 07:31:07 +0400
committerZoltan Varga <vargaz@gmail.com>2013-03-26 07:31:07 +0400
commitaa8abd1f58edd74206c26094543b0da55a941db3 (patch)
tree2e13dfc6ff550583cea0721b46cd40680fe893b1
parentbd4c5c3651b063860d2e147fff328bcc2fef6083 (diff)
Don't emulate idiv.un/irem.un on ARM in cases where it can be optimized away.
-rw-r--r--mono/mini/method-to-ir.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/mono/mini/method-to-ir.c b/mono/mini/method-to-ir.c
index 38451d36a4d..e3d4c2c206f 100644
--- a/mono/mini/method-to-ir.c
+++ b/mono/mini/method-to-ir.c
@@ -8411,6 +8411,12 @@ mono_method_to_ir (MonoCompile *cfg, MonoMethod *method, MonoBasicBlock *start_b
int imm_opcode;
imm_opcode = mono_op_to_op_imm_noemul (ins->opcode);
+#if defined(MONO_ARCH_EMULATE_MUL_DIV) || defined(MONO_ARCH_EMULATE_DIV)
+ /* Keep emulated opcodes which are optimized away later */
+ if ((ins->opcode == OP_IREM_UN || ins->opcode == OP_IDIV_UN_IMM) && (cfg->opt & (MONO_OPT_CONSPROP | MONO_OPT_COPYPROP)) && sp [1]->opcode == OP_ICONST && mono_is_power_of_two (sp [1]->inst_c0) >= 0) {
+ imm_opcode = mono_op_to_op_imm (ins->opcode);
+ }
+#endif
if (imm_opcode != -1) {
ins->opcode = imm_opcode;
if (sp [1]->opcode == OP_I8CONST) {