This is the mail archive of the
mailing list for the GCC project.
Re: Redundant / wasted stack space and instructions
- From: Jeff Law <law at redhat dot com>
- To: pshortis at dataworx dot com dot au, gcc at gcc dot gnu dot org
- Date: Wed, 16 Apr 2014 14:17:31 -0600
- Subject: Re: Redundant / wasted stack space and instructions
- Authentication-results: sourceware.org; auth=none
- References: <b19e95bfc44080cb29e302860366a18d at dataworx dot com dot au> <534DB766 dot 4030502 at dataworx dot com dot au> <9a37ae73d6799c5b56e73da645a1d44c at dataworx dot com dot au>
On 04/16/14 00:30, email@example.com wrote:
I had left the movsi patterns unimplemented because I was told that if I
did this then gcc would create expands/splits to use 16 bit moves. So, I
removed my movsi patterns and all seemed well.
Correct. GCC can synthesize movsi from movhi. However....
Seems plausible. In general the compiler is not as good at optimizing
code with SUBREG expressions.
In comparing the output of the expand pass from the msp430 port and mine
I could see the movsi instructions for the msp430 and the movhi subreg
instructions in mine.
I wondered if using the subreg:HI to split the SI moves into HI moves
was hiding real nature of the moves for reload and future optimizations,
so I reverted to my movsi patterns and ... the spills now resolve back
to the incoming stack parameter slots as desired !
There's a natural tension between making the MD file closely match the
hardware capabilities and presenting a somewhat less accurate, but
easier to optimize description. Determining what's "best" is difficult,
even for those of us with many years of experience with GCC.
In the end, it always comes down to looking how GCC compiles code of
interest and determining how to improve things.
Good to know. LRA is definitely the future, but it's not a "turn on the
bit and everything gets magically better", at least not most of the time.
Oh, and I tried using the LRA on this test case and Jeff, you're correct
the generated code is far, far better.