ABI for i128 on x86-32?

Hello,

Does anyone know of any precedent for handling i128 in the
calling convention on x86-32? I'm trying to write a testcase
that returns an i128 value, and LLVM currently has only two
32-bit GPRs designated for returning integer values on x86-32.

Dan

I think it's returned in 4 registers: eax, edx, esi, edi. Can someone confirm?

Evan

BTW, I think the type name for i128 is intmax_t and uintmax_t (see inttypes.h).

Evan

Judging from the code in gcc, it goes in XMM0 if SSE is there, and in memory otherwise.
See ix86_return_in_memory. (In 4.3 this is renamed to return_in_memory_32.)
i128==TImode.

I think it's returned in 4 registers: eax, edx, esi, edi. Can someone
confirm?

I don't think there is a standard ABI. I'd be find with allocating a hidden argument and returning the values by reference. At some point we'll have to start doing this: if not for i128, then for multiple return values.

Anton mentioned that Fortran uses i128 on 32-bit systems, Anton do you know if they can be returned, and if so what ABI they use?

-Chris

See ix86_return_in_memory. (In 4.3 this is renamed to
return_in_memory_32.)
i128==TImode.

But TImode should be used for __m128 stuff only there, not for integers.
I'm looking into gfortran now.

Anton mentioned that Fortran uses i128 on 32-bit systems, Anton do you
know if they can be returned, and if so what ABI they use?

Looks like, that warning is generated during emission of decl of
__sync_fetch_and_add_16. I don't have any gcc 4.2.x+ here, so if
somebody have it available on 32-bit machine - please check the stuff.

You may be right. There are certainly places in that file where TImode refers
to ints, but they may all be in TARGET_64BIT code.

Thanks everyone for your input here; I'm actually not going
to persue this at this time. x86-64 does support i128 return
values, and that's sufficient for my current needs.

Dan