This is the mail archive of the gcc-patches@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]

MIPS patch for recip.fmt scheduling


Another thing I noticed while working on vector float support.  We
aren't scheduling the recip.fmt instructions correctly.  We are giving
them the same latencies as the div.fmt instructions.  However, the whole
point of using recip.fmt is that they are faster, so we aren't getting
much benefit from them unless we schedule them correctly.

I wrote a patch to fix this by creating a new frdiv type attribute, and
modifying the two recip.[sd] patterns to use it.  For the sb1.md file, I
added new patterns to get the right latency for recip.  For all of the
other *.md files, I just added frdiv everyplace where fdiv was used,
which should have no effect.

I assumed that splitting fdiv into frdiv was OK because we already have
fsqrt and frsqrt for the square root and reciprocal square root
instructions.  This could probably also be done by testing for a const1
argument to divide, which would be a smaller patch, but it would not be
obvious to people writing new DFA schedulers that they would need to
check for this.  Hence I think the frdiv approach is better.

This was tested with an sb1-elf toolchain build from a combined tree,
with C and C++ enabled.  There were no make check regressions.

Also, I tested it with a simple testcase to verify I got the right
result.  I compiled the testcase with -O2 -ffast-math -da
-fsched-verbose=2 -S and then looked at the tmp.c.23.sched file to
verify that I now had the correct latencies for the recip.fmt
instructions.

There is also an RTX_COSTS problem, but I will deal with that in a later
patch.
-- 
Jim Wilson, GNU Tools Support, http://www.SpecifixInc.com

Attachment: patch.recip.sched
Description: Text document

float sub100 (float);
double sub101 (double);

float
sub1 (float f)
{
  return sub100 (1.0 / f);
}

double
sub2 (double d)
{
  return sub101 (1.0 / d);
}

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