On Wed, Apr 22, 2009 at 6:25 PM, Paul Gilmartin <paulgboul...@aim.com> wrote:
> On Wed, 22 Apr 2009 13:36:13 -0400, Thomas David Rivers wrote:
>
>>Johnny Luo wrote:
>>> Hi,
>>>
>>> I was trying new METAL option of XL C and the following is the HLASM code
>>> generated :
>>>
>>> *  {
>>> *    char a[20]="12345";
>>>          MVC   88(6,13),0(11)
>
> Is that the actual initialization, in which case the next 4
> instructions are incomprehensible?
>
>>>          MVI   @74a+6,0
>>>          MVC   @74a+7(13),@74a+6
>>>          MVI   @74a+6,0
>>>          MVC   @74a+7(13),@74a+6
>>> *   return;
>>> * }
>>>
> I wouldn't expect it to move 13 characters to assign a 5-character
> (well, 6, counting the terminating NUL) in a 20-character buffer.
>

It is initializing the rest of the automatic storage to zeros (twice),
which probably has to do with the compiler options in effect.
I can't say why it is done twice;  seems like a bug to me.

I would suggest that you compile the same thing with the regular XLC
compiler and look at the generated assembler listing to see if it does
the same thing (double zeroing).

Interesting that they didn't use XC, isn't it?   If you spend any time
looking at XLC generated code you will see lots of interesting stuff.
Of particular interest is some of the loop unwinding optimizations.
After a while you start to wonder if you should ever write in
assembler again, since only IBM knows what instruction heuristics
slide through the pipelines the best.

----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to lists...@bama.ua.edu with the message: GET IBM-MAIN INFO
Search the archives at http://bama.ua.edu/archives/ibm-main.html

Reply via email to