public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] Explicitly add -msse2 to compile HF related libgcc source file.
@ 2021-09-03  7:41 liuhongt
  2021-09-03  9:00 ` Jakub Jelinek
  0 siblings, 1 reply; 18+ messages in thread
From: liuhongt @ 2021-09-03  7:41 UTC (permalink / raw)
  To: gcc-patches; +Cc: crazylht, hjl.tools, ubizjak, joseph

For 32-bit libgcc configure w/o sse2, there's would be an error since
GCC only support _Float16 under sse2. Explicitly add -msse2 for those
HF related libgcc functions, so users can still link them w/ the
upper configuration.

  Bootstrapped and regtested on x86_64-linux-gnu{-m32,}.
  Ok for trunk?

libgcc/ChangeLog:

	* Makefile.in: Adjust to support specific CFLAGS for each
	libgcc source file.
	* config/i386/64/t-softfp: Explicitly add -msse2 for HF
	related libgcc source files.
	* config/i386/t-softfp: Ditto.
	* config/i386/_divhc3.c: New file.
	* config/i386/_mulhc3.c: New file.
---
 libgcc/Makefile.in             |  2 +-
 libgcc/config/i386/64/t-softfp |  5 +++++
 libgcc/config/i386/_divhc3.c   |  4 ++++
 libgcc/config/i386/_mulhc3.c   |  4 ++++
 libgcc/config/i386/t-softfp    | 34 +++++++++++++++++++++++++++++++++-
 5 files changed, 47 insertions(+), 2 deletions(-)
 create mode 100644 libgcc/config/i386/_divhc3.c
 create mode 100644 libgcc/config/i386/_mulhc3.c

diff --git a/libgcc/Makefile.in b/libgcc/Makefile.in
index 7ec97584554..32e329f7764 100644
--- a/libgcc/Makefile.in
+++ b/libgcc/Makefile.in
@@ -314,7 +314,7 @@ MULTIOSSUBDIR := $(shell if test $(MULTIOSDIR) != .; then echo /$(MULTIOSDIR); f
 inst_libdir = $(libsubdir)$(MULTISUBDIR)
 inst_slibdir = $(slibdir)$(MULTIOSSUBDIR)
 
-gcc_compile_bare = $(CC) $(INTERNAL_CFLAGS)
+gcc_compile_bare = $(CC) $(INTERNAL_CFLAGS) $(CFLAGS-$(<F))
 compile_deps = -MT $@ -MD -MP -MF $(basename $@).dep
 gcc_compile = $(gcc_compile_bare) -o $@ $(compile_deps)
 gcc_s_compile = $(gcc_compile) -DSHARED
diff --git a/libgcc/config/i386/64/t-softfp b/libgcc/config/i386/64/t-softfp
index f9d8b3a945c..e1c480efbdf 100644
--- a/libgcc/config/i386/64/t-softfp
+++ b/libgcc/config/i386/64/t-softfp
@@ -1 +1,6 @@
 softfp_extras := fixhfti fixunshfti floattihf floatuntihf
+
+CFLAGS-fixhfti.c += -msse2
+CFLAGS-fixunshfti.c += -msse2
+CFLAGS-floattihf.c += -msse2
+CFLAGS-floatunstihf.c += -msse2
\ No newline at end of file
diff --git a/libgcc/config/i386/_divhc3.c b/libgcc/config/i386/_divhc3.c
new file mode 100644
index 00000000000..4cf92aa23d9
--- /dev/null
+++ b/libgcc/config/i386/_divhc3.c
@@ -0,0 +1,4 @@
+#ifdef __SSE2__
+#define L_divhc3
+#include "libgcc2.c"
+#endif
diff --git a/libgcc/config/i386/_mulhc3.c b/libgcc/config/i386/_mulhc3.c
new file mode 100644
index 00000000000..85a8a2f5fb7
--- /dev/null
+++ b/libgcc/config/i386/_mulhc3.c
@@ -0,0 +1,4 @@
+#ifdef __SSE2__
+#define L_mulhc3
+#include "libgcc2.c"
+#endif
diff --git a/libgcc/config/i386/t-softfp b/libgcc/config/i386/t-softfp
index 4ac214eb0ce..be13f10f984 100644
--- a/libgcc/config/i386/t-softfp
+++ b/libgcc/config/i386/t-softfp
@@ -1,6 +1,38 @@
 LIB2ADD += $(srcdir)/config/i386/sfp-exceptions.c
 
+# Replace _divhc3 and _mulhc3.
+libgcc2-hf-functions = _divhc3 _mulhc3
+LIB2FUNCS_EXCLUDE += $(libgcc2-hf-functions)
+libgcc2-hf-extras = $(addsuffix .c, $(libgcc2-hf-functions))
+LIB2ADD_ST += $(addprefix $(srcdir)/config/i386/, $(libgcc2-hf-extras))
+
 softfp_extensions := hfsf hfdf hftf hfxf sfdf sftf dftf xftf
 softfp_truncations := tfhf xfhf dfhf sfhf tfsf dfsf tfdf tfxf
 
-softfp_extras += eqhf2
\ No newline at end of file
+softfp_extras += eqhf2
+
+CFLAGS-extendhfsf2.c += -msse2
+CFLAGS-extendhfdf2.c += -msse2
+CFLAGS-extendhftf2.c += -msse2
+CFLAGS-extendhfxf2.c += -msse2
+
+CFLAGS-extendsfdf2.c += -msse2
+CFLAGS-extendsftf2.c += -msse2
+
+CFLAGS-extenddftf2.c += -msse2
+CFLAGS-extendxftf2.c += -msse2
+
+CFLAGS-truncsfhf2.c += -msse2
+CFLAGS-truncdfhf2.c += -msse2
+CFLAGS-truncxfhf2.c += -msse2
+CFLAGS-trunctfhf2.c += -msse2
+
+CFLAGS-truncdfsf2.c += -msse2
+CFLAGS-trunctfsf2.c += -msse2
+
+CFLAGS-trunctfdf2.c += -msse2
+CFLAGS-trunctfxf2.c += -msse2
+
+CFLAGS-eqhf2.c += -msse2
+CFLAGS-_divhc3.c += -msse2
+CFLAGS-_mulhc3.c += -msse2
\ No newline at end of file
-- 
2.18.1


^ permalink raw reply	[flat|nested] 18+ messages in thread

end of thread, other threads:[~2021-09-19  3:49 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-09-03  7:41 [PATCH] Explicitly add -msse2 to compile HF related libgcc source file liuhongt
2021-09-03  9:00 ` Jakub Jelinek
2021-09-03 12:32   ` Iain Sandoe
2021-09-03 12:33     ` Jakub Jelinek
2021-09-03 12:36       ` Iain Sandoe
2021-09-06  8:01         ` Jakub Jelinek
2021-09-06  1:42   ` Hongtao Liu
2021-09-06  7:08     ` Jakub Jelinek
2021-09-06  7:49       ` Iain Sandoe
2021-09-06  8:58         ` [PATCH] libgcc, i386: Export *hf* and *hc* from libgcc_s.so.1 Jakub Jelinek
2021-09-07 12:28           ` Jakub Jelinek
2021-09-08  0:54             ` Hongtao Liu
2021-09-08  2:37               ` Hongtao Liu
2021-09-08  9:09                 ` Jakub Jelinek
2021-09-08  9:31                   ` Hongtao Liu
2021-09-18 19:13                     ` Iain Sandoe
2021-09-19  3:49                       ` Hongtao Liu
2021-09-06  1:43   ` [PATCH] Explicitly add -msse2 to compile HF related libgcc source file Hongtao Liu

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).