Everything
9.1.4 Rules Concerning Setting and Referencing Return Values

General rules concerning return values and the areas for setting return values are described.

(1)

Type Conversion of a Return Value

A return value is converted to the data type returned by the function.

Example

(2)

Return Value Setting Area

The return value of a function is written to either a register or memory depending on its type. Refer to Table 9.3 for the relationship between the type and the setting area of the return value.

Table 9.3

Return Value Type and Setting Area

Return Value Type

Return Value Setting Area

signed char, (unsigned) char, (signed) short, unsigned short, (signed) int, unsigned int, (signed) long, unsigned long, float, double*2, long double*2, pointer, bool, _Bool, reference, and pointer to a data member

R1

Note however that the result of sign extension is set for signed char or (signed) short type, and the result of zero extension is set for (unsigned) char or unsigned short type.

double*3, long double*3, (signed) long long, and unsigned long long

R1, R2

The lower four bytes are set to R1 and the upper four bytes are set to R2.

Structure, union, or class whose size is 16 bytes or less and is also a multiple of 4

They are set from the beginning of the memory image in 4-byte units in the order of R1, R2, R3, and R4.

Structure, union, or class other than those above

Return value setting area (memory)*1

Notes 1.

When a function return value is to be written to memory, the return value is written to the area indicated by the return value address. The caller must allocate the return value setting area in addition to the parameter area, and must set the address of the return value setting area in R15 before calling the function.

Notes 2.

When dbl_size=8 is not specified.

Notes 3.

When dbl_size=8 is specified.