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

* Re: [PATCH] Explicitly add -msse2 to compile HF related libgcc source file.
  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
                     ` (2 more replies)
  0 siblings, 3 replies; 18+ messages in thread
From: Jakub Jelinek @ 2021-09-03  9:00 UTC (permalink / raw)
  To: liuhongt; +Cc: gcc-patches, joseph

On Fri, Sep 03, 2021 at 03:41:13PM +0800, liuhongt via Gcc-patches wrote:
> --- 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

Please avoid this.

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

Aren't the [sdxt]f<->[sdxt]f extend/trunc conversions in libgcc for
quite a while?  If so, using -msse2 for those seems wrong, it is fine
if we require -msse2 support for anything that uses HF or HC mode
types, but if just trying to convert other types it should work even on
just i386 or i486.

> +
> +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

See above.

Also, shouldn't the *hf* and *hc* APIs be exported from libgcc_s.so.1?

   254: 0000000000011960   968 FUNC    LOCAL  DEFAULT   13 __floattihf
   256: 00000000000116f0   315 FUNC    LOCAL  DEFAULT   13 __fixhfti
   263: 000000000000f950  1358 FUNC    LOCAL  DEFAULT   13 __truncsfhf2
   264: 000000000000db10   272 FUNC    LOCAL  DEFAULT   13 __extendhfsf2
   265: 000000000000df70   399 FUNC    LOCAL  DEFAULT   13 __extendhfxf2
   267: 0000000000011fe0   469 FUNC    LOCAL  DEFAULT   13 __eqhf2
   268: 0000000000011d30   681 FUNC    LOCAL  DEFAULT   13 __floatuntihf
   271: 000000000000dc20   374 FUNC    LOCAL  DEFAULT   13 __extendhfdf2
   274: 0000000000011830   292 FUNC    LOCAL  DEFAULT   13 __fixunshfti
   281: 000000000000dda0   460 FUNC    LOCAL  DEFAULT   13 __extendhftf2
   283: 000000000000e860  1439 FUNC    LOCAL  DEFAULT   13 __trunctfhf2
   285: 0000000000011fe0   469 FUNC    LOCAL  DEFAULT   13 __nehf2
   286: 0000000000006290  1627 FUNC    LOCAL  DEFAULT   13 __divhc3
   290: 000000000000ee00  1499 FUNC    LOCAL  DEFAULT   13 __truncxfhf2
   292: 000000000000f3e0  1392 FUNC    LOCAL  DEFAULT   13 __truncdfhf2
   296: 0000000000005150  1931 FUNC    LOCAL  DEFAULT   13 __mulhc3

So, don't we want GCC_12.0 with those symbols
in config/i386/libgcc-glibc.ver and perhaps others?

	Jakub


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

* Re: [PATCH] Explicitly add -msse2 to compile HF related libgcc source file.
  2021-09-03  9:00 ` Jakub Jelinek
@ 2021-09-03 12:32   ` Iain Sandoe
  2021-09-03 12:33     ` Jakub Jelinek
  2021-09-06  1:42   ` Hongtao Liu
  2021-09-06  1:43   ` [PATCH] Explicitly add -msse2 to compile HF related libgcc source file Hongtao Liu
  2 siblings, 1 reply; 18+ messages in thread
From: Iain Sandoe @ 2021-09-03 12:32 UTC (permalink / raw)
  To: Jakub Jelinek; +Cc: liuhongt, GCC Patches, Joseph Myers



> On 3 Sep 2021, at 10:00, Jakub Jelinek via Gcc-patches <gcc-patches@gcc.gnu.org> wrote:
> 
> On Fri, Sep 03, 2021 at 03:41:13PM +0800, liuhongt via Gcc-patches wrote:
>> --- 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
> 
> Please avoid this.
> 
>> --- 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
> 
> Aren't the [sdxt]f<->[sdxt]f extend/trunc conversions in libgcc for
> quite a while?  If so, using -msse2 for those seems wrong, it is fine
> if we require -msse2 support for anything that uses HF or HC mode
> types, but if just trying to convert other types it should work even on
> just i386 or i486.
> 
>> +
>> +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
> 
> See above.
> 
> Also, shouldn't the *hf* and *hc* APIs be exported from libgcc_s.so.1?
> 
>   254: 0000000000011960   968 FUNC    LOCAL  DEFAULT   13 __floattihf
>   256: 00000000000116f0   315 FUNC    LOCAL  DEFAULT   13 __fixhfti
>   263: 000000000000f950  1358 FUNC    LOCAL  DEFAULT   13 __truncsfhf2
>   264: 000000000000db10   272 FUNC    LOCAL  DEFAULT   13 __extendhfsf2
>   265: 000000000000df70   399 FUNC    LOCAL  DEFAULT   13 __extendhfxf2
>   267: 0000000000011fe0   469 FUNC    LOCAL  DEFAULT   13 __eqhf2
>   268: 0000000000011d30   681 FUNC    LOCAL  DEFAULT   13 __floatuntihf
>   271: 000000000000dc20   374 FUNC    LOCAL  DEFAULT   13 __extendhfdf2
>   274: 0000000000011830   292 FUNC    LOCAL  DEFAULT   13 __fixunshfti
>   281: 000000000000dda0   460 FUNC    LOCAL  DEFAULT   13 __extendhftf2
>   283: 000000000000e860  1439 FUNC    LOCAL  DEFAULT   13 __trunctfhf2
>   285: 0000000000011fe0   469 FUNC    LOCAL  DEFAULT   13 __nehf2
>   286: 0000000000006290  1627 FUNC    LOCAL  DEFAULT   13 __divhc3
>   290: 000000000000ee00  1499 FUNC    LOCAL  DEFAULT   13 __truncxfhf2
>   292: 000000000000f3e0  1392 FUNC    LOCAL  DEFAULT   13 __truncdfhf2
>   296: 0000000000005150  1931 FUNC    LOCAL  DEFAULT   13 __mulhc3
> 
> So, don't we want GCC_12.0 with those symbols
> in config/i386/libgcc-glibc.ver and perhaps others?

this works for me on Darwin - I didn’t try it on Linux so far though (and didn’t
look at solaris etc. which have thier own sym maps).

-------

diff --git a/libgcc/libgcc-std.ver.in b/libgcc/libgcc-std.ver.in
index cea33267e53..f5c1bc1aa6c 100644
--- a/libgcc/libgcc-std.ver.in
+++ b/libgcc/libgcc-std.ver.in
@@ -1944,3 +1944,21 @@ GCC_7.0.0 {
   __PFX__divmoddi4
   __PFX__divmodti4
 }
