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