>       ST   r0,var(,r13,160)

I assume that should be either ST   r0,var or ST   r0,160var(,r13) and that var 
has an offset of 160 from the DSA. If the programmer's guide documents the 
format of SYSPRINT that may be APARable.

Yes, the code is bloated.


--
Shmuel (Seymour J.) Metz
http://mason.gmu.edu/~smetz3

________________________________________
From: IBM Mainframe Assembler List [[email protected]] on behalf 
of Phil Smith III [[email protected]]
Sent: Thursday, November 11, 2021 6:58 PM
To: [email protected]
Subject: Curious compiler optimization

IBM XLC on z/OS 2.4, under USS.



With NOOPT:

*  int var = 0;

     LA   r4,0

     LR   r0,r4

     ST   r0,var(,r13,160)

That's an interesting way to clear a fullword, no?

And I'm unclear what

var(,r13,160)

is supposed to be-the actual generated opcodes are

5000  D0A0

Which makes sense. Feels like there's an extra comma in there and an extra
offset. Maybe this is the compiler's way of saying "This is tinkering with
var, which is at offset 160"? I.e., it explicitly mentions both the variable
name and the 160 for readability?



With OPT(3):

*  int var = 0;

             MVHI     var(r13,160),H'0'

             LA       r0,0

Saner, but still a bit curious-halfword?? Maybe it's so clever it's reusing
something that it knows is already half cleared!?! The LA r0,0 is in
preparation for using it in a subsequent instruction, though that doesn't
explain the redundant register tinkering in the NOOPT version.



None of this matters-it all works fine-but it struck me as odd.

Reply via email to