Trying to go at this the other way (looking at the C code calling an external 
routine) for confirmation. Here's my source code:

#include <stdio.h>
extern "OS" long long FOO();
void MyFunc()
{
    long long bar;
    bar = FOO();

    printf("lld\n", bar);
}

I added the printf to make certain the store into bar did not get optimized 
out. Here's the relevant object code (OPT(2),ARCH(8), unedited):

                           000011 |       *      bar = FOO();
 00010E  5820  4000        000011 |                 L        
r2,=Q(@STATIC)(,r4,0)
 000112  A719  0000        000011 |                 LGHI     r1,H'0'
 000116  58E2  5000        000011 |                 L        
r14,FOO_ptr(r2,r5,0)
 00011A  98F0  E008        000011 |                 LM       
r15,r0,&EPA_&WSA(r14,8)
 00011E  5000  C1F4        000011 |                 ST       
r0,_CEECAA_(,r12,500)
 000122  0DEF              000011 |                 BASR     r14,r15
 000124  EBEF  0020  001C  000011 |                 RLLG     r14,r15,32
                           000012 |       *  
                           000013 |       *      printf("lld\n", bar);
 00012A  E360  D0D8  0004  000013 |                 LG       
r6,#SPILL0(,r13,216)
 000130  C00A  0000  0000  000011 |                 NIHF     r0,F'0'
 000136  58F2  6004        000013 |                 L        
r15,printf_ptr(r2,r6,4)
 00013A  C0EB  0000  0000  000011 |                 NILF     r14,F'0'
 000140  C020  0000  0068  000013 |                 LARL     r2,F'104'
 000146  4110  D0BC        000013 |                 LA       
r1,#MX_TEMP1(,r13,188)
 00014A  B981  00E0        000011 |                 OGR      r14,r0
 00014E  50E0  D0C4        000013 |                 ST       
r14,#MX_TEMP1(,r13,196)
 000152  5020  D0BC        000013 |                 ST       
r2,#MX_TEMP1(,r13,188)
 000156  EB2E  0020  000A  000013 |                 SRAG     r2,r14,32
 00015C  98F0  F008        000013 |                 LM       
r15,r0,&EPA_&WSA(r15,8)
 000160  5000  C1F4        000013 |                 ST       
r0,_CEECAA_(,r12,500)
 000164  5020  D0C0        000013 |                 ST       
r2,#MX_TEMP1(,r13,192)
 000168  0DEF              000013 |                 BASR     r14,r15

I see the C picking up low bits of R15 into the high bits of R14 (RLLG, NILF) 
and the low bits of R0 into the low bits of R14 (NIHF, OGR).

Unless someone disagrees with my interpretation I think that confirms high bits 
in R15, low bits in R0. Backwards from what I might have expected had someone 
just said "R15 and R0" as R15 is the "normal" location for a return value so I 
would associate that with the "long" part. 

Some convoluted stuff there. The compiler goes to all the trouble of assembling 
the 64 bit value in R14 and then ends up doing two separate stores into 
#MX_TEMP1+192&196, one from R14 and another after having moved the high bits of 
R14 into the low bits of R2 (SRAG).

Charles

----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to [email protected] with the message: INFO IBM-MAIN

Reply via email to