public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
From: mengqinggang <mengqinggang@loongson.cn>
To: libc-alpha@sourceware.org
Cc: adhemerval.zanella@linaro.org, fweimer@redhat.com,
	xuchenghua@loongson.cn, caiyinyu@loongson.cn,
	chenglulu@loongson.cn, xry111@xry111.site, i.swmail@xen0n.name,
	maskray@google.com, luweining@loongson.cn, hejinyang@loongson.cn,
	mengqinggang@loongson.cn
Subject: [PATCH v6 2/6] LoongArch: Add support for LA32 in sysdeps/loongarch/fpu
Date: Thu, 12 Mar 2026 09:41:59 +0800	[thread overview]
Message-ID: <20260312014203.1916933-3-mengqinggang@loongson.cn> (raw)
In-Reply-To: <20260312014203.1916933-1-mengqinggang@loongson.cn>

Move the loongarch64 implementation to sysdeps/loongarch/lp64/fpu.
---
 sysdeps/loongarch/fpu/math-use-builtins-llrint.h |  2 +-
 sysdeps/loongarch/fpu/math-use-builtins-logb.h   |  2 +-
 sysdeps/loongarch/fpu/math-use-builtins-lrint.h  |  2 +-
 sysdeps/loongarch/fpu/math-use-builtins-rint.h   |  2 +-
 sysdeps/loongarch/fpu/math-use-builtins-sqrt.h   | 10 ++++++++--
 sysdeps/loongarch/lp64/fpu/Implies               |  1 +
 sysdeps/loongarch/{ => lp64}/fpu/e_scalb.c       |  0
 sysdeps/loongarch/{ => lp64}/fpu/e_scalbf.c      |  0
 sysdeps/loongarch/{ => lp64}/fpu/s_scalbn.c      |  0
 sysdeps/loongarch/{ => lp64}/fpu/s_scalbnf.c     |  0
 sysdeps/loongarch/{ => lp64}/fpu/w_ilogb-impl.h  |  0
 sysdeps/loongarch/{ => lp64}/fpu/w_ilogbf-impl.h |  0
 12 files changed, 13 insertions(+), 6 deletions(-)
 create mode 100644 sysdeps/loongarch/lp64/fpu/Implies
 rename sysdeps/loongarch/{ => lp64}/fpu/e_scalb.c (100%)
 rename sysdeps/loongarch/{ => lp64}/fpu/e_scalbf.c (100%)
 rename sysdeps/loongarch/{ => lp64}/fpu/s_scalbn.c (100%)
 rename sysdeps/loongarch/{ => lp64}/fpu/s_scalbnf.c (100%)
 rename sysdeps/loongarch/{ => lp64}/fpu/w_ilogb-impl.h (100%)
 rename sysdeps/loongarch/{ => lp64}/fpu/w_ilogbf-impl.h (100%)

diff --git a/sysdeps/loongarch/fpu/math-use-builtins-llrint.h b/sysdeps/loongarch/fpu/math-use-builtins-llrint.h
index bee5910b09..82f89d41f9 100644
--- a/sysdeps/loongarch/fpu/math-use-builtins-llrint.h
+++ b/sysdeps/loongarch/fpu/math-use-builtins-llrint.h
@@ -1,4 +1,4 @@
-#if __GNUC_PREREQ (13, 0)
+#if __GNUC_PREREQ (13, 0) && __loongarch_grlen == 64
 # define USE_LLRINT_BUILTIN 1
 # define USE_LLRINTF_BUILTIN 1
 #else
diff --git a/sysdeps/loongarch/fpu/math-use-builtins-logb.h b/sysdeps/loongarch/fpu/math-use-builtins-logb.h
index b1c3f30dc4..d8ca3d1aa2 100644
--- a/sysdeps/loongarch/fpu/math-use-builtins-logb.h
+++ b/sysdeps/loongarch/fpu/math-use-builtins-logb.h
@@ -1,4 +1,4 @@
-#if __GNUC_PREREQ (13, 0)
+#if __GNUC_PREREQ (13, 0) && __loongarch_grlen == 64
 # define USE_LOGB_BUILTIN 1
 # define USE_LOGBF_BUILTIN 1
 #else
diff --git a/sysdeps/loongarch/fpu/math-use-builtins-lrint.h b/sysdeps/loongarch/fpu/math-use-builtins-lrint.h
index 7df8aac81f..80345fdf3f 100644
--- a/sysdeps/loongarch/fpu/math-use-builtins-lrint.h
+++ b/sysdeps/loongarch/fpu/math-use-builtins-lrint.h
@@ -1,4 +1,4 @@
-#if __GNUC_PREREQ (13, 0)
+#if __GNUC_PREREQ (13, 0) && __loongarch_grlen == 64
 # define USE_LRINT_BUILTIN 1
 # define USE_LRINTF_BUILTIN 1
 #else
diff --git a/sysdeps/loongarch/fpu/math-use-builtins-rint.h b/sysdeps/loongarch/fpu/math-use-builtins-rint.h
index cd91482f5f..73ce3e45bc 100644
--- a/sysdeps/loongarch/fpu/math-use-builtins-rint.h
+++ b/sysdeps/loongarch/fpu/math-use-builtins-rint.h
@@ -1,4 +1,4 @@
-#if __GNUC_PREREQ (13, 0)
+#if __GNUC_PREREQ (13, 0) && __loongarch_grlen == 64
 #  define USE_RINT_BUILTIN 1
 #  define USE_RINTF_BUILTIN 1
 #else
