Widening multiplications (was: Re: GCC porting tutorials)

Hans-Peter Nilsson hans-peter.nilsson@axis.com
Wed Apr 28 17:22:00 GMT 2010

> Date: Tue, 27 Apr 2010 20:41:47 +0200 (CEST)
> From: "Jonas Paulsson" <d03jp@student.lth.se>

> I've been following the discussion a bit about contributing, and find
> myself here now even directly pointed at :-) As I mentioned, I am not very
> experienced with GCC, for one thing I have not studied other ports very
> much. To make a GCC patch for this problem to be generally handled is then
> a bit over my head, but perhaps with some mentoring from someone with
> enough experience, I could give it a try!

I'd be happy to help where I can, but I should say I'm not a
tree (gimple, SSA) aficionado.

As a first step, enter a bug report with actual C source (and
the emitted assembly code) showing the lack of widening
multiplication instructions (those [su]mulsi{di3|3_highpart}) in
a context where they should be emitted but aren't (in a loop),
and where they with a small modification are (loop removed).
Pick a familiar target with widening multiplications.  It should
come as no surprise that I'd choose CRIS v32 (at least v8), but
for example i386, MIPS and ARM have these instructions as well.
Bonus points if the code shows the general problem for more than
one architecture (shouldn't be a problem, and I think target
maintainers will chime in here).  Please do this for current
source trunk, but certainly okay if you do it *also* for a
branch or a release.

> The solution of handling this during expansion that I used, is not wrong
> the way I see it.

Then by all means, pursue.  I couldn't see any immediate errors.
The tree-people will most likely make themselves heard, not the
least if the solution is wrong.  Beware: you might not get a
clear go-ahead just on a high-level proposal.  Be prepared to
code and then rewrite if the suggested solution is judged to be
Not the Right Thing at the higher level.

By the way, this is a good time for getting the copyright
assignment paperwork done.  If you wait until code is written,
the paperwork might take long enough that you lose interest or
something else happens; it *can* take months.  Mention current
employment status to get the right papers.

brgds, H-P

More information about the Gcc mailing list