[clang] [compiler-rt] [llvm] [SPARC] Properly handle CC for long double on sparc32 (PR #162226)

via cfe-commits cfe-commits at lists.llvm.org
Sun Oct 19 21:03:31 PDT 2025


koachan wrote:

> The code in question is
> 
> ```
>    0x114e0 <test__divtc3+400>:	st  %i0, [ %fp + -1484 ]
>    0x114e4 <test__divtc3+404>:	ld  [ %fp + -160 ], %i0
>    0x114e8 <test__divtc3+408>:	st  %i0, [ %fp + -1488 ]
>    0x114ec <test__divtc3+412>:	ld  [ %fp + -168 ], %i0
>    0x114f0 <test__divtc3+416>:	st  %i0, [ %fp + -1496 ]
>    0x114f4 <test__divtc3+420>:	add  %fp, -1432, %i0
>    0x114f8 <test__divtc3+424>:	call  0x13a8c <__divtc3>
>    0x114fc <test__divtc3+428>:	st  %i0, [ %sp + 0x40 ]
> => 0x11500 <test__divtc3+432>:	illtrap  0x20
> ```
> 
> I haven't looked closer yet.

I think this is the `long double _Complex` issue biting us.
You said in [D89130](https://reviews.llvm.org/D89130) that those values are always returned in registers (and hence, calls to it should be lowered without the trailing illtrap), but LLVM lowers it into an `{ fp128, fp128 }` aggregate which the backend undersands to be a struct (hence the trailing illtrap).

@efriedma-quic is there a way for us to disambiguate it in `RetCC_Sparc32`? If the `{ fp128, fp128 }` comes from a `long double _Complex` then return it in register, otherwise treat it normally as a struct, or something like that.

https://github.com/llvm/llvm-project/pull/162226


More information about the cfe-commits mailing list