diff --git a/sysdeps/loongarch/fpu/math-use-builtins-sqrt.h b/sysdeps/loongarch/fpu/math-use-builtins-sqrt.h
index e94c915ba6..f031bd7536 100644
--- a/sysdeps/loongarch/fpu/math-use-builtins-sqrt.h
+++ b/sysdeps/loongarch/fpu/math-use-builtins-sqrt.h
@@ -1,4 +1,10 @@
-#define USE_SQRT_BUILTIN 1
-#define USE_SQRTF_BUILTIN 1
+#if __loongarch_grlen == 64
+  #define USE_SQRT_BUILTIN 1
+  #define USE_SQRTF_BUILTIN 1
+#else
+  #define USE_SQRT_BUILTIN 0
+  #define USE_SQRTF_BUILTIN 0
+#endif
+
 #define USE_SQRTL_BUILTIN 0
 #define USE_SQRTF128_BUILTIN 0
diff --git a/sysdeps/loongarch/lp64/fpu/Implies b/sysdeps/loongarch/lp64/fpu/Implies
new file mode 100644
index 0000000000..fccda41bd0
--- /dev/null
+++ b/sysdeps/loongarch/lp64/fpu/Implies
@@ -0,0 +1 @@
+loongarch/lp64/fpu
diff --git a/sysdeps/loongarch/fpu/e_scalb.c b/sysdeps/loongarch/lp64/fpu/e_scalb.c
similarity index 100%
rename from sysdeps/loongarch/fpu/e_scalb.c
rename to sysdeps/loongarch/lp64/fpu/e_scalb.c
diff --git a/sysdeps/loongarch/fpu/e_scalbf.c b/sysdeps/loongarch/lp64/fpu/e_scalbf.c
similarity index 100%
rename from sysdeps/loongarch/fpu/e_scalbf.c
rename to sysdeps/loongarch/lp64/fpu/e_scalbf.c
diff --git a/sysdeps/loongarch/fpu/s_scalbn.c b/sysdeps/loongarch/lp64/fpu/s_scalbn.c
similarity index 100%
rename from sysdeps/loongarch/fpu/s_scalbn.c
rename to sysdeps/loongarch/lp64/fpu/s_scalbn.c
diff --git a/sysdeps/loongarch/fpu/s_scalbnf.c b/sysdeps/loongarch/lp64/fpu/s_scalbnf.c
similarity index 100%
rename from sysdeps/loongarch/fpu/s_scalbnf.c
rename to sysdeps/loongarch/lp64/fpu/s_scalbnf.c
diff --git a/sysdeps/loongarch/fpu/w_ilogb-impl.h b/sysdeps/loongarch/lp64/fpu/w_ilogb-impl.h
similarity index 100%
rename from sysdeps/loongarch/fpu/w_ilogb-impl.h
rename to sysdeps/loongarch/lp64/fpu/w_ilogb-impl.h
diff --git a/sysdeps/loongarch/fpu/w_ilogbf-impl.h b/sysdeps/loongarch/lp64/fpu/w_ilogbf-impl.h
similarity index 100%
rename from sysdeps/loongarch/fpu/w_ilogbf-impl.h
rename to sysdeps/loongarch/lp64/fpu/w_ilogbf-impl.h
-- 
2.34.1


  parent reply	other threads:[~2026-03-12  1:46 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-12  1:41 [PATCH v6 0/6] Add support for LoongArch32 mengqinggang
2026-03-12  1:41 ` [PATCH v6 1/6] LoongArch: Add support for LA32 in sysdeps/loongarch mengqinggang
2026-03-12  1:41 ` mengqinggang [this message]
2026-03-12  1:42 ` [PATCH v6 3/6] LoongArch: Add new file for LA32 in sysdeps/loongarch/ilp32 mengqinggang
2026-03-12  1:42 ` [PATCH v6 4/6] LoongArch: Add support for LA32 in sysdeps/unix/sysv/linux/loongarch mengqinggang
2026-03-12  1:42 ` [PATCH v6 5/6] LoongArch: Add new files for LA32 in sysdeps/unix/sysv/linux/loongarch/ilp32 mengqinggang
2026-03-12  1:42 ` [PATCH v6 6/6] Fix 'cbaud_to_speed' defined but not used on LA32 mengqinggang

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=20260312014203.1916933-3-mengqinggang@loongson.cn \
    --to=mengqinggang@loongson.cn \
    --cc=adhemerval.zanella@linaro.org \
    --cc=caiyinyu@loongson.cn \
    --cc=chenglulu@loongson.cn \
    --cc=fweimer@redhat.com \
    --cc=hejinyang@loongson.cn \
    --cc=i.swmail@xen0n.name \
    --cc=libc-alpha@sourceware.org \
    --cc=luweining@loongson.cn \
    --cc=maskray@google.com \
    --cc=xry111@xry111.site \
    --cc=xuchenghua@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).