public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: liuhongt <hongtao.liu@intel.com>
To: gcc-patches@gcc.gnu.org
Cc: crazylht@gmail.com, hjl.tools@gmail.com, ubizjak@gmail.com,
	joseph@codesourcery.com
Subject: [PATCH] Explicitly add -msse2 to compile HF related libgcc source file.
Date: Fri,  3 Sep 2021 15:41:13 +0800	[thread overview]
Message-ID: <20210903074113.39461-1-hongtao.liu@intel.com> (raw)

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


             reply	other threads:[~2021-09-03  7:41 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-03  7:41 liuhongt [this message]
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

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=20210903074113.39461-1-hongtao.liu@intel.com \
    --to=hongtao.liu@intel.com \
    --cc=crazylht@gmail.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=hjl.tools@gmail.com \
    --cc=joseph@codesourcery.com \
    --cc=ubizjak@gmail.com \
    /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).