On Fri, 2023-12-01 at 15:46 +0800, Yang Yujie wrote: > diff --git a/libphobos/src/std/math/hardware.d > b/libphobos/src/std/math/hardware.d > index cb6cb87845c..8d11459a8ac 100644 > --- a/libphobos/src/std/math/hardware.d > +++ b/libphobos/src/std/math/hardware.d > @@ -177,6 +177,20 @@ private: > return result; > } > } > + else version (LoongArch_Any) > + { > + version (D_SoftFloat) > + return 0; > + else > + { > + uint result = void; > + asm pure nothrow @nogc > + { > + "movfcsr2gr %0,$r2" : "=r" (result); > + } > + return result & EXCEPTIONS_MASK; > + } > + } > else > assert(0, "Not yet supported"); > } > @@ -285,6 +299,18 @@ private: > } > } > } > + else version (LoongArch_Any) > + { > + version (D_SoftFloat) > + return; > + else > + { > + asm nothrow @nogc > + { > + "movgr2fcsr $r2,$r0"; > + } > + } > + } > else > assert(0, "Not yet supported"); > } > @@ -999,6 +1025,20 @@ private: > } > return cont; > } > + else version (LoongArch_Any) > + { > + version (D_SoftFloat) > + return 0; > + else > + { > + ControlState cont; > + asm pure nothrow @nogc > + { > + "movfcsr2gr %0,$r0" : "=r" (cont); > + } > + cont &= (roundingMask | allExceptions); > + } > + } > else version (RISCV_Any) > { > version (D_SoftFloat) > @@ -1118,6 +1158,19 @@ private: > } > } > } > + else version (LoongArch_Any) > + { > + version (D_SoftFloat) > + return; > + else > + { > + asm nothrow @nogc > + { > + "movgr2fcsr $r0,%0" : > + : "r" (newState & (roundingMask | > allExceptions)); > + } > + } > + } > else version (RISCV_Any) > { > version (D_SoftFloat)
This part seems https://github.com/dlang/phobos/commit/870eb5d5d6972b12dd4b69d48ef049abee811b6b. Iain: would it be better to just perform a merge from upstream dmd? -- Xi Ruoyao <xry...@xry111.site> School of Aerospace Science and Technology, Xidian University