On 2021-11-13 01:04, Peter Relson wrote:
<snip>
When it needs zero, it merely copies it into anther
register that it has allocated?

Yes, but why not just store the register that they know already contains
zero?
</snip>

Because they do not necessarily "know" that when the code is generated. It
might well be that the removal of the extra instructions and the
"knowledge" itself is an optimization, and the OP asked for no
optimization. So this is not a curious "optimization". It is a natural
non-optimization. Unless the OP's curiosity was about use of MVHI which,
as was pointed out, is fully correct.

I'd think that if you want decent code, you don't ask for no optimization. If you do ask for no optimization, you get what you get. Maybe that helps
you learn how these compilers generate code. For example, the "initial"
pass of the code-gen for z system does not necessarily assume knowledge of
there being only 16 GRs available.

Regarding "ST   r0,var(,r13,160)"
I have no idea, but this is not assembler, it is pseudo-assembler.

Not having seen more examples, I'm guessing that
it's giving you the standard assembler version "ST r0,var"
with the index, base, and displacement corresponding to "var"
in parentheses.

If they
don't document otherwise, it can be as "pseudo" as they choose. Maybe the leading comma is to indicate that there is no index register. That's how
you'd code it in assembler (of course you'd have the "160" where "var"
is).

Peter Relson
z/OS Core Technology Design

Reply via email to