diff options
-rw-r--r-- | mono/arch/s390x/ChangeLog | 4 | ||||
-rw-r--r-- | mono/arch/s390x/s390x-codegen.h | 1 | ||||
-rw-r--r-- | mono/mini/ChangeLog | 5 | ||||
-rw-r--r-- | mono/mini/cpu-s390x.md | 16 | ||||
-rw-r--r-- | mono/mini/inssel-s390x.brg | 5 | ||||
-rw-r--r-- | mono/mini/mini-s390x.c | 78 |
6 files changed, 82 insertions, 27 deletions
diff --git a/mono/arch/s390x/ChangeLog b/mono/arch/s390x/ChangeLog index e9ba77597db..c2e9ee9c8e6 100644 --- a/mono/arch/s390x/ChangeLog +++ b/mono/arch/s390x/ChangeLog @@ -1,3 +1,7 @@ +2006-01-06 Neale Ferguson <neale@sinenomine.net> + + * s390x-codegen.h: Add lpdbr instruction (OP_ABS). + 2006-01-03 Neale Ferguson <neale@sinenomine.net> * s390x-codegen.h: Add some new instructions. diff --git a/mono/arch/s390x/s390x-codegen.h b/mono/arch/s390x/s390x-codegen.h index 00331ba1d1d..8aefa465771 100644 --- a/mono/arch/s390x/s390x-codegen.h +++ b/mono/arch/s390x/s390x-codegen.h @@ -690,6 +690,7 @@ typedef struct { #define s390_lndbr(c, r1, r2) S390_RRE(c, 0xb311, r1, r2) #define s390_lngr(c, r1, r2) S390_RRE(c, 0xb901, r1, r2) #define s390_lnr(c, r1, r2) S390_RR(c, 0x11, r1, r2) +#define s390_lpdbr(c, r1, r2) S390_RRE(c, 0xb310, r1, r2) #define s390_lpgr(c, r1, r2) S390_RRE(c, 0xb900, r1, r2) #define s390_lpr(c, r1, r2) S390_RR(c, 0x10, r1, r2) #define s390_lr(c, r1, r2) S390_RR(c, 0x18, r1, r2) diff --git a/mono/mini/ChangeLog b/mono/mini/ChangeLog index ac2bf4ff5f5..bac5910ef06 100644 --- a/mono/mini/ChangeLog +++ b/mono/mini/ChangeLog @@ -1,3 +1,8 @@ +2006-01-06 Neale Ferguson <neale@sinenomine.net> + + * mini-s390x.c, inssel-s390x.brg, cpu-s390x.md: Fix ATOMIC_I8 operations. Provide + initial support for OP_ABS. + 2006-01-05 Neale Ferguson <neale@sinenomine.net> * mini-s390x.c (emit_float_to_int): Correct r8 to unsigned int algorithm. diff --git a/mono/mini/cpu-s390x.md b/mono/mini/cpu-s390x.md index a7045809b20..7c4c5dc37bb 100644 --- a/mono/mini/cpu-s390x.md +++ b/mono/mini/cpu-s390x.md @@ -61,11 +61,11 @@ aot_const: dest:i len:8 arg: arglist: atomic_add_i4: src1:b src2:i dest:i len:20 -atomic_add_i8: src1:b src2:i dest:i len:20 +atomic_add_i8: src1:b src2:i dest:i len:30 atomic_add_new_i4: src1:b src2:i dest:i len:20 -atomic_add_new_i8: src1:b src2:i dest:i len:26 +atomic_add_new_i8: src1:b src2:i dest:i len:30 atomic_exchange_i4: src1:b src2:i dest:i len:14 -atomic_exchange_i8: src1:b src2:i dest:i len:18 +atomic_exchange_i8: src1:b src2:i dest:i len:20 beq.s: beq: len:8 bge.s: @@ -153,11 +153,11 @@ conv.ovf.u: conv.r.un: dest:f src1:i len:32 conv.r4: dest:f src1:i len:4 conv.r8: dest:f src1:i len:4 -conv.u1: dest:i src1:i len:12 -conv.u2: dest:i src1:i len:20 -conv.u4: dest:i src1:i len:12 -conv.u8: dest:i src1:i len:12 -conv.u: dest:i src1:i len:4 +conv.u1: dest:i src1:i len:14 +conv.u2: dest:i src1:i len:24 +conv.u4: dest:i src1:i len:4 +conv.u8: dest:i src1:i len:4 +conv.u: dest:i src1:i len:4 cpblk: cpobj: div.un: dest:a src1:i src2:i len:12 diff --git a/mono/mini/inssel-s390x.brg b/mono/mini/inssel-s390x.brg index 578c4408ef3..0eb1bee83f9 100644 --- a/mono/mini/inssel-s390x.brg +++ b/mono/mini/inssel-s390x.brg @@ -735,9 +735,10 @@ base: CEE_LDOBJ (OP_S390_STKARG) "0" { } +reg: OP_ATOMIC_ADD_NEW_I8 (base, reg), reg: OP_ATOMIC_ADD_NEW_I4 (base, reg), +reg: OP_ATOMIC_ADD_I8 (base, reg), reg: OP_ATOMIC_ADD_I4 (base, reg) { - tree->opcode = tree->opcode; tree->inst_basereg = state->left->tree->inst_basereg; tree->inst_offset = state->left->tree->inst_offset; tree->dreg = state->reg1; @@ -746,8 +747,8 @@ reg: OP_ATOMIC_ADD_I4 (base, reg) { mono_bblock_add_inst (s->cbb, tree); } +reg: OP_ATOMIC_EXCHANGE_I8 (base, reg), reg: OP_ATOMIC_EXCHANGE_I4 (base, reg) { - tree->opcode = OP_ATOMIC_EXCHANGE_I4; tree->dreg = state->reg1; tree->sreg2 = state->right->reg1; tree->inst_basereg = state->left->tree->inst_basereg; diff --git a/mono/mini/mini-s390x.c b/mono/mini/mini-s390x.c index bf4355d38af..c2609bce7ec 100644 --- a/mono/mini/mini-s390x.c +++ b/mono/mini/mini-s390x.c @@ -4088,6 +4088,10 @@ mono_arch_output_basic_block (MonoCompile *cfg, MonoBasicBlock *bb) PTRSLOT(code, o[4]); } break; + case OP_ABS: { + s390_lpdbr (code, ins->dreg, ins->sreg1); + } + break; case OP_SQRT: { s390_sqdbr (code, ins->dreg, ins->sreg1); } @@ -4237,8 +4241,8 @@ mono_arch_output_basic_block (MonoCompile *cfg, MonoBasicBlock *bb) s390_lgr (code, s390_r1, ins->sreg2); s390_lg (code, s390_r0, 0, ins->inst_basereg, ins->inst_offset); s390_ag (code, s390_r1, 0, ins->inst_basereg, ins->inst_offset); - s390_csg (code, s390_r0, s390_r1, ins->inst_basereg, ins->inst_offset); - s390_jnz (code, -7); + s390_csg (code, s390_r0, s390_r0, ins->inst_basereg, ins->inst_offset); + s390_jnz (code, -11); s390_lgr (code, ins->dreg, s390_r1); } break; @@ -4247,14 +4251,14 @@ mono_arch_output_basic_block (MonoCompile *cfg, MonoBasicBlock *bb) s390_lg (code, s390_r0, 0, ins->inst_basereg, ins->inst_offset); s390_ag (code, s390_r1, 0, ins->inst_basereg, ins->inst_offset); s390_csg (code, s390_r0, s390_r1, ins->inst_basereg, ins->inst_offset); - s390_jnz (code, -7); + s390_jnz (code, -11); s390_lgr (code, ins->dreg, s390_r1); } break; case OP_ATOMIC_EXCHANGE_I8: { s390_lg (code, s390_r0, 0, ins->inst_basereg, ins->inst_offset); s390_csg (code, s390_r0, ins->sreg2, ins->inst_basereg, ins->inst_offset); - s390_jnz (code, -4); + s390_jnz (code, -6); s390_lgr (code, ins->dreg, s390_r0); } break; @@ -4262,7 +4266,7 @@ mono_arch_output_basic_block (MonoCompile *cfg, MonoBasicBlock *bb) s390_lr (code, s390_r1, ins->sreg2); s390_l (code, s390_r0, 0, ins->inst_basereg, ins->inst_offset); s390_a (code, s390_r1, 0, ins->inst_basereg, ins->inst_offset); - s390_cs (code, s390_r0, s390_r1, ins->inst_basereg, ins->inst_offset); + s390_cs (code, s390_r0, s390_r0, ins->inst_basereg, ins->inst_offset); s390_jnz (code, -7); s390_lr (code, ins->dreg, s390_r1); } @@ -5101,6 +5105,10 @@ mono_arch_get_inst_for_method (MonoCompile *cfg, MonoMethod *cmethod, MONO_INST_NEW (cfg, ins, OP_SQRT); ins->inst_i0 = args [0]; } +// if (strcmp (cmethod->name, "Abs") == 0) { +// MONO_INST_NEW (cfg, ins, OP_ABS); +// ins->inst_i0 = args [0]; +// } } else if (cmethod->klass == mono_defaults.thread_class && strcmp (cmethod->name, "MemoryBarrier") == 0) { MONO_INST_NEW (cfg, ins, OP_MEMORY_BARRIER); @@ -5108,38 +5116,74 @@ mono_arch_get_inst_for_method (MonoCompile *cfg, MonoMethod *cmethod, (strcmp (cmethod->klass->name_space, "System.Threading") == 0) && (strcmp (cmethod->klass->name, "Interlocked") == 0)) { - if (strcmp (cmethod->name, "Increment") == 0 && - fsig->params [0]->type == MONO_TYPE_I4) { + if (strcmp (cmethod->name, "Increment") == 0) { MonoInst *ins_iconst; + guint32 opcode; + + if (fsig->params [0]->type == MONO_TYPE_I4) + opcode = OP_ATOMIC_ADD_NEW_I4; + else if (fsig->params [0]->type == MONO_TYPE_I8) + opcode = OP_ATOMIC_ADD_NEW_I8; + else + g_assert_not_reached (); - MONO_INST_NEW (cfg, ins, OP_ATOMIC_ADD_NEW_I4); + MONO_INST_NEW (cfg, ins, opcode); MONO_INST_NEW (cfg, ins_iconst, OP_ICONST); ins_iconst->inst_c0 = 1; ins->inst_i0 = args [0]; ins->inst_i1 = ins_iconst; - } else if (strcmp (cmethod->name, "Decrement") == 0 && - fsig->params [0]->type == MONO_TYPE_I4) { + } else if (strcmp (cmethod->name, "Decrement") == 0) { MonoInst *ins_iconst; + guint32 opcode; - MONO_INST_NEW (cfg, ins, OP_ATOMIC_ADD_NEW_I4); + if (fsig->params [0]->type == MONO_TYPE_I4) + opcode = OP_ATOMIC_ADD_NEW_I4; + else if (fsig->params [0]->type == MONO_TYPE_I8) + opcode = OP_ATOMIC_ADD_NEW_I8; + else + g_assert_not_reached (); + MONO_INST_NEW (cfg, ins, opcode); MONO_INST_NEW (cfg, ins_iconst, OP_ICONST); ins_iconst->inst_c0 = -1; ins->inst_i0 = args [0]; ins->inst_i1 = ins_iconst; - } else if (strcmp (cmethod->name, "Exchange") == 0 && - fsig->params [0]->type == MONO_TYPE_I4) { - MONO_INST_NEW (cfg, ins, OP_ATOMIC_EXCHANGE_I4); + /* FIXME: */ + } else if (strcmp (cmethod->name, "Exchange") == 0) { + guint32 opcode; + + if (fsig->params [0]->type == MONO_TYPE_I4) + opcode = OP_ATOMIC_EXCHANGE_I4; + else if ((fsig->params [0]->type == MONO_TYPE_I8) || + (fsig->params [0]->type == MONO_TYPE_I) || + (fsig->params [0]->type == MONO_TYPE_OBJECT)) + opcode = OP_ATOMIC_EXCHANGE_I8; + else + return NULL; + + MONO_INST_NEW (cfg, ins, opcode); ins->inst_i0 = args [0]; ins->inst_i1 = args [1]; - } else if (strcmp (cmethod->name, "Add") == 0 && - fsig->params [0]->type == MONO_TYPE_I4) { - MONO_INST_NEW (cfg, ins, OP_ATOMIC_ADD_I4); + } else if (strcmp (cmethod->name, "Add") == 0) { + guint32 opcode; + + if (fsig->params [0]->type == MONO_TYPE_I4) + opcode = OP_ATOMIC_ADD_I4; + else if (fsig->params [0]->type == MONO_TYPE_I8) + opcode = OP_ATOMIC_ADD_I8; + else + g_assert_not_reached (); + + MONO_INST_NEW (cfg, ins, opcode); ins->inst_i0 = args [0]; ins->inst_i1 = args [1]; + } else if ((strcmp (cmethod->name, "Read") == 0 && + (fsig->params [0]->type == MONO_TYPE_I8))) { + MONO_INST_NEW (cfg, ins, CEE_LDIND_I8); + ins->inst_i0 = args [0]; } } return ins; |