From: | glen herrmannsfeldt <gah@ugcs.caltech.edu> |
Newsgroups: | comp.compilers |
Date: | Fri, 4 Nov 2011 21:19:14 +0000 (UTC) |
Organization: | Aioe.org NNTP Server |
References: | 11-10-019 11-11-004 11-11-005 11-11-014 11-11-018 11-11-023 |
Keywords: | optimize |
Posted-Date: | 06 Nov 2011 23:48:45 EST |
George Neuner <gneuner2@comcast.net> wrote:
(snip)
> Yes. But the original question involve 2 registers both being loaded
> with the same constant value. The OP asked why use a 2nd register. I
> gave a couple of reasons why that might be, and then Glen brought up
> renaming.
I brought up register renaming when someone else brought up
out-of-order execution.
> We haven't seen the actual code, but from the description it appears
> that the compiler could have reused the original register but instead
> chose to use a different one.
There are many possible reasons. For IA32, some registers
have special uses, such that not all can be reused.
> We also don't know what CPU, but regardless, renaming only might
> have been done if the compiler had used a copy instruction.
I do hope that it doesn't load an actual zero from memory.
Also, some zeros should be optimized away. If, for example,
something was then added to the zero.
> With the use of constant loads there was no possibility of renaming
> being performed.
I don't know about others, but the 360/91 can rename loads
from the same address, or store followed by load. Mostly that
was needed with the goal of running unmodified S/360 code, and
the small number of floating point registers.
Is there any machine without a one instruction way to zero
a register?
-- glen
Return to the
comp.compilers page.
Search the
comp.compilers archives again.