public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Xi Ruoyao <xry111@xry111.site>
To: Yang Yujie <yangyujie@loongson.cn>, gcc-patches@gcc.gnu.org
Cc: ibuclaw@gdcproject.org, chenglulu@loongson.cn, xuchenghua@loongson.cn
Subject: Re: [PATCH v2 3/3] libphobos: LoongArch hardware support.
Date: Fri, 01 Dec 2023 16:39:10 +0800	[thread overview]
Message-ID: <579f4e41b5a92850e5a837cf0a166427548b5051.camel@xry111.site> (raw)
In-Reply-To: <20231201074626.2943513-4-yangyujie@loongson.cn>

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 <xry111@xry111.site>
School of Aerospace Science and Technology, Xidian University

  reply	other threads:[~2023-12-01  8:39 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-12-01  7:46 [PATCH v2 0/3] LoongArch D support Yang Yujie
2023-12-01  7:46 ` [PATCH v2 1/3] LoongArch: Adjust D version strings Yang Yujie
2023-12-01  7:46 ` [PATCH v2 2/3] libphobos: Update build scripts for LoongArch64 Yang Yujie
2023-12-01  7:46 ` [PATCH v2 3/3] libphobos: LoongArch hardware support Yang Yujie
2023-12-01  8:39   ` Xi Ruoyao [this message]
2023-12-01  8:48     ` Yang Yujie
2023-12-07 10:41   ` Iain Buclaw
2023-12-07 12:35     ` Xi Ruoyao

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=579f4e41b5a92850e5a837cf0a166427548b5051.camel@xry111.site \
    --to=xry111@xry111.site \
    --cc=chenglulu@loongson.cn \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=ibuclaw@gdcproject.org \
    --cc=xuchenghua@loongson.cn \
    --cc=yangyujie@loongson.cn \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).