This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
How do I stop gcc from loading data into registers when that's not needed?
- From: Paul Koning <paulkoning at comcast dot net>
- To: GCC <gcc at gcc dot gnu dot org>
- Date: Fri, 18 May 2018 14:03:05 -0400
- Subject: How do I stop gcc from loading data into registers when that's not needed?
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