This is the mail archive of the 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: Redundant / wasted stack space and instructions

On 04/16/14 00:30, 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....

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 !
Seems plausible. In general the compiler is not as good at optimizing code with SUBREG expressions.

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.

Oh, and I tried using the LRA on this test case and Jeff, you're correct
the generated code is far, far better.
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.


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