How do I stop gcc from loading data into registers when that's not needed?

Paul Koning paulkoning@comcast.net
Fri May 18 18:03:00 GMT 2018


Gents,

In some targets, like pdp11 and vax, most instructions can reference data in memory directly.

So when I have "if (x < y) ..." I would expect something like this:

	cmpw  x, y
	bgeq  1f
	...

What I actually see, with -O2 and/or -Os, is:

	movw  x, r0
	movw  y, r1
	cmpw  r0, r1
	bgeq  1f
	...

which is both longer and slower.  I can't tell why this happens, or how to stop it.  The machine description has "general_operand" so it doesn't seem to be the place that forces things into registers.

	paul



More information about the Gcc mailing list