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: short integer multiplication problem on IA64


Richard Henderson wrote:

> On Tue, Feb 26, 2002 at 09:12:23AM -0800, Reva Cuthbertson wrote:
> >       1.  Is this the right approach?  Am I doing the
> >             right thing in ia64_add_mmmul_delay() and is
> >           it being called from the right places?
>
> No.
>
> ia64_emit_nops merely fills in the blanks that we know we
> left in the instruction stream so that we're certain that the
> assembler will produce exactly the bundles that we expect.
> There are no new stop bits added at this time.
>
> There is code that is supposed to handle the nop padding already:
>
>         if (REG_NOTE_KIND (link) != REG_DEP_OUTPUT
>             && REG_NOTE_KIND (link) != REG_DEP_ANTI)
>           {
>             rtx other = XEXP (link, 0);
>             enum attr_itanium_class t0 = ia64_safe_itanium_class (other);
>             if (t0 == ITANIUM_CLASS_MMSHF
>                 || t0 == ITANIUM_CLASS_MMMUL)
>               {
>                 nop_cycles_until (clock_var, sched_verbose ? dump : NULL);
>                 goto out;
>               }
>
> If this isn't working, you should find out why.
>
> r~

Hi Richard,

    I think I found one reason why this code isn't working.  It doesn't
get executed on my short integer multiply example.  As a reminder,
my short little integer multiply example is the following:

short func ( short a, short b)
{
        return a * b;
}

    The reason the code fragment you sent doesn't get executed is
because of the checkthat we do before we get into the code to
call nop_cycles_until().  From ia64_internal_sched_reorder():

   enum attr_itanium_class t = ia64_safe_itanium_class (insn);
   if (t == ITANIUM_CLASS_IALU || t == ITANIUM_CLASS_ISHF
       || t == ITANIUM_CLASS_ILOG
       || t == ITANIUM_CLASS_LD || t == ITANIUM_CLASS_ST)
     {
       rtx link;
       for (link = LOG_LINKS (insn); link; link = XEXP (link, 1))
      if (REG_NOTE_KIND (link) != REG_DEP_OUTPUT
          && REG_NOTE_KIND (link) != REG_DEP_ANTI)
        {
          rtx other = XEXP (link, 0);
          enum attr_itanium_class t0 = ia64_safe_itanium_class (other);
          if (t0 == ITANIUM_CLASS_MMSHF
              || t0 == ITANIUM_CLASS_MMMUL)
                    {
                       nop_cycles_until (clock_var, sched_verbose ? dump :
NULL);
                       goto out;
                    }

At the first if statement, t is set to ITANIUM_CLASS_MMMUL so the
if statement will fail and we will never call nop_cycles_until().   To
fix this, I added a clause to the if statement to check if t was
equal to ITANIUM_CLASS_MMMUL.  This got me further until I hit this
statement:

      if (t0 == ITANIUM_CLASS_MMSHF
              || t0 == ITANIUM_CLASS_MMMUL)

At this point, t0 was set to ITANIUM_CLASS_XTD so that if statement
failed.  I added a clause to this if statement to check if t0 was set
to ITANIUM_CLASS_XTD.  At that point, nop_cycles_until() was called
but it did not do what I expected (add nops after the pmpy instruction).
Any suggestions?

Thanks!

Reva Cuthbertson
reva@cup.hp.com



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