Page MenuHomeFreeBSD

lib/msun: add LoongArch support
Needs ReviewPublic

Authored by zhaoxiaoqiang007_gmail.com on Tue, Sep 22, 2:24 PM.
Tags
None
Referenced Files
Unknown Object (File)
Tue, Oct 13, 10:00 AM
Unknown Object (File)
Mon, Oct 12, 5:11 PM
Unknown Object (File)
Sat, Oct 10, 4:40 PM
Unknown Object (File)
Wed, Oct 7, 4:58 AM
Unknown Object (File)
Mon, Oct 5, 12:29 AM
Unknown Object (File)
Sat, Oct 3, 8:00 PM
Unknown Object (File)
Sat, Oct 3, 12:32 PM
Unknown Object (File)
Fri, Oct 2, 8:13 PM

Details

Summary

Add the fenv implementation and build glue, and mark the known
long-double test failures as expected on loongarch.

Signed-off-by: Xiaoqiang Zhao <zhaoxiaoqiang007@gmail.com>
Signed-off-by: yu shan wei <mpysw@vip.163.com>

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Skipped
Unit
Tests Skipped
Build Status
Buildable 77175
Build 74058: arc lint + arc unit

Event Timeline

shipujin.t_gmail.com added inline comments.
lib/msun/loongarch/fenv.h
198

fadd.d $f0,$f0,$f assumes $f0+$f0 is exact, but LoongArch ELF ABI Table 2 ($fa0, "Preserved across calls: No") leaves $f0 an unspecified caller residue — verified: stale DBL_MAX makes feraise(FE_INEXACT) set OVERFLOW (0x50000), worst case spurious SIGFPE and Cause overwritten (Vol 1 Table 3-3). Trigger idea is right per §3.2.4.5; zero scratch first (change,verified).

Suggested change to:

	__asm __volatile("movgr2fr.d $f0, $zero\n\tfadd.d $f0,$f0,$f0" : : : "$f0");

https://loongson.github.io/LoongArch-Documentation/LoongArch-ELF-ABI-EN.html#_register_convention