This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: MD representation of IA64 floating point operations


Perhaps one way of avoiding both preprocessing and combinatorial
explosion would be to allow platform-specific variations of
match_operand.  E.g. you could have:

    (match_float_operand:RF number "predicate" "constraints")

or, in the MIPS case:

    (match_se_operand:DI number "predicate" "constraints")

These would be defined in some sort of *.def file in the backend.
The backend would also provide the kind of details needed by
insn-*.c to emit and extract operands.  E.g.:

    - For insn-emit.c & co: provide a function that takes the
      rtx passed to a match_float_operand and the mode of the
      match_float_operand itself.  Return the rtx that should
      actually be used in the emitted pattern.

      In the MIPS case, this might look something like:

          rtx
          emit_match_se_operand (rtx op, enum machine_mode expected_mode)
          {
            if (expected_mode == DImode && GET_MODE (op) == SImode)
              return gen_rtx_SIGN_EXTEND (DImode, op);
            return op;
          }

      So an expander like:

          (set (match_operand:DI 0 "register_operand")
               (plus:DI (match_se_operand:DI 1 "register_operand")
                        (match_se_operand:DI 2 "register_operand")))

      would accept both SImode and DImode rtxes for operand 1 and 2.

    - For insn-recog.c & co: provide a function that takes the
      match_float_operand mode, the match_float_operand predicate,
      and a pointer to the rtx that we want to match against it.
      If the rtx matches, return a pointer to the operand itself,
      otherwise return null.

      Tentative MIPS implementation:

          rtx *
          match_se_operand (rtx *op, enum machine_mode mode, predicate_fn fn)
          {
            if ((mode == VOIDmode || mode == DImode)
                && GET_MODE (*op) == mode
                && GET_CODE (*op) == SIGN_EXTEND
                && predicate_fn (XEXP (*op, 0), SImode))
              return &XEXP (*op, 0);
            if (predicate_fn (*op, mode))
              return op;
            return 0;
          }

    - For insn-extract.c & co: provide a cut-down version of the above
      that avoids the predicate check.  Or perhaps reuse the same function
      with a dummy predicate, if that isn't too expensive in terms of
      compilation time.

I don't know if it would work, but if it does, it would at least have
the advantage of hiding everything inside the automatically-generated
files.  There shouldn't be any need to change reload, for instance:
as far as it's concerned, there's no difference from a pattern that had:

     (float_extend:RF (match_operand:SF ...))

Probably a silly idea.  Just thought I'd mention it, since it's something
I've long been meaning to try for MIPS, but never quite got around to.

Richard


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]