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

via llvm-commits llvm-commits at lists.llvm.org
Mon Oct 6 23:14:31 PDT 2025


koachan wrote:

Tagging this as WIP since there's some parts that's incomplete, I just want to solicit some advice for now.

The status is that for C code (e.g `long double square(long double num) { return num * num; }`) it seems to pass and return the values correctly, however with direct LLVM IR like so:
```
declare fp128 @fmul(fp128 %a, fp128 %b)

define fp128 @square(fp128 %num) {
    %ret = call fp128 @fmul(fp128 %num, fp128 %num)
    ret fp128 %ret
}
```
I'm still seeing miscompilations:
```
square:
	save %sp, -120, %sp
	ldd [%fp+92], %f0
	ldd [%fp+100], %f4
	ld [%fp+64], %i0
	add %fp, -16, %i1
	st %i1, [%sp+64]
	std %f4, [%sp+104]
	std %f0, [%sp+96]
	std %f4, [%sp+100]  ! Misaligned store, also overlaps with the one in line 8
	call fmul
	std %f0, [%sp+92]   ! Misaligned store, also overlaps with the one in line 9
	unimp 16
	ldd [%fp+-8], %f0
	ldd [%fp+-16], %f4
	std %f0, [%i0+8]
	std %f4, [%i0]
	ret                 ! Should be jmp [%i7+12]
	restore
```

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


More information about the llvm-commits mailing list