+
+%inherit GCC_12.0.0 GCC_7.0.0
+ GCC_12.0.0 {
+  __PFX__eqhf2
+  __PFX__extendhfdf2
+  __PFX__extendhfsf2
+  __PFX__extendhftf2
+  __PFX__extendhfxf2
+  __PFX__fixhfti
+  __PFX__fixunshfti
+  __PFX__floattihf
+  __PFX__floatuntihf
+  __PFX__nehf2
+  __PFX__truncdfhf2
+  __PFX__truncsfhf2
+  __PFX__trunctfhf2
+  __PFX__truncxfhf2
+}


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

* Re: [PATCH] Explicitly add -msse2 to compile HF related libgcc source file.
  2021-09-03 12:32   ` Iain Sandoe
@ 2021-09-03 12:33     ` Jakub Jelinek
  2021-09-03 12:36       ` Iain Sandoe
  0 siblings, 1 reply; 18+ messages in thread
From: Jakub Jelinek @ 2021-09-03 12:33 UTC (permalink / raw)
  To: Iain Sandoe; +Cc: liuhongt, GCC Patches, Joseph Myers

On Fri, Sep 03, 2021 at 01:32:14PM +0100, Iain Sandoe via Gcc-patches wrote:
> diff --git a/libgcc/libgcc-std.ver.in b/libgcc/libgcc-std.ver.in
> index cea33267e53..f5c1bc1aa6c 100644
> --- a/libgcc/libgcc-std.ver.in
> +++ b/libgcc/libgcc-std.ver.in
> @@ -1944,3 +1944,21 @@ GCC_7.0.0 {
>    __PFX__divmoddi4
>    __PFX__divmodti4
>  }
> +
> +%inherit GCC_12.0.0 GCC_7.0.0
> + GCC_12.0.0 {
> +  __PFX__eqhf2
> +  __PFX__extendhfdf2
> +  __PFX__extendhfsf2
> +  __PFX__extendhftf2
> +  __PFX__extendhfxf2
> +  __PFX__fixhfti
> +  __PFX__fixunshfti
> +  __PFX__floattihf
> +  __PFX__floatuntihf
> +  __PFX__nehf2
> +  __PFX__truncdfhf2
> +  __PFX__truncsfhf2
> +  __PFX__trunctfhf2
> +  __PFX__truncxfhf2
> +}

No *hc* entrypoints?

	Jakub


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

* Re: [PATCH] Explicitly add -msse2 to compile HF related libgcc source file.
  2021-09-03 12:33     ` Jakub Jelinek
@ 2021-09-03 12:36       ` Iain Sandoe
  2021-09-06  8:01         ` Jakub Jelinek
  0 siblings, 1 reply; 18+ messages in thread
From: Iain Sandoe @ 2021-09-03 12:36 UTC (permalink / raw)
  To: Jakub Jelinek; +Cc: liuhongt, GCC Patches, Joseph Myers



> On 3 Sep 2021, at 13:33, Jakub Jelinek via Gcc-patches <gcc-patches@gcc.gnu.org> wrote:
> 
> On Fri, Sep 03, 2021 at 01:32:14PM +0100, Iain Sandoe via Gcc-patches wrote:
>> diff --git a/libgcc/libgcc-std.ver.in b/libgcc/libgcc-std.ver.in
>> index cea33267e53..f5c1bc1aa6c 100644
>> --- a/libgcc/libgcc-std.ver.in
>> +++ b/libgcc/libgcc-std.ver.in
>> @@ -1944,3 +1944,21 @@ GCC_7.0.0 {
>>   __PFX__divmoddi4
>>   __PFX__divmodti4
>> }
>> +
>> +%inherit GCC_12.0.0 GCC_7.0.0
>> + GCC_12.0.0 {
>> +  __PFX__eqhf2
>> +  __PFX__extendhfdf2
>> +  __PFX__extendhfsf2
>> +  __PFX__extendhftf2
>> +  __PFX__extendhfxf2
>> +  __PFX__fixhfti
>> +  __PFX__fixunshfti
>> +  __PFX__floattihf
>> +  __PFX__floatuntihf
>> +  __PFX__nehf2
>> +  __PFX__truncdfhf2
>> +  __PFX__truncsfhf2
>> +  __PFX__trunctfhf2
>> +  __PFX__truncxfhf2
>> +}
> 
> No *hc* entrypoints?

oops EWRONGPATCH

diff --git a/libgcc/libgcc-std.ver.in b/libgcc/libgcc-std.ver.in
index cea33267e53..902a9364850 100644
--- a/libgcc/libgcc-std.ver.in
+++ b/libgcc/libgcc-std.ver.in
@@ -1944,3 +1944,23 @@ GCC_7.0.0 {
   __PFX__divmoddi4
   __PFX__divmodti4
 }
+
+%inherit GCC_12.0.0 GCC_7.0.0
+ GCC_12.0.0 {
+  __PFX__divhc3
+  __PFX__mulhc3
+  __PFX__eqhf2
+  __PFX__extendhfdf2
+  __PFX__extendhfsf2
+  __PFX__extendhftf2
+  __PFX__extendhfxf2
+  __PFX__fixhfti
+  __PFX__fixunshfti
+  __PFX__floattihf
+  __PFX__floatuntihf
+  __PFX__nehf2
+  __PFX__truncdfhf2
+  __PFX__truncsfhf2
+  __PFX__trunctfhf2
+  __PFX__truncxfhf2
+}



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

* Re: [PATCH] Explicitly add -msse2 to compile HF related libgcc source file.
  2021-09-03  9:00 ` Jakub Jelinek
  2021-09-03 12:32   ` Iain Sandoe
@ 2021-09-06  1:42   ` Hongtao Liu
  2021-09-06  7:08     ` Jakub Jelinek
  2021-09-06  1:43   ` [PATCH] Explicitly add -msse2 to compile HF related libgcc source file Hongtao Liu
  2 siblings, 1 reply; 18+ messages in thread
From: Hongtao Liu @ 2021-09-06  1:42 UTC (permalink / raw)
  To: Jakub Jelinek; +Cc: liuhongt, GCC Patches, Joseph Myers

[-- Attachment #1: Type: text/plain, Size: 3700 bytes --]

On Fri, Sep 3, 2021 at 5:01 PM Jakub Jelinek via Gcc-patches
<gcc-patches@gcc.gnu.org> wrote:
>
> On Fri, Sep 03, 2021 at 03:41:13PM +0800, liuhongt via Gcc-patches wrote:
> > --- 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
>
> Please avoid this.
>
Changed.
> > --- 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
>
> Aren't the [sdxt]f<->[sdxt]f extend/trunc conversions in libgcc for
> quite a while?  If so, using -msse2 for those seems wrong, it is fine
> if we require -msse2 support for anything that uses HF or HC mode
> types, but if just trying to convert other types it should work even on
> just i386 or i486.
Yes, removed.
>
> > +
> > +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
>
> See above.
Changed.
>
> Also, shouldn't the *hf* and *hc* APIs be exported from libgcc_s.so.1?
>
>    254: 0000000000011960   968 FUNC    LOCAL  DEFAULT   13 __floattihf
>    256: 00000000000116f0   315 FUNC    LOCAL  DEFAULT   13 __fixhfti
>    263: 000000000000f950  1358 FUNC    LOCAL  DEFAULT   13 __truncsfhf2
>    264: 000000000000db10   272 FUNC    LOCAL  DEFAULT   13 __extendhfsf2
>    265: 000000000000df70   399 FUNC    LOCAL  DEFAULT   13 __extendhfxf2
>    267: 0000000000011fe0   469 FUNC    LOCAL  DEFAULT   13 __eqhf2
>    268: 0000000000011d30   681 FUNC    LOCAL  DEFAULT   13 __floatuntihf
>    271: 000000000000dc20   374 FUNC    LOCAL  DEFAULT   13 __extendhfdf2
>    274: 0000000000011830   292 FUNC    LOCAL  DEFAULT   13 __fixunshfti
>    281: 000000000000dda0   460 FUNC    LOCAL  DEFAULT   13 __extendhftf2
>    283: 000000000000e860  1439 FUNC    LOCAL  DEFAULT   13 __trunctfhf2
>    285: 0000000000011fe0   469 FUNC    LOCAL  DEFAULT   13 __nehf2
>    286: 0000000000006290  1627 FUNC    LOCAL  DEFAULT   13 __divhc3
>    290: 000000000000ee00  1499 FUNC    LOCAL  DEFAULT   13 __truncxfhf2
>    292: 000000000000f3e0  1392 FUNC    LOCAL  DEFAULT   13 __truncdfhf2
>    296: 0000000000005150  1931 FUNC    LOCAL  DEFAULT   13 __mulhc3
>
> So, don't we want GCC_12.0 with those symbols
> in config/i386/libgcc-glibc.ver and perhaps others?
>
>         Jakub
>

Here is an updated patch.

-- 
BR,
Hongtao

[-- Attachment #2: v2-0001-Explicitly-add-msse2-to-compile-HF-related-libgcc.patch --]
[-- Type: text/x-patch, Size: 3671 bytes --]

From 6a5c7de52269b44222d8b6909827513125264dee Mon Sep 17 00:00:00 2001
From: liuhongt <hongtao.liu@intel.com>
Date: Fri, 3 Sep 2021 13:06:57 +0800
Subject: [PATCH v2] Explicitly add -msse2 to compile HF related libgcc source
 file.

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.

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    | 22 +++++++++++++++++++++-
 5 files changed, 35 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..3bec464d786 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
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..2363ea17194 100644
--- a/libgcc/config/i386/t-softfp
+++ b/libgcc/config/i386/t-softfp
@@ -1,6 +1,26 @@
 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-truncsfhf2.c += -msse2
+CFLAGS-truncdfhf2.c += -msse2
+CFLAGS-truncxfhf2.c += -msse2
+CFLAGS-trunctfhf2.c += -msse2
+
+CFLAGS-eqhf2.c += -msse2
+CFLAGS-_divhc3.c += -msse2
+CFLAGS-_mulhc3.c += -msse2
-- 
2.18.1


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

* Re: [PATCH] Explicitly add -msse2 to compile HF related libgcc source file.
  2021-09-03  9:00 ` Jakub Jelinek
  2021-09-03 12:32   ` Iain Sandoe
  2021-09-06  1:42   ` Hongtao Liu
@ 2021-09-06  1:43   ` Hongtao Liu
  2 siblings, 0 replies; 18+ messages in thread
From: Hongtao Liu @ 2021-09-06  1:43 UTC (permalink / raw)
  To: Jakub Jelinek; +Cc: liuhongt, GCC Patches, Joseph Myers

On Fri, Sep 3, 2021 at 5:01 PM Jakub Jelinek via Gcc-patches
<gcc-patches@gcc.gnu.org> wrote:
>
> On Fri, Sep 03, 2021 at 03:41:13PM +0800, liuhongt via Gcc-patches wrote:
> > --- 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
>
> Please avoid this.
>
> > --- 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
>
> Aren't the [sdxt]f<->[sdxt]f extend/trunc conversions in libgcc for
> quite a while?  If so, using -msse2 for those seems wrong, it is fine
> if we require -msse2 support for anything that uses HF or HC mode
> types, but if just trying to convert other types it should work even on
> just i386 or i486.
>
> > +
> > +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
>
> See above.
>
> Also, shouldn't the *hf* and *hc* APIs be exported from libgcc_s.so.1?
>
>    254: 0000000000011960   968 FUNC    LOCAL  DEFAULT   13 __floattihf
>    256: 00000000000116f0   315 FUNC    LOCAL  DEFAULT   13 __fixhfti
>    263: 000000000000f950  1358 FUNC    LOCAL  DEFAULT   13 __truncsfhf2
>    264: 000000000000db10   272 FUNC    LOCAL  DEFAULT   13 __extendhfsf2
>    265: 000000000000df70   399 FUNC    LOCAL  DEFAULT   13 __extendhfxf2
>    267: 0000000000011fe0   469 FUNC    LOCAL  DEFAULT   13 __eqhf2
>    268: 0000000000011d30   681 FUNC    LOCAL  DEFAULT   13 __floatuntihf
>    271: 000000000000dc20   374 FUNC    LOCAL  DEFAULT   13 __extendhfdf2
>    274: 0000000000011830   292 FUNC    LOCAL  DEFAULT   13 __fixunshfti
>    281: 000000000000dda0   460 FUNC    LOCAL  DEFAULT   13 __extendhftf2
>    283: 000000000000e860  1439 FUNC    LOCAL  DEFAULT   13 __trunctfhf2
>    285: 0000000000011fe0   469 FUNC    LOCAL  DEFAULT   13 __nehf2
>    286: 0000000000006290  1627 FUNC    LOCAL  DEFAULT   13 __divhc3
>    290: 000000000000ee00  1499 FUNC    LOCAL  DEFAULT   13 __truncxfhf2
>    292: 000000000000f3e0  1392 FUNC    LOCAL  DEFAULT   13 __truncdfhf2
>    296: 0000000000005150  1931 FUNC    LOCAL  DEFAULT   13 __mulhc3
>
> So, don't we want GCC_12.0 with those symbols
> in config/i386/libgcc-glibc.ver and perhaps others?
I guess Iain will check in this part.
>
>         Jakub
>


-- 
BR,
Hongtao

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

* Re: [PATCH] Explicitly add -msse2 to compile HF related libgcc source file.
  2021-09-06  1:42   ` Hongtao Liu
@ 2021-09-06  7:08     ` Jakub Jelinek
  2021-09-06  7:49       ` Iain Sandoe
  0 siblings, 1 reply; 18+ messages in thread
From: Jakub Jelinek @ 2021-09-06  7:08 UTC (permalink / raw)
  To: Hongtao Liu; +Cc: liuhongt, GCC Patches, Joseph Myers

On Mon, Sep 06, 2021 at 09:42:32AM +0800, Hongtao Liu wrote:
> > Also, shouldn't the *hf* and *hc* APIs be exported from libgcc_s.so.1?
> >
> >    254: 0000000000011960   968 FUNC    LOCAL  DEFAULT   13 __floattihf
> >    256: 00000000000116f0   315 FUNC    LOCAL  DEFAULT   13 __fixhfti
> >    263: 000000000000f950  1358 FUNC    LOCAL  DEFAULT   13 __truncsfhf2
> >    264: 000000000000db10   272 FUNC    LOCAL  DEFAULT   13 __extendhfsf2
> >    265: 000000000000df70   399 FUNC    LOCAL  DEFAULT   13 __extendhfxf2
> >    267: 0000000000011fe0   469 FUNC    LOCAL  DEFAULT   13 __eqhf2
> >    268: 0000000000011d30   681 FUNC    LOCAL  DEFAULT   13 __floatuntihf
> >    271: 000000000000dc20   374 FUNC    LOCAL  DEFAULT   13 __extendhfdf2
> >    274: 0000000000011830   292 FUNC    LOCAL  DEFAULT   13 __fixunshfti
> >    281: 000000000000dda0   460 FUNC    LOCAL  DEFAULT   13 __extendhftf2
> >    283: 000000000000e860  1439 FUNC    LOCAL  DEFAULT   13 __trunctfhf2
> >    285: 0000000000011fe0   469 FUNC    LOCAL  DEFAULT   13 __nehf2
> >    286: 0000000000006290  1627 FUNC    LOCAL  DEFAULT   13 __divhc3
> >    290: 000000000000ee00  1499 FUNC    LOCAL  DEFAULT   13 __truncxfhf2
> >    292: 000000000000f3e0  1392 FUNC    LOCAL  DEFAULT   13 __truncdfhf2
> >    296: 0000000000005150  1931 FUNC    LOCAL  DEFAULT   13 __mulhc3
> >
> > So, don't we want GCC_12.0 with those symbols
> > in config/i386/libgcc-glibc.ver and perhaps others?
> >
> >         Jakub
> >
> 
> Here is an updated patch.

Ok.  The *.ver changes are still needed (see above), but that can be done
incrementally.

	Jakub


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

* Re: [PATCH] Explicitly add -msse2 to compile HF related libgcc source file.
  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
  0 siblings, 1 reply; 18+ messages in thread
From: Iain Sandoe @ 2021-09-06  7:49 UTC (permalink / raw)
  To: Jakub Jelinek; +Cc: Hongtao Liu, liuhongt, GCC Patches, Joseph Myers



> On 6 Sep 2021, at 08:08, Jakub Jelinek via Gcc-patches <gcc-patches@gcc.gnu.org> wrote:
> 
> On Mon, Sep 06, 2021 at 09:42:32AM +0800, Hongtao Liu wrote:
>>> Also, shouldn't the *hf* and *hc* APIs be exported from libgcc_s.so.1?
>>> 
>>>   254: 0000000000011960   968 FUNC    LOCAL  DEFAULT   13 __floattihf
>>>   256: 00000000000116f0   315 FUNC    LOCAL  DEFAULT   13 __fixhfti
>>>   263: 000000000000f950  1358 FUNC    LOCAL  DEFAULT   13 __truncsfhf2
>>>   264: 000000000000db10   272 FUNC    LOCAL  DEFAULT   13 __extendhfsf2
>>>   265: 000000000000df70   399 FUNC    LOCAL  DEFAULT   13 __extendhfxf2
>>>   267: 0000000000011fe0   469 FUNC    LOCAL  DEFAULT   13 __eqhf2
>>>   268: 0000000000011d30   681 FUNC    LOCAL  DEFAULT   13 __floatuntihf
>>>   271: 000000000000dc20   374 FUNC    LOCAL  DEFAULT   13 __extendhfdf2
>>>   274: 0000000000011830   292 FUNC    LOCAL  DEFAULT   13 __fixunshfti
>>>   281: 000000000000dda0   460 FUNC    LOCAL  DEFAULT   13 __extendhftf2
>>>   283: 000000000000e860  1439 FUNC    LOCAL  DEFAULT   13 __trunctfhf2
>>>   285: 0000000000011fe0   469 FUNC    LOCAL  DEFAULT   13 __nehf2
>>>   286: 0000000000006290  1627 FUNC    LOCAL  DEFAULT   13 __divhc3
>>>   290: 000000000000ee00  1499 FUNC    LOCAL  DEFAULT   13 __truncxfhf2
>>>   292: 000000000000f3e0  1392 FUNC    LOCAL  DEFAULT   13 __truncdfhf2
>>>   296: 0000000000005150  1931 FUNC    LOCAL  DEFAULT   13 __mulhc3
>>> 
>>> So, don't we want GCC_12.0 with those symbols
>>> in config/i386/libgcc-glibc.ver and perhaps others?
>>> 
>>>        Jakub
>>> 
>> 
>> Here is an updated patch.
> 
> Ok.  The *.ver changes are still needed (see above), but that can be done
> incrementally.

I can commit the .ver change if that’s approved, sure - for the record I haven’t checked
any targets other than Darwin and Linux.

Iain


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

* Re: [PATCH] Explicitly add -msse2 to compile HF related libgcc source file.
  2021-09-03 12:36       ` Iain Sandoe
@ 2021-09-06  8:01         ` Jakub Jelinek
  0 siblings, 0 replies; 18+ messages in thread
From: Jakub Jelinek @ 2021-09-06  8:01 UTC (permalink / raw)
  To: Iain Sandoe; +Cc: liuhongt, GCC Patches, Joseph Myers

On Fri, Sep 03, 2021 at 01:36:36PM +0100, Iain Sandoe wrote:
> oops EWRONGPATCH
> 
> diff --git a/libgcc/libgcc-std.ver.in b/libgcc/libgcc-std.ver.in
> index cea33267e53..902a9364850 100644
> --- a/libgcc/libgcc-std.ver.in
> +++ b/libgcc/libgcc-std.ver.in
> @@ -1944,3 +1944,23 @@ GCC_7.0.0 {
>    __PFX__divmoddi4
>    __PFX__divmodti4
>  }
> +
> +%inherit GCC_12.0.0 GCC_7.0.0
> + GCC_12.0.0 {
> +  __PFX__divhc3
> +  __PFX__mulhc3
> +  __PFX__eqhf2
> +  __PFX__extendhfdf2
> +  __PFX__extendhfsf2
> +  __PFX__extendhftf2
> +  __PFX__extendhfxf2
> +  __PFX__fixhfti
> +  __PFX__fixunshfti
> +  __PFX__floattihf
> +  __PFX__floatuntihf
> +  __PFX__nehf2
> +  __PFX__truncdfhf2
> +  __PFX__truncsfhf2
> +  __PFX__trunctfhf2
> +  __PFX__truncxfhf2
> +}
> 

I don't think this should be done in libgcc/libgcc-std.ver.in,
the addition of those *h[fc]* entrypoints wasn't a generic change,
but change on a particular target, other targets can add those
entrypoints in GCC 15, never etc.  And while non-existent symbols
are filtered away by the scripts, if some arch adds them later, they
might show up under the GCC_12.0.0 symver instead of some other.
And e.g. aarch64 already has in config/aarch64/libgcc-softfp.ver
  __divhc3
  __extendhftf2
  __fixhfti
  __fixunshfti
  __floattihf
  __floatuntihf
  __mulhc3
  __trunctfhf2
under GCC_11.0 symver.  IMHO those changes
belong to libgcc/config/i386/*.ver but that means multiple files
need changes.

	Jakub


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

* [PATCH] libgcc, i386: Export *hf* and *hc* from libgcc_s.so.1
  2021-09-06  7:49       ` Iain Sandoe
@ 2021-09-06  8:58         ` Jakub Jelinek
  2021-09-07 12:28           ` Jakub Jelinek
  0 siblings, 1 reply; 18+ messages in thread
From: Jakub Jelinek @ 2021-09-06  8:58 UTC (permalink / raw)
  To: Uros Bizjak, Richard Biener, Iain Sandoe
  Cc: Hongtao Liu, liuhongt, GCC Patches, Joseph Myers

On Mon, Sep 06, 2021 at 08:49:27AM +0100, Iain Sandoe wrote:
> > Ok.  The *.ver changes are still needed (see above), but that can be done
> > incrementally.
> 
> I can commit the .ver change if that’s approved, sure - for the record I haven’t checked
> any targets other than Darwin and Linux.

The following patch exports it for Linux from config/i386/*.ver where it
IMNSHO belongs, aarch64 already exports some of those at GCC_11* and other
targets might add them at completely different gcc versions.

Tested on x86_64-linux, verified the right symbols are exported, ok for trunk?

2021-09-06  Jakub Jelinek  <jakub@redhat.com>
	    Iain Sandoe  <iain@sandoe.co.uk>

	* config/i386/libgcc-glibc.ver: Add %inherit GCC_12.0.0 GCC_7.0.0
	and export *hf* and *hc* functions at GCC_12.0.0.

--- libgcc/config/i386/libgcc-glibc.ver.jj	2021-01-05 00:13:58.142298913 +0100
+++ libgcc/config/i386/libgcc-glibc.ver	2021-09-06 10:47:52.244726676 +0200
@@ -194,3 +194,23 @@ GCC_4.8.0 {
   __cpu_indicator_init
 }
 %endif
+
+%inherit GCC_12.0.0 GCC_7.0.0
+GCC_12.0.0 {
+  __divhc3
+  __mulhc3
+  __eqhf2
+  __nehf2
+  __extendhfdf2
+  __extendhfsf2
+  __extendhftf2
+  __extendhfxf2
+  __fixhfti
+  __fixunshfti
+  __floattihf
+  __floatuntihf
+  __truncdfhf2
+  __truncsfhf2
+  __trunctfhf2
+  __truncxfhf2
+}


	Jakub


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

* Re: [PATCH] libgcc, i386: Export *hf* and *hc* from libgcc_s.so.1
  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
  0 siblings, 1 reply; 18+ messages in thread
From: Jakub Jelinek @ 2021-09-07 12:28 UTC (permalink / raw)
  To: Uros Bizjak, Richard Biener, Iain Sandoe, GCC Patches, liuhongt,
	Joseph Myers

On Mon, Sep 06, 2021 at 10:58:53AM +0200, Jakub Jelinek via Gcc-patches wrote:
> On Mon, Sep 06, 2021 at 08:49:27AM +0100, Iain Sandoe wrote:
> > > Ok.  The *.ver changes are still needed (see above), but that can be done
> > > incrementally.
> > 
> > I can commit the .ver change if that’s approved, sure - for the record I haven’t checked
> > any targets other than Darwin and Linux.
> 
> The following patch exports it for Linux from config/i386/*.ver where it
> IMNSHO belongs, aarch64 already exports some of those at GCC_11* and other
> targets might add them at completely different gcc versions.
> 
> Tested on x86_64-linux, verified the right symbols are exported, ok for trunk?

Bootstrapped/regtested on x86_64-linux and i686-linux successfully, though
actually __divhc3 and __mulhc3 aren't exported, they aren't even compiled
into libgcc_s.so.1.  Is that on purpose (large functions very unlikely being
used in most of the programs)?  If yes, I'll drop the __divhc3/__mulhc3
lines.  If not,
LIB2ADD_ST += $(addprefix $(srcdir)/config/i386/, $(libgcc2-hf-extras))
should be changed to
LIB2ADD += $(addprefix $(srcdir)/config/i386/, $(libgcc2-hf-extras))
(untested), or even the LIB2FUNCS_EXCLUDE dropped?

> 2021-09-06  Jakub Jelinek  <jakub@redhat.com>
> 	    Iain Sandoe  <iain@sandoe.co.uk>
> 
> 	* config/i386/libgcc-glibc.ver: Add %inherit GCC_12.0.0 GCC_7.0.0
> 	and export *hf* and *hc* functions at GCC_12.0.0.
> 
> --- libgcc/config/i386/libgcc-glibc.ver.jj	2021-01-05 00:13:58.142298913 +0100
> +++ libgcc/config/i386/libgcc-glibc.ver	2021-09-06 10:47:52.244726676 +0200
> @@ -194,3 +194,23 @@ GCC_4.8.0 {
>    __cpu_indicator_init
>  }
>  %endif
> +
> +%inherit GCC_12.0.0 GCC_7.0.0
> +GCC_12.0.0 {
> +  __divhc3
> +  __mulhc3
> +  __eqhf2
> +  __nehf2
> +  __extendhfdf2
> +  __extendhfsf2
> +  __extendhftf2
> +  __extendhfxf2
> +  __fixhfti
> +  __fixunshfti
> +  __floattihf
> +  __floatuntihf
> +  __truncdfhf2
> +  __truncsfhf2
> +  __trunctfhf2
> +  __truncxfhf2
> +}

	Jakub


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

* Re: [PATCH] libgcc, i386: Export *hf* and *hc* from libgcc_s.so.1
  2021-09-07 12:28           ` Jakub Jelinek
@ 2021-09-08  0:54             ` Hongtao Liu
  2021-09-08  2:37               ` Hongtao Liu
  0 siblings, 1 reply; 18+ messages in thread
From: Hongtao Liu @ 2021-09-08  0:54 UTC (permalink / raw)
  To: Jakub Jelinek
  Cc: Uros Bizjak, Richard Biener, Iain Sandoe, GCC Patches, liuhongt,
	Joseph Myers

On Tue, Sep 7, 2021 at 8:29 PM Jakub Jelinek via Gcc-patches
<gcc-patches@gcc.gnu.org> wrote:
>
> On Mon, Sep 06, 2021 at 10:58:53AM +0200, Jakub Jelinek via Gcc-patches wrote:
> > On Mon, Sep 06, 2021 at 08:49:27AM +0100, Iain Sandoe wrote:
> > > > Ok.  The *.ver changes are still needed (see above), but that can be done
> > > > incrementally.
> > >
> > > I can commit the .ver change if that’s approved, sure - for the record I haven’t checked
> > > any targets other than Darwin and Linux.
> >
> > The following patch exports it for Linux from config/i386/*.ver where it
> > IMNSHO belongs, aarch64 already exports some of those at GCC_11* and other
> > targets might add them at completely different gcc versions.
> >
> > Tested on x86_64-linux, verified the right symbols are exported, ok for trunk?
>
> Bootstrapped/regtested on x86_64-linux and i686-linux successfully, though
> actually __divhc3 and __mulhc3 aren't exported, they aren't even compiled
> into libgcc_s.so.1.  Is that on purpose (large functions very unlikely being
> used in most of the programs)?  If yes, I'll drop the __divhc3/__mulhc3
> lines.  If not,
> LIB2ADD_ST += $(addprefix $(srcdir)/config/i386/, $(libgcc2-hf-extras))
> should be changed to
> LIB2ADD += $(addprefix $(srcdir)/config/i386/, $(libgcc2-hf-extras))
> (untested), or even the LIB2FUNCS_EXCLUDE dropped?
>
I think it's not, let me try to verify it.
> > 2021-09-06  Jakub Jelinek  <jakub@redhat.com>
> >           Iain Sandoe  <iain@sandoe.co.uk>
> >
> >       * config/i386/libgcc-glibc.ver: Add %inherit GCC_12.0.0 GCC_7.0.0
> >       and export *hf* and *hc* functions at GCC_12.0.0.
> >
> > --- libgcc/config/i386/libgcc-glibc.ver.jj    2021-01-05 00:13:58.142298913 +0100
> > +++ libgcc/config/i386/libgcc-glibc.ver       2021-09-06 10:47:52.244726676 +0200
> > @@ -194,3 +194,23 @@ GCC_4.8.0 {
> >    __cpu_indicator_init
> >  }
> >  %endif
> > +
> > +%inherit GCC_12.0.0 GCC_7.0.0
> > +GCC_12.0.0 {
> > +  __divhc3
> > +  __mulhc3
> > +  __eqhf2
> > +  __nehf2
> > +  __extendhfdf2
> > +  __extendhfsf2
> > +  __extendhftf2
> > +  __extendhfxf2
> > +  __fixhfti
> > +  __fixunshfti
> > +  __floattihf
> > +  __floatuntihf
> > +  __truncdfhf2
> > +  __truncsfhf2
> > +  __trunctfhf2
> > +  __truncxfhf2
> > +}
>
>         Jakub
>


-- 
BR,
Hongtao

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

* Re: [PATCH] libgcc, i386: Export *hf* and *hc* from libgcc_s.so.1
  2021-09-08  0:54             ` Hongtao Liu
@ 2021-09-08  2:37               ` Hongtao Liu
  2021-09-08  9:09                 ` Jakub Jelinek
  0 siblings, 1 reply; 18+ messages in thread
From: Hongtao Liu @ 2021-09-08  2:37 UTC (permalink / raw)
  To: Jakub Jelinek
  Cc: Uros Bizjak, Richard Biener, Iain Sandoe, GCC Patches, liuhongt,
	Joseph Myers

On Wed, Sep 8, 2021 at 8:54 AM Hongtao Liu <crazylht@gmail.com> wrote:
>
> On Tue, Sep 7, 2021 at 8:29 PM Jakub Jelinek via Gcc-patches
> <gcc-patches@gcc.gnu.org> wrote:
> >
> > On Mon, Sep 06, 2021 at 10:58:53AM +0200, Jakub Jelinek via Gcc-patches wrote:
> > > On Mon, Sep 06, 2021 at 08:49:27AM +0100, Iain Sandoe wrote:
> > > > > Ok.  The *.ver changes are still needed (see above), but that can be done
> > > > > incrementally.
> > > >
> > > > I can commit the .ver change if that’s approved, sure - for the record I haven’t checked
> > > > any targets other than Darwin and Linux.
> > >
> > > The following patch exports it for Linux from config/i386/*.ver where it
> > > IMNSHO belongs, aarch64 already exports some of those at GCC_11* and other
> > > targets might add them at completely different gcc versions.
> > >
> > > Tested on x86_64-linux, verified the right symbols are exported, ok for trunk?
> >
> > Bootstrapped/regtested on x86_64-linux and i686-linux successfully, though
> > actually __divhc3 and __mulhc3 aren't exported, they aren't even compiled
> > into libgcc_s.so.1.  Is that on purpose (large functions very unlikely being
> > used in most of the programs)?  If yes, I'll drop the __divhc3/__mulhc3
> > lines.  If not,
> > LIB2ADD_ST += $(addprefix $(srcdir)/config/i386/, $(libgcc2-hf-extras))
> > should be changed to
> > LIB2ADD += $(addprefix $(srcdir)/config/i386/, $(libgcc2-hf-extras))
> > (untested), or even the LIB2FUNCS_EXCLUDE dropped?
I was worried w/o this, there would be a duplicate definition error,
but it's not, so removed.
> >
> I think it's not, let me try to verify it.
> > > 2021-09-06  Jakub Jelinek  <jakub@redhat.com>
> > >           Iain Sandoe  <iain@sandoe.co.uk>
> > >
> > >       * config/i386/libgcc-glibc.ver: Add %inherit GCC_12.0.0 GCC_7.0.0
> > >       and export *hf* and *hc* functions at GCC_12.0.0.
> > >
> > > --- libgcc/config/i386/libgcc-glibc.ver.jj    2021-01-05 00:13:58.142298913 +0100
> > > +++ libgcc/config/i386/libgcc-glibc.ver       2021-09-06 10:47:52.244726676 +0200
> > > @@ -194,3 +194,23 @@ GCC_4.8.0 {
> > >    __cpu_indicator_init
> > >  }
> > >  %endif
> > > +
> > > +%inherit GCC_12.0.0 GCC_7.0.0
> > > +GCC_12.0.0 {
> > > +  __divhc3
> > > +  __mulhc3
> > > +  __eqhf2
> > > +  __nehf2
> > > +  __extendhfdf2
> > > +  __extendhfsf2
> > > +  __extendhftf2
> > > +  __extendhfxf2
> > > +  __fixhfti
> > > +  __fixunshfti
> > > +  __floattihf
> > > +  __floatuntihf
> > > +  __truncdfhf2
> > > +  __truncsfhf2
> > > +  __trunctfhf2
> > > +  __truncxfhf2
> > > +}
> >
> >         Jakub
> >
>
>
> --
> BR,
> Hongtao

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

libgcc/ChangeLog:

        * config/i386/t-softfp: Compile __{mul,div}hc3 into
        libgcc_s.so.1.
---
 libgcc/config/i386/t-softfp | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/libgcc/config/i386/t-softfp b/libgcc/config/i386/t-softfp
index 2363ea17194..7620cc0cec5 100644
--- a/libgcc/config/i386/t-softfp
+++ b/libgcc/config/i386/t-softfp
@@ -2,9 +2,8 @@ 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))
+LIB2ADD += $(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
-- 
2.27.0


-- 
BR,
Hongtao

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

* Re: [PATCH] libgcc, i386: Export *hf* and *hc* from libgcc_s.so.1
  2021-09-08  2:37               ` Hongtao Liu
@ 2021-09-08  9:09                 ` Jakub Jelinek
  2021-09-08  9:31                   ` Hongtao Liu
  0 siblings, 1 reply; 18+ messages in thread
From: Jakub Jelinek @ 2021-09-08  9:09 UTC (permalink / raw)
  To: Hongtao Liu
  Cc: Uros Bizjak, Richard Biener, Iain Sandoe, GCC Patches, liuhongt,
	Joseph Myers

On Wed, Sep 08, 2021 at 10:37:17AM +0800, Hongtao Liu wrote:
>   Bootstrapped and regtested on x86_64-linux-gnu{-m32,}.
>   Ok for trunk?
> 
> libgcc/ChangeLog:
> 
>         * config/i386/t-softfp: Compile __{mul,div}hc3 into
>         libgcc_s.so.1.

I think this is ok, but not really useful until the *.ver change is acked,
because what this patch alone does is add extra non-exported entrypoints to
the shared library (aka wasted .text).

>  libgcc/config/i386/t-softfp | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/libgcc/config/i386/t-softfp b/libgcc/config/i386/t-softfp
> index 2363ea17194..7620cc0cec5 100644
> --- a/libgcc/config/i386/t-softfp
> +++ b/libgcc/config/i386/t-softfp
> @@ -2,9 +2,8 @@ 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))
> +LIB2ADD += $(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

	Jakub


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

* Re: [PATCH] libgcc, i386: Export *hf* and *hc* from libgcc_s.so.1
  2021-09-08  9:09                 ` Jakub Jelinek
@ 2021-09-08  9:31                   ` Hongtao Liu
  2021-09-18 19:13                     ` Iain Sandoe
  0 siblings, 1 reply; 18+ messages in thread
From: Hongtao Liu @ 2021-09-08  9:31 UTC (permalink / raw)
  To: Jakub Jelinek
  Cc: Uros Bizjak, Richard Biener, Iain Sandoe, GCC Patches, liuhongt,
	Joseph Myers

On Wed, Sep 8, 2021 at 5:09 PM Jakub Jelinek <jakub@redhat.com> wrote:
>
> On Wed, Sep 08, 2021 at 10:37:17AM +0800, Hongtao Liu wrote:
> >   Bootstrapped and regtested on x86_64-linux-gnu{-m32,}.
> >   Ok for trunk?
> >
> > libgcc/ChangeLog:
> >
> >         * config/i386/t-softfp: Compile __{mul,div}hc3 into
> >         libgcc_s.so.1.
>
> I think this is ok, but not really useful until the *.ver change is acked,
> because what this patch alone does is add extra non-exported entrypoints to
> the shared library (aka wasted .text).
I think your patch is ok (with divhc3/mulhc3), we can check in the
respective patches. :)
>
> >  libgcc/config/i386/t-softfp | 3 +--
> >  1 file changed, 1 insertion(+), 2 deletions(-)
> >
> > diff --git a/libgcc/config/i386/t-softfp b/libgcc/config/i386/t-softfp
> > index 2363ea17194..7620cc0cec5 100644
> > --- a/libgcc/config/i386/t-softfp
> > +++ b/libgcc/config/i386/t-softfp
> > @@ -2,9 +2,8 @@ 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))
> > +LIB2ADD += $(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
>
>         Jakub
>


-- 
BR,
Hongtao

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

* Re: [PATCH] libgcc, i386: Export *hf* and *hc* from libgcc_s.so.1
  2021-09-08  9:31                   ` Hongtao Liu
@ 2021-09-18 19:13                     ` Iain Sandoe
  2021-09-19  3:49                       ` Hongtao Liu
  0 siblings, 1 reply; 18+ messages in thread
From: Iain Sandoe @ 2021-09-18 19:13 UTC (permalink / raw)
  To: Hongtao Liu, Jakub Jelinek; +Cc: GCC Patches

Hi Hongtao,

> On 8 Sep 2021, at 10:31, Hongtao Liu <crazylht@gmail.com> wrote:
> 
> On Wed, Sep 8, 2021 at 5:09 PM Jakub Jelinek <jakub@redhat.com> wrote:
>> 
>> On Wed, Sep 08, 2021 at 10:37:17AM +0800, Hongtao Liu wrote:
>>>  Bootstrapped and regtested on x86_64-linux-gnu{-m32,}.
>>>  Ok for trunk?
>>> 
>>> libgcc/ChangeLog:
>>> 
>>>        * config/i386/t-softfp: Compile __{mul,div}hc3 into
>>>        libgcc_s.so.1.

this was applied as 
https://gcc.gnu.org/pipermail/gcc-cvs/2021-September/353114.html

but it seems that (at least on Linux and Darwin) we now see a lot of:

/src-local/gcc-master-patched/libgcc/shared-object.mk:14: warning: overriding commands for target `_divhc3.o'
Makefile:501: warning: ignoring old commands for target `_divhc3.o'
/src-local/gcc-master-patched/libgcc/shared-object.mk:17: warning: overriding commands for target `_divhc3_s.o’

and I think this is because we need to exclude the libgcc2  version of the functions before adding teh replacements, like the patch below.

tested on x86_64-linux, darwin observing that the __divhc3 and __mulh3 symbols are present and that the metadata for the source files indicates that they are the replacement sources.

OK for master?
Iain

——


[PATCH] libgcc, X86: Exclude rules for libgcc2 __{div,mul}hc3.

We want to override the libgcc2 generic version of these functions
for X86.  First exclude the original and the add in the replacements.

Signed-off-by: Iain Sandoe <iain@sandoe.co.uk>

libgcc/ChangeLog:

	* config/i386/t-softfp: Exclude libgcc2 versions of __divhc3
	and __mulhc3.
---
 libgcc/config/i386/t-softfp | 1 +
 1 file changed, 1 insertion(+)

diff --git a/libgcc/config/i386/t-softfp b/libgcc/config/i386/t-softfp
index 7620cc0cec5..fe2ad8a3c08 100644
--- a/libgcc/config/i386/t-softfp
+++ b/libgcc/config/i386/t-softfp
@@ -2,6 +2,7 @@ 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 += $(addprefix $(srcdir)/config/i386/, $(libgcc2-hf-extras))
 
-- 



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

* Re: [PATCH] libgcc, i386: Export *hf* and *hc* from libgcc_s.so.1
  2021-09-18 19:13                     ` Iain Sandoe
@ 2021-09-19  3:49                       ` Hongtao Liu
  0 siblings, 0 replies; 18+ messages in thread
From: Hongtao Liu @ 2021-09-19  3:49 UTC (permalink / raw)
  To: Iain Sandoe; +Cc: Jakub Jelinek, GCC Patches

On Sunday, September 19, 2021, Iain Sandoe <iain@sandoe-acoustics.co.uk>
wrote:

> Hi Hongtao,
>
> > On 8 Sep 2021, at 10:31, Hongtao Liu <crazylht@gmail.com> wrote:
> >
> > On Wed, Sep 8, 2021 at 5:09 PM Jakub Jelinek <jakub@redhat.com> wrote:
> >>
> >> On Wed, Sep 08, 2021 at 10:37:17AM +0800, Hongtao Liu wrote:
> >>>  Bootstrapped and regtested on x86_64-linux-gnu{-m32,}.
> >>>  Ok for trunk?
> >>>
> >>> libgcc/ChangeLog:
> >>>
> >>>        * config/i386/t-softfp: Compile __{mul,div}hc3 into
> >>>        libgcc_s.so.1.
>
> this was applied as
> https://gcc.gnu.org/pipermail/gcc-cvs/2021-September/353114.html
>
> but it seems that (at least on Linux and Darwin) we now see a lot of:
>
> /src-local/gcc-master-patched/libgcc/shared-object.mk:14: warning:
> overriding commands for target `_divhc3.o'
> Makefile:501: warning: ignoring old commands for target `_divhc3.o'
> /src-local/gcc-master-patched/libgcc/shared-object.mk:17: warning:
> overriding commands for target `_divhc3_s.o’
>
> and I think this is because we need to exclude the libgcc2  version of the
> functions before adding teh replacements, like the patch below.
>
> tested on x86_64-linux, darwin observing that the __divhc3 and __mulh3
> symbols are present and that the metadata for the source files indicates
> that they are the replacement sources.
>
> OK for master?

Yes, thanks.

> Iain
>
> ——


>
> [PATCH] libgcc, X86: Exclude rules for libgcc2 __{div,mul}hc3.
>
> We want to override the libgcc2 generic version of these functions
> for X86.  First exclude the original and the add in the replacements.
>
> Signed-off-by: Iain Sandoe <iain@sandoe.co.uk>
>
> libgcc/ChangeLog:
>
>         * config/i386/t-softfp: Exclude libgcc2 versions of __divhc3
>         and __mulhc3.
> ---
>  libgcc/config/i386/t-softfp | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/libgcc/config/i386/t-softfp b/libgcc/config/i386/t-softfp
> index 7620cc0cec5..fe2ad8a3c08 100644
> --- a/libgcc/config/i386/t-softfp
> +++ b/libgcc/config/i386/t-softfp
> @@ -2,6 +2,7 @@ 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 += $(addprefix $(srcdir)/config/i386/, $(libgcc2-hf-extras))
>
> --
>
>
>

-- 
BR,
Hongtao

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