On Tue, Dec 8, 2015 at 9:22 AM, Charles Mills <[email protected]> wrote:
> Has anyone returned a long long (64 bit) value from non-XPLINK assembler to
> IBM XLC? (C++, if it makes any difference.) I am referring to a return
> value
> as in long long MYFUNC(). I know I can pass a 64-bit integer by reference.
>
> It seems to me it ought to work -- register 15 has been 64 bits for what?
> ten years now? -- but the P/G explicitly says "R15 Return value for integer
> types (long int, short int, char) and pointer types. Otherwise set to 0."
>
> Thanks,
>
> Charles
>
>
I did a quick compile (segment below). The return value of "long long" is
returned in the lower 32 bits of R15 (upper word) and R0 (lower word).
compile listed (heavily edited!)
000119 | * }
000120 | * long long myfunc(void) {
return 1L;}
000088 000120 | myfunc DS 0D
000088 47F0 F024 000120 | B 36(,r15)
00008C 01C3C5C5 CEE eyecatcher
000090 00000098 DSA size
000094 00001B70 =A(PPA1-myfunc)
000098 47F0 F001 000120 | B 1(,r15)
00009C 58F0 C31C 000120 | L r15,796(,r12)
0000A0 184E 000120 | LR r4,r14
0000A2 05EF 000120 | BALR r14,r15
0000A4 00000000 =F'0'
0000A8 A7F4 000C 000120 | J *+24
0000AC 90E4 D00C 000120 | STM r14,r4,12(r13)
0000B0 58E0 D04C 000120 | L r14,76(,r13)
0000B4 4100 E098 000120 | LA r0,152(,r14)
0000B8 5500 C314 000120 | CL r0,788(,r12)
0000BC A724 FFF0 000120 | JH *-32
0000C0 5000 E04C 000120 | ST r0,76(,r14)
0000C4 9210 E000 000120 | MVI 0(r14),16
0000C8 50D0 E004 000120 | ST r13,4(,r14)
0000CC 18DE 000120 | LR r13,r14
0000CE End of Prolog
0000CE 41F0 0000 000120 | LA r15,0
0000D2 4100 0001 000120 | LA r0,1
0000D6 000120 | @2L73 DS 0H
0000D6 Start of Epilog
0000D6 58D0 D004 000120 | L r13,4(,r13)
0000DA 58E0 D00C 000120 | L r14,12(,r13)
0000DE 9824 D01C 000120 | LM r2,r4,28(r13)
0000E2 051E 000120 | BALR r1,r14
0000E4 0707 000120 | NOPR 7
--
Schrodinger's backup: The condition of any backup is unknown until a
restore is attempted.
Yoda of Borg, we are. Futile, resistance is, yes. Assimilated, you will be.
He's about as useful as a wax frying pan.
10 to the 12th power microphones = 1 Megaphone
Maranatha! <><
John McKown
----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to [email protected] with the message: INFO IBM-MAIN