Bug 51729 - dspr2-MULT.c and dspr2-MULTU.c fail for MIPS
Summary: dspr2-MULT.c and dspr2-MULTU.c fail for MIPS
Status: RESOLVED WONTFIX
Alias: None
Product: gcc
Classification: Unclassified
Component: target (show other bugs)
Version: 4.7.0
: P3 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-01-02 11:26 UTC by Richard Sandiford
Modified: 2020-02-25 10:21 UTC (History)
2 users (show)

See Also:
Host:
Target: mips64-linux-gnu
Build:
Known to work:
Known to fail: 4.7.0
Last reconfirmed: 2012-01-04 00:00:00


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Richard Sandiford 2012-01-02 11:26:26 UTC
dspr2-MULT.c and dspr2-MULTU.c are supposed to test that we use the
DSP accumulator registers to parallelise multiplications.  They don't
work in 4.7, and I'm about to XFAIL them.  There seem to be two main
problems:

* The cost of moving between DSP accumulators is greater than the cost
  of moving a DSP register to or from memory.  When I last looked,
  this was enough to make the register allocator consider memory to
  be cheaper.

  This isn't a problem without -mdsp because there is then only one
  accumulator register, LO+HI.  (Note that we no longer allow HI and
  LO to store independent values.)  The cost of moving between accumulators
  is therefore ignored.

  On some (many?) targets, moving something out of an accumulator
  and back again _is_ more expensive than storing an accumulator
  to memory, so this isn't necessarily a bug in the backend.

* Even if we massage the costs to avoid that problem, each of the pseudos
  that we'd like to use accumulators has one "=ka" constraint and one
  "d" constraint.  At one point this meant that DSP_REGS and GENERAL_REGS
  had the same cost, and reg_alloc_order could be used to prefer accumulators:

    http://gcc.gnu.org/ml/gcc/2010-12/msg00471.html
    http://gcc.gnu.org/ml/gcc/2011-01/msg00093.html

  But GENERAL_REGS now seems to have a lower cost, and since GENERAL_REGS
  are much easier to spill than DSP_REGS, it's hard to argue with that.
Comment 1 Richard Sandiford 2012-01-02 11:33:39 UTC
Author: rsandifo
Date: Mon Jan  2 11:33:35 2012
New Revision: 182793

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=182793
Log:
gcc/testsuite/
	PR target/51729
	* gcc.target/mips/dspr2-MULT.c: Remove -ffixed-hi -ffixed-lo.
	XFAIL.
	* gcc.target/mips/dspr2-MULTU.c: Likewise.

Modified:
    trunk/gcc/testsuite/ChangeLog
    trunk/gcc/testsuite/gcc.target/mips/dspr2-MULT.c
    trunk/gcc/testsuite/gcc.target/mips/dspr2-MULTU.c
Comment 2 Andrew Pinski 2012-01-04 01:19:39 UTC
Confirmed.
Comment 3 Matthew Fortune 2014-07-31 15:19:20 UTC
The affected tests appear to have started passing again since this commit:

svn: r211959

    2014-06-24  Catherine Moore  <clm@codesourcery.com>
            Sandra Loosemore  <sandra@codesourcery.com>

        gcc/
        * config/mips/mips.c (mips_order_regs_for_local_alloc): Delete.
        * config/mips/mips.h (ADJUST_REG_ALLOC_ORDER): Delete.
        * config/mips/mips-protos.h (mips_order_regs_for_local_alloc): Delete.

Irritatingly they now pass for -O2 and -O3 but still fail for -O1 and -Os. I was half tempted to submit a patch to just be content that we get multiple accumulators now used at -O2 and -O3 and leave it at that but I think that is probably the wrong attitude.

Has anyone else noticed the change in state for these tests and looked into it, planning to look into it or have any thoughts? I'll take a look when I get chance.
Comment 4 Richard Sandiford 2020-02-25 10:21:35 UTC
Seems unlikely that this will ever be fixed.  The main point of the
PR was to act as a reference point for the XFAIL, and closing the PR
wouldn't affect that.