[PATCH v7 2/5] LoongArch: Add support for LA32 in sysdeps/loongarch/fpu
mengqinggang
mengqinggang@loongson.cn
Mon Mar 23 07:28:20 GMT 2026
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
More information about the Libc-alpha
mailing list