Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-4718763

ADLC does not support chain rules with predicates or chaining through predicated

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P3 P3
    • 1.4.2
    • 1.4.1
    • hotspot
    • mantis
    • sparc
    • solaris_8

      instruct loadConI22( g23RegI dst, immI22 src) %{
        match(Set dst src);
        ins_cost(DEFAULT_COST * 2 / 3);

        format %{ "MOVS $src,$dst" %}
        ins_encode( emit_mov_imm22( dst, src, R_PR0 ) );
        ins_pipe(gr_IALU_gr_imm);
      %}

      [as it turns out, it is over-restrictive. g23RegI could be gRegI]
      Looking at the definition for immI22, you see:

      // Integer Immediate: 22-bit
      operand immI22() %{
        predicate(Assembler::is_simm22(n->get_int()));
        match(ConI);

        op_cost(50);
        format %{ %}
        interface(CONST_INTER);
      %}

      Now, if you look at the code in dfa_ia64.cpp for

      void State::_sub_Op_ConI(const Node *n){

      you first see:

          if( Assembler::is_simm22(_n_get_int__) ) {
            unsigned int c = 50;
            if (STATE__NOT_YET_VALID(IMMI22) || _cost[IMMI22] > c) {
              _cost[IMMI22] = c;
              _rule[IMMI22] = immI22_rule;
              STATE__SET_VALID(IMMI22);
            }
            if (STATE__NOT_YET_VALID(G23REGI) || _cost[G23REGI] > c+DEFAULT_COST * 2 /
      3) {
              _cost[G23REGI] = c+DEFAULT_COST * 2 / 3;
              _rule[G23REGI] = loadConI22_rule;
              STATE__SET_VALID(G23REGI);
            }
          }

      Further down, just before the end of this method, you see

         if (STATE__NOT_YET_VALID(G23REGI) || _cost[G23REGI] > DEFAULT_COST * 2 / 3) {
           _cost[G23REGI] = DEFAULT_COST * 2 / 3;
           _rule[G23REGI] = loadConI22_rule;
           STATE__SET_VALID(G23REGI);
         }

      Now, the loadConI22_rule should never be allowed, UNLESS the predicate
          if( Assembler::is_simm22(_n_get_int__) ) {
      is satisfied. So this appears wrong to me.

            mpalecznsunw Michael Paleczny (Inactive)
            mpalecznsunw Michael Paleczny (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: