s390: Generalise S390_INSN_GADD which only worked on the guest
state to S390_INSN_MADD which works for any memory location
addressable with base reg + 20-bit displacement.


git-svn-id: svn://svn.valgrind.org/vex/trunk@2611 8f6e269a-dfd6-0310-a8e1-e2731360e62c
diff --git a/priv/host_s390_isel.c b/priv/host_s390_isel.c
index 9aca09f..209bfb8 100644
--- a/priv/host_s390_isel.c
+++ b/priv/host_s390_isel.c
@@ -2912,6 +2912,7 @@
       case Ity_I16:
       case Ity_I32:
       case Ity_I64:
+         /* fixs390: We could check for INSN_MADD here. */
          if (am->tag == S390_AMODE_B12 &&
              s390_expr_is_const_zero(stmt->Ist.Store.data)) {
             addInstr(env, s390_insn_mzero(sizeofIRType(tyd), am));
@@ -3020,7 +3021,8 @@
       difference = new_value - old_value;
 
       if (s390_host_has_gie && ulong_fits_signed_8bit(difference)) {
-         addInstr(env, s390_insn_gadd(sizeofIRType(tyd), offset,
+         am = s390_amode_for_guest_state(offset);
+         addInstr(env, s390_insn_madd(sizeofIRType(tyd), am,
                                       (difference & 0xFF), new_value));
          return;
       }
@@ -3029,13 +3031,11 @@
          Use R0 as a scratch reg. */
       if ((old_value >> 32) == (new_value >> 32)) {
          HReg r0  = make_gpr(0);
-         HReg gsp = make_gpr(S390_REGNO_GUEST_STATE_POINTER);
-         s390_amode *gam;
 
-         gam = s390_amode_b12(offset + 4, gsp);
+         am = s390_amode_for_guest_state(offset + 4);
          addInstr(env, s390_insn_load_immediate(4, r0,
                                                 new_value & 0xFFFFFFFF));
-         addInstr(env, s390_insn_store(4, gam, r0));
+         addInstr(env, s390_insn_store(4, am, r0));
          return;
       }