* [PATCH][ARM] RTABI half-precision conversion functions @ 2011-02-14 12:43 Andrew Stubbs 2011-02-14 13:17 ` Andrew Stubbs 0 siblings, 1 reply; 7+ messages in thread From: Andrew Stubbs @ 2011-02-14 12:43 UTC (permalink / raw) To: gcc-patches This patch switches GCC from using "__gnu_h2f_ieee" to the EABI-defined name "__aeabi_h2f", and likewise for the other related functions. The old names remain available as aliases. I've run all the GCC testsuites with no regressions. OK? Andrew ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH][ARM] RTABI half-precision conversion functions 2011-02-14 12:43 [PATCH][ARM] RTABI half-precision conversion functions Andrew Stubbs @ 2011-02-14 13:17 ` Andrew Stubbs 2011-02-14 18:22 ` Joseph S. Myers 0 siblings, 1 reply; 7+ messages in thread From: Andrew Stubbs @ 2011-02-14 13:17 UTC (permalink / raw) To: gcc-patches [-- Attachment #1: Type: text/plain, Size: 342 bytes --] On 14/02/11 12:41, Andrew Stubbs wrote: > This patch switches GCC from using "__gnu_h2f_ieee" to the EABI-defined > name "__aeabi_h2f", and likewise for the other related functions. The > old names remain available as aliases. > > I've run all the GCC testsuites with no regressions. > > OK? It's probably better with the patch .... Andrew [-- Attachment #2: eabi-half-precision.patch --] [-- Type: text/x-patch, Size: 5784 bytes --] 2011-02-03 Andrew Stubbs <ams@codesourcery.com> gcc/ * config/arm/arm.c (arm_init_libfuncs): Change __gnu_f2h_ieee to __aeabi_f2h, __gnu_f2h_alternative to __aeabi_f2h_alt, __gnu_h2f_ieee to __aeabi_h2f, and __gnu_h2f_alternative to __aeabi_h2f_alt. * config/arm/fp16.c (__gnu_f2h_internal): Change return type to unsigned int. Change 'sign' variable likewise. (__gnu_h2f_internal): Set to static inline. Change return type to unsigned int. Change 'sign' variable likewise. (ALIAS): New define. (__gnu_f2h_ieee): Change unsigned short to unsigned int. (__gnu_h2f_ieee): Likewise. (__gnu_f2h_alternative): Likewise. (__gnu_h2f_alternative): Likewise. (__aeabi_f2h, __aeabi_h2f): New aliases. (__aeabi_f2h_alt, __aeabi_h2f_alt): Likewise. * config/arm/sfp-machine.h (__extendhfsf2): Set to __aeabi_h2f. (__truncsfhf2): Set to __aeabi_f2h. gcc/testsuite/ * g++.dg/ext/arm-fp16/arm-fp16-ops-5.C: Check for __aeabi_h2f and __aeabi_f2h. * g++.dg/ext/arm-fp16/arm-fp16-ops-6.C: Likewise. * gcc.dg/torture/arm-fp16-ops-5.c: Likewise. * gcc.dg/torture/arm-fp16-ops-6.c: Likewise. --- a/gcc/config/arm/arm.c +++ b/gcc/config/arm/arm.c @@ -1190,12 +1190,12 @@ arm_init_libfuncs (void) /* Conversions. */ set_conv_libfunc (trunc_optab, HFmode, SFmode, (arm_fp16_format == ARM_FP16_FORMAT_IEEE - ? "__gnu_f2h_ieee" - : "__gnu_f2h_alternative")); + ? "__aeabi_f2h" + : "__aeabi_f2h_alt")); set_conv_libfunc (sext_optab, SFmode, HFmode, (arm_fp16_format == ARM_FP16_FORMAT_IEEE - ? "__gnu_h2f_ieee" - : "__gnu_h2f_alternative")); + ? "__aeabi_h2f" + : "__aeabi_h2f_alt")); /* Arithmetic. */ set_optab_libfunc (add_optab, HFmode, NULL); --- a/gcc/config/arm/fp16.c +++ b/gcc/config/arm/fp16.c @@ -22,10 +22,10 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see <http://www.gnu.org/licenses/>. */ -static inline unsigned short +static inline unsigned int __gnu_f2h_internal(unsigned int a, int ieee) { - unsigned short sign = (a >> 16) & 0x8000; + unsigned int sign = (a >> 16) & 0x8000; int aexp = (a >> 23) & 0xff; unsigned int mantissa = a & 0x007fffff; unsigned int mask; @@ -95,10 +95,10 @@ __gnu_f2h_internal(unsigned int a, int ieee) return sign | (((aexp + 14) << 10) + (mantissa >> 13)); } -unsigned int -__gnu_h2f_internal(unsigned short a, int ieee) +static inline unsigned int +__gnu_h2f_internal(unsigned int a, int ieee) { - unsigned int sign = (unsigned int)(a & 0x8000) << 16; + unsigned int sign = (a & 0x00008000) << 16; int aexp = (a >> 10) & 0x1f; unsigned int mantissa = a & 0x3ff; @@ -120,26 +120,33 @@ __gnu_h2f_internal(unsigned short a, int ieee) return sign | (((aexp + 0x70) << 23) + (mantissa << 13)); } -unsigned short +#define ALIAS(src, dst) \ + typeof (src) dst __attribute__ ((alias (#src))); + +unsigned int __gnu_f2h_ieee(unsigned int a) { return __gnu_f2h_internal(a, 1); } +ALIAS (__gnu_f2h_ieee, __aeabi_f2h) unsigned int -__gnu_h2f_ieee(unsigned short a) +__gnu_h2f_ieee(unsigned int a) { return __gnu_h2f_internal(a, 1); } +ALIAS (__gnu_h2f_ieee, __aeabi_h2f) -unsigned short +unsigned int __gnu_f2h_alternative(unsigned int x) { return __gnu_f2h_internal(x, 0); } +ALIAS (__gnu_f2h_alternative, __aeabi_f2h_alt) unsigned int -__gnu_h2f_alternative(unsigned short a) +__gnu_h2f_alternative(unsigned int a) { return __gnu_h2f_internal(a, 0); } +ALIAS (__gnu_h2f_alternative, __aeabi_h2f_alt) --- a/gcc/config/arm/sfp-machine.h +++ b/gcc/config/arm/sfp-machine.h @@ -99,7 +99,7 @@ typedef int __gcc_CMPtype __attribute__ ((mode (__libgcc_cmp_return__))); #define __fixdfdi __aeabi_d2lz #define __fixunsdfdi __aeabi_d2ulz #define __floatdidf __aeabi_l2d -#define __extendhfsf2 __gnu_h2f_ieee -#define __truncsfhf2 __gnu_f2h_ieee +#define __extendhfsf2 __aeabi_h2f +#define __truncsfhf2 __aeabi_f2h #endif /* __ARM_EABI__ */ --- a/gcc/testsuite/g++.dg/ext/arm-fp16/arm-fp16-ops-5.C +++ b/gcc/testsuite/g++.dg/ext/arm-fp16/arm-fp16-ops-5.C @@ -13,3 +13,5 @@ /* { dg-final { scan-assembler-not "\tbl\t__gnu_h\[a-z\]*_ieee" } } */ /* { dg-final { scan-assembler-not "\tbl\t__gnu_h2f_ieee" } } */ /* { dg-final { scan-assembler-not "\tbl\t__gnu_f2h_ieee" } } */ +/* { dg-final { scan-assembler-not "\tbl\t__aeabi_h2f" } } */ +/* { dg-final { scan-assembler-not "\tbl\t__aeabi_f2h" } } */ --- a/gcc/testsuite/g++.dg/ext/arm-fp16/arm-fp16-ops-6.C +++ b/gcc/testsuite/g++.dg/ext/arm-fp16/arm-fp16-ops-6.C @@ -13,3 +13,5 @@ /* { dg-final { scan-assembler-not "\tbl\t__gnu_h\[a-z\]*_ieee" } } */ /* { dg-final { scan-assembler-not "\tbl\t__gnu_h2f_ieee" } } */ /* { dg-final { scan-assembler-not "\tbl\t__gnu_f2h_ieee" } } */ +/* { dg-final { scan-assembler-not "\tbl\t__aeabi_h2f" } } */ +/* { dg-final { scan-assembler-not "\tbl\t__aeabi_f2h" } } */ --- a/gcc/testsuite/gcc.dg/torture/arm-fp16-ops-5.c +++ b/gcc/testsuite/gcc.dg/torture/arm-fp16-ops-5.c @@ -13,3 +13,5 @@ /* { dg-final { scan-assembler-not "\tbl\t__gnu_h\[a-z\]*_ieee" } } */ /* { dg-final { scan-assembler-not "\tbl\t__gnu_h2f_ieee" } } */ /* { dg-final { scan-assembler-not "\tbl\t__gnu_f2h_ieee" } } */ +/* { dg-final { scan-assembler-not "\tbl\t__aeabi_h2f" } } */ +/* { dg-final { scan-assembler-not "\tbl\t__aeabi_f2h" } } */ --- a/gcc/testsuite/gcc.dg/torture/arm-fp16-ops-6.c +++ b/gcc/testsuite/gcc.dg/torture/arm-fp16-ops-6.c @@ -13,3 +13,5 @@ /* { dg-final { scan-assembler-not "\tbl\t__gnu_h\[a-z\]*_ieee" } } */ /* { dg-final { scan-assembler-not "\tbl\t__gnu_h2f_ieee" } } */ /* { dg-final { scan-assembler-not "\tbl\t__gnu_f2h_ieee" } } */ +/* { dg-final { scan-assembler-not "\tbl\t__aeabi_h2f" } } */ +/* { dg-final { scan-assembler-not "\tbl\t__aeabi_f2h" } } */ ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH][ARM] RTABI half-precision conversion functions 2011-02-14 13:17 ` Andrew Stubbs @ 2011-02-14 18:22 ` Joseph S. Myers 2011-04-14 14:17 ` Andrew Stubbs 0 siblings, 1 reply; 7+ messages in thread From: Joseph S. Myers @ 2011-02-14 18:22 UTC (permalink / raw) To: Andrew Stubbs; +Cc: gcc-patches Is there a reason you didn't add these functions to the shared libgcc (adjust t-bpabi and t-symbian accordingly, add them to libgcc-bpabi.ver at version GCC_4.6.0)? The GCC-specific names were deliberately made static-only in the expectation that they would be obsoleted by standard AEABI names and temporary names shouldn't be a permanent part of the shared libgcc interface; now we have the permanent names, I'd have thought they should go in shared libgcc as well as static libgcc (while the GCC-specific names would continue to be exported from static libgcc only, with the symbol versioning ensuring they don't get exported from shared libgcc). -- Joseph S. Myers joseph@codesourcery.com ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH][ARM] RTABI half-precision conversion functions 2011-02-14 18:22 ` Joseph S. Myers @ 2011-04-14 14:17 ` Andrew Stubbs 2011-04-21 16:39 ` Joseph S. Myers 0 siblings, 1 reply; 7+ messages in thread From: Andrew Stubbs @ 2011-04-14 14:17 UTC (permalink / raw) To: Joseph S. Myers; +Cc: patches, gcc-patches [-- Attachment #1: Type: text/plain, Size: 812 bytes --] On 14/02/11 18:20, Joseph S. Myers wrote: > Is there a reason you didn't add these functions to the shared libgcc > (adjust t-bpabi and t-symbian accordingly, add them to libgcc-bpabi.ver at > version GCC_4.6.0)? The GCC-specific names were deliberately made > static-only in the expectation that they would be obsoleted by standard > AEABI names and temporary names shouldn't be a permanent part of the > shared libgcc interface; now we have the permanent names, I'd have thought > they should go in shared libgcc as well as static libgcc (while the > GCC-specific names would continue to be exported from static libgcc only, > with the symbol versioning ensuring they don't get exported from shared > libgcc). > No, there was no reason - I just didn't realise it needed doing. Is this patch better? Andrew [-- Attachment #2: eabi-half-precision.patch --] [-- Type: text/x-patch, Size: 7161 bytes --] 2011-04-14 Andrew Stubbs <ams@codesourcery.com> gcc/ * config/arm/arm.c (arm_init_libfuncs): Change __gnu_f2h_ieee to __aeabi_f2h, __gnu_f2h_alternative to __aeabi_f2h_alt, __gnu_h2f_ieee to __aeabi_h2f, and __gnu_h2f_alternative to __aeabi_h2f_alt. * config/arm/fp16.c (__gnu_f2h_internal): Change return type to unsigned int. Change 'sign' variable likewise. (__gnu_h2f_internal): Set to static inline. Change return type to unsigned int. Change 'sign' variable likewise. (ALIAS): New define. (__gnu_f2h_ieee): Change unsigned short to unsigned int. (__gnu_h2f_ieee): Likewise. (__gnu_f2h_alternative): Likewise. (__gnu_h2f_alternative): Likewise. (__aeabi_f2h, __aeabi_h2f): New aliases. (__aeabi_f2h_alt, __aeabi_h2f_alt): Likewise. * config/arm/sfp-machine.h (__extendhfsf2): Set to __aeabi_h2f. (__truncsfhf2): Set to __aeabi_f2h. * config/arm/t-bpabi (LIB2FUNCS_STATIC_EXTRA): Move fp16.c ... (LIB2FUNCS_EXTRA): ... to here. * config/arm/t-symbian (LIB2FUNCS_STATIC_EXTRA): Move fp16.c ... (LIB2FUNCS_EXTRA): ... to here. gcc/testsuite/ * g++.dg/ext/arm-fp16/arm-fp16-ops-5.C: Check for __aeabi_h2f and __aeabi_f2h. * g++.dg/ext/arm-fp16/arm-fp16-ops-6.C: Likewise. * gcc.dg/torture/arm-fp16-ops-5.c: Likewise. * gcc.dg/torture/arm-fp16-ops-6.c: Likewise. --- a/gcc/config/arm/arm.c +++ b/gcc/config/arm/arm.c @@ -1199,12 +1199,12 @@ arm_init_libfuncs (void) /* Conversions. */ set_conv_libfunc (trunc_optab, HFmode, SFmode, (arm_fp16_format == ARM_FP16_FORMAT_IEEE - ? "__gnu_f2h_ieee" - : "__gnu_f2h_alternative")); + ? "__aeabi_f2h" + : "__aeabi_f2h_alt")); set_conv_libfunc (sext_optab, SFmode, HFmode, (arm_fp16_format == ARM_FP16_FORMAT_IEEE - ? "__gnu_h2f_ieee" - : "__gnu_h2f_alternative")); + ? "__aeabi_h2f" + : "__aeabi_h2f_alt")); /* Arithmetic. */ set_optab_libfunc (add_optab, HFmode, NULL); --- a/gcc/config/arm/fp16.c +++ b/gcc/config/arm/fp16.c @@ -22,10 +22,10 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see <http://www.gnu.org/licenses/>. */ -static inline unsigned short +static inline unsigned int __gnu_f2h_internal(unsigned int a, int ieee) { - unsigned short sign = (a >> 16) & 0x8000; + unsigned int sign = (a >> 16) & 0x8000; int aexp = (a >> 23) & 0xff; unsigned int mantissa = a & 0x007fffff; unsigned int mask; @@ -95,10 +95,10 @@ __gnu_f2h_internal(unsigned int a, int ieee) return sign | (((aexp + 14) << 10) + (mantissa >> 13)); } -unsigned int -__gnu_h2f_internal(unsigned short a, int ieee) +static inline unsigned int +__gnu_h2f_internal(unsigned int a, int ieee) { - unsigned int sign = (unsigned int)(a & 0x8000) << 16; + unsigned int sign = (a & 0x00008000) << 16; int aexp = (a >> 10) & 0x1f; unsigned int mantissa = a & 0x3ff; @@ -120,26 +120,33 @@ __gnu_h2f_internal(unsigned short a, int ieee) return sign | (((aexp + 0x70) << 23) + (mantissa << 13)); } -unsigned short +#define ALIAS(src, dst) \ + typeof (src) dst __attribute__ ((alias (#src))); + +unsigned int __gnu_f2h_ieee(unsigned int a) { return __gnu_f2h_internal(a, 1); } +ALIAS (__gnu_f2h_ieee, __aeabi_f2h) unsigned int -__gnu_h2f_ieee(unsigned short a) +__gnu_h2f_ieee(unsigned int a) { return __gnu_h2f_internal(a, 1); } +ALIAS (__gnu_h2f_ieee, __aeabi_h2f) -unsigned short +unsigned int __gnu_f2h_alternative(unsigned int x) { return __gnu_f2h_internal(x, 0); } +ALIAS (__gnu_f2h_alternative, __aeabi_f2h_alt) unsigned int -__gnu_h2f_alternative(unsigned short a) +__gnu_h2f_alternative(unsigned int a) { return __gnu_h2f_internal(a, 0); } +ALIAS (__gnu_h2f_alternative, __aeabi_h2f_alt) --- a/gcc/config/arm/libgcc-bpabi.ver +++ b/gcc/config/arm/libgcc-bpabi.ver @@ -106,3 +106,10 @@ GCC_3.5 { GCC_4.3.0 { _Unwind_Backtrace } + +GCC_4.7.0 { + __aeabi_f2h + __aeabi_f2h_alt + __aeabi_h2f + __aeabi_h2f_alt +} --- a/gcc/config/arm/sfp-machine.h +++ b/gcc/config/arm/sfp-machine.h @@ -99,7 +99,7 @@ typedef int __gcc_CMPtype __attribute__ ((mode (__libgcc_cmp_return__))); #define __fixdfdi __aeabi_d2lz #define __fixunsdfdi __aeabi_d2ulz #define __floatdidf __aeabi_l2d -#define __extendhfsf2 __gnu_h2f_ieee -#define __truncsfhf2 __gnu_f2h_ieee +#define __extendhfsf2 __aeabi_h2f +#define __truncsfhf2 __aeabi_f2h #endif /* __ARM_EABI__ */ --- a/gcc/config/arm/t-bpabi +++ b/gcc/config/arm/t-bpabi @@ -21,9 +21,8 @@ LIB1ASMFUNCS += _aeabi_lcmp _aeabi_ulcmp _aeabi_ldivmod _aeabi_uldivmod # Add the BPABI C functions. LIB2FUNCS_EXTRA = $(srcdir)/config/arm/bpabi.c \ - $(srcdir)/config/arm/unaligned-funcs.c - -LIB2FUNCS_STATIC_EXTRA = $(srcdir)/config/arm/fp16.c + $(srcdir)/config/arm/unaligned-funcs.c \ + $(srcdir)/config/arm/fp16.c UNWIND_H = $(srcdir)/config/arm/unwind-arm.h LIB2ADDEH = $(srcdir)/config/arm/unwind-arm.c \ --- a/gcc/config/arm/t-symbian +++ b/gcc/config/arm/t-symbian @@ -36,7 +36,7 @@ LIB2ADDEH = $(srcdir)/unwind-c.c $(srcdir)/config/arm/pr-support.c LIB2ADDEHDEP = $(UNWIND_H) # Include half-float helpers. -LIB2FUNCS_STATIC_EXTRA = $(srcdir)/config/arm/fp16.c +LIB2FUNCS_EXTRA += $(srcdir)/config/arm/fp16.c # Create a multilib for processors with VFP floating-point, and a # multilib for those without -- using the soft-float ABI in both --- a/gcc/testsuite/g++.dg/ext/arm-fp16/arm-fp16-ops-5.C +++ b/gcc/testsuite/g++.dg/ext/arm-fp16/arm-fp16-ops-5.C @@ -13,3 +13,5 @@ /* { dg-final { scan-assembler-not "\tbl\t__gnu_h\[a-z\]*_ieee" } } */ /* { dg-final { scan-assembler-not "\tbl\t__gnu_h2f_ieee" } } */ /* { dg-final { scan-assembler-not "\tbl\t__gnu_f2h_ieee" } } */ +/* { dg-final { scan-assembler-not "\tbl\t__aeabi_h2f" } } */ +/* { dg-final { scan-assembler-not "\tbl\t__aeabi_f2h" } } */ --- a/gcc/testsuite/g++.dg/ext/arm-fp16/arm-fp16-ops-6.C +++ b/gcc/testsuite/g++.dg/ext/arm-fp16/arm-fp16-ops-6.C @@ -13,3 +13,5 @@ /* { dg-final { scan-assembler-not "\tbl\t__gnu_h\[a-z\]*_ieee" } } */ /* { dg-final { scan-assembler-not "\tbl\t__gnu_h2f_ieee" } } */ /* { dg-final { scan-assembler-not "\tbl\t__gnu_f2h_ieee" } } */ +/* { dg-final { scan-assembler-not "\tbl\t__aeabi_h2f" } } */ +/* { dg-final { scan-assembler-not "\tbl\t__aeabi_f2h" } } */ --- a/gcc/testsuite/gcc.dg/torture/arm-fp16-ops-5.c +++ b/gcc/testsuite/gcc.dg/torture/arm-fp16-ops-5.c @@ -13,3 +13,5 @@ /* { dg-final { scan-assembler-not "\tbl\t__gnu_h\[a-z\]*_ieee" } } */ /* { dg-final { scan-assembler-not "\tbl\t__gnu_h2f_ieee" } } */ /* { dg-final { scan-assembler-not "\tbl\t__gnu_f2h_ieee" } } */ +/* { dg-final { scan-assembler-not "\tbl\t__aeabi_h2f" } } */ +/* { dg-final { scan-assembler-not "\tbl\t__aeabi_f2h" } } */ --- a/gcc/testsuite/gcc.dg/torture/arm-fp16-ops-6.c +++ b/gcc/testsuite/gcc.dg/torture/arm-fp16-ops-6.c @@ -13,3 +13,5 @@ /* { dg-final { scan-assembler-not "\tbl\t__gnu_h\[a-z\]*_ieee" } } */ /* { dg-final { scan-assembler-not "\tbl\t__gnu_h2f_ieee" } } */ /* { dg-final { scan-assembler-not "\tbl\t__gnu_f2h_ieee" } } */ +/* { dg-final { scan-assembler-not "\tbl\t__aeabi_h2f" } } */ +/* { dg-final { scan-assembler-not "\tbl\t__aeabi_f2h" } } */ ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH][ARM] RTABI half-precision conversion functions 2011-04-14 14:17 ` Andrew Stubbs @ 2011-04-21 16:39 ` Joseph S. Myers 2011-04-27 16:39 ` Andrew Stubbs 0 siblings, 1 reply; 7+ messages in thread From: Joseph S. Myers @ 2011-04-21 16:39 UTC (permalink / raw) To: Andrew Stubbs; +Cc: patches, gcc-patches On Thu, 14 Apr 2011, Andrew Stubbs wrote: > On 14/02/11 18:20, Joseph S. Myers wrote: > > Is there a reason you didn't add these functions to the shared libgcc > > (adjust t-bpabi and t-symbian accordingly, add them to libgcc-bpabi.ver at > > version GCC_4.6.0)? The GCC-specific names were deliberately made > > static-only in the expectation that they would be obsoleted by standard > > AEABI names and temporary names shouldn't be a permanent part of the > > shared libgcc interface; now we have the permanent names, I'd have thought > > they should go in shared libgcc as well as static libgcc (while the > > GCC-specific names would continue to be exported from static libgcc only, > > with the symbol versioning ensuring they don't get exported from shared > > libgcc). > > > > No, there was no reason - I just didn't realise it needed doing. > > Is this patch better? You need to add %inherit GCC_4.7.0 GCC_4.6.0 GCC_4.7.0 { } to libgcc-std.ver so that the symbol versions are properly related to each other (empty versions there that only have contents for some targets are fine; GCC_4.1.0 is another other example of such a symbol version). Otherwise the symbol version handling seems right to me, although I can't approve the patch. -- Joseph S. Myers joseph@codesourcery.com ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH][ARM] RTABI half-precision conversion functions 2011-04-21 16:39 ` Joseph S. Myers @ 2011-04-27 16:39 ` Andrew Stubbs 2011-05-04 12:35 ` Ramana Radhakrishnan 0 siblings, 1 reply; 7+ messages in thread From: Andrew Stubbs @ 2011-04-27 16:39 UTC (permalink / raw) To: Joseph S. Myers; +Cc: patches, gcc-patches [-- Attachment #1: Type: text/plain, Size: 146 bytes --] On 21/04/11 16:58, Joseph S. Myers wrote: > You need to add > > %inherit GCC_4.7.0 GCC_4.6.0 > GCC_4.7.0 { > } Ok, done. Is this OK now? Andrew [-- Attachment #2: eabi-half-precision.patch --] [-- Type: text/x-patch, Size: 7387 bytes --] 2011-04-27 Andrew Stubbs <ams@codesourcery.com> gcc/ * config/arm/arm.c (arm_init_libfuncs): Change __gnu_f2h_ieee to __aeabi_f2h, __gnu_f2h_alternative to __aeabi_f2h_alt, __gnu_h2f_ieee to __aeabi_h2f, and __gnu_h2f_alternative to __aeabi_h2f_alt. * config/arm/fp16.c (__gnu_f2h_internal): Change return type to unsigned int. Change 'sign' variable likewise. (__gnu_h2f_internal): Set to static inline. Change return type to unsigned int. Change 'sign' variable likewise. (ALIAS): New define. (__gnu_f2h_ieee): Change unsigned short to unsigned int. (__gnu_h2f_ieee): Likewise. (__gnu_f2h_alternative): Likewise. (__gnu_h2f_alternative): Likewise. (__aeabi_f2h, __aeabi_h2f): New aliases. (__aeabi_f2h_alt, __aeabi_h2f_alt): Likewise. * config/arm/sfp-machine.h (__extendhfsf2): Set to __aeabi_h2f. (__truncsfhf2): Set to __aeabi_f2h. * config/arm/t-bpabi (LIB2FUNCS_STATIC_EXTRA): Move fp16.c ... (LIB2FUNCS_EXTRA): ... to here. * config/arm/t-symbian (LIB2FUNCS_STATIC_EXTRA): Move fp16.c ... (LIB2FUNCS_EXTRA): ... to here. * libgcc-std.ver (GCC_4.7.0): New version. gcc/testsuite/ * g++.dg/ext/arm-fp16/arm-fp16-ops-5.C: Check for __aeabi_h2f and __aeabi_f2h. * g++.dg/ext/arm-fp16/arm-fp16-ops-6.C: Likewise. * gcc.dg/torture/arm-fp16-ops-5.c: Likewise. * gcc.dg/torture/arm-fp16-ops-6.c: Likewise. --- a/gcc/config/arm/arm.c +++ b/gcc/config/arm/arm.c @@ -1181,12 +1181,12 @@ arm_init_libfuncs (void) /* Conversions. */ set_conv_libfunc (trunc_optab, HFmode, SFmode, (arm_fp16_format == ARM_FP16_FORMAT_IEEE - ? "__gnu_f2h_ieee" - : "__gnu_f2h_alternative")); + ? "__aeabi_f2h" + : "__aeabi_f2h_alt")); set_conv_libfunc (sext_optab, SFmode, HFmode, (arm_fp16_format == ARM_FP16_FORMAT_IEEE - ? "__gnu_h2f_ieee" - : "__gnu_h2f_alternative")); + ? "__aeabi_h2f" + : "__aeabi_h2f_alt")); /* Arithmetic. */ set_optab_libfunc (add_optab, HFmode, NULL); --- a/gcc/config/arm/fp16.c +++ b/gcc/config/arm/fp16.c @@ -22,10 +22,10 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see <http://www.gnu.org/licenses/>. */ -static inline unsigned short +static inline unsigned int __gnu_f2h_internal(unsigned int a, int ieee) { - unsigned short sign = (a >> 16) & 0x8000; + unsigned int sign = (a >> 16) & 0x8000; int aexp = (a >> 23) & 0xff; unsigned int mantissa = a & 0x007fffff; unsigned int mask; @@ -95,10 +95,10 @@ __gnu_f2h_internal(unsigned int a, int ieee) return sign | (((aexp + 14) << 10) + (mantissa >> 13)); } -unsigned int -__gnu_h2f_internal(unsigned short a, int ieee) +static inline unsigned int +__gnu_h2f_internal(unsigned int a, int ieee) { - unsigned int sign = (unsigned int)(a & 0x8000) << 16; + unsigned int sign = (a & 0x00008000) << 16; int aexp = (a >> 10) & 0x1f; unsigned int mantissa = a & 0x3ff; @@ -120,26 +120,33 @@ __gnu_h2f_internal(unsigned short a, int ieee) return sign | (((aexp + 0x70) << 23) + (mantissa << 13)); } -unsigned short +#define ALIAS(src, dst) \ + typeof (src) dst __attribute__ ((alias (#src))); + +unsigned int __gnu_f2h_ieee(unsigned int a) { return __gnu_f2h_internal(a, 1); } +ALIAS (__gnu_f2h_ieee, __aeabi_f2h) unsigned int -__gnu_h2f_ieee(unsigned short a) +__gnu_h2f_ieee(unsigned int a) { return __gnu_h2f_internal(a, 1); } +ALIAS (__gnu_h2f_ieee, __aeabi_h2f) -unsigned short +unsigned int __gnu_f2h_alternative(unsigned int x) { return __gnu_f2h_internal(x, 0); } +ALIAS (__gnu_f2h_alternative, __aeabi_f2h_alt) unsigned int -__gnu_h2f_alternative(unsigned short a) +__gnu_h2f_alternative(unsigned int a) { return __gnu_h2f_internal(a, 0); } +ALIAS (__gnu_h2f_alternative, __aeabi_h2f_alt) --- a/gcc/config/arm/libgcc-bpabi.ver +++ b/gcc/config/arm/libgcc-bpabi.ver @@ -106,3 +106,10 @@ GCC_3.5 { GCC_4.3.0 { _Unwind_Backtrace } + +GCC_4.7.0 { + __aeabi_f2h + __aeabi_f2h_alt + __aeabi_h2f + __aeabi_h2f_alt +} --- a/gcc/config/arm/sfp-machine.h +++ b/gcc/config/arm/sfp-machine.h @@ -99,7 +99,7 @@ typedef int __gcc_CMPtype __attribute__ ((mode (__libgcc_cmp_return__))); #define __fixdfdi __aeabi_d2lz #define __fixunsdfdi __aeabi_d2ulz #define __floatdidf __aeabi_l2d -#define __extendhfsf2 __gnu_h2f_ieee -#define __truncsfhf2 __gnu_f2h_ieee +#define __extendhfsf2 __aeabi_h2f +#define __truncsfhf2 __aeabi_f2h #endif /* __ARM_EABI__ */ --- a/gcc/config/arm/t-bpabi +++ b/gcc/config/arm/t-bpabi @@ -21,9 +21,8 @@ LIB1ASMFUNCS += _aeabi_lcmp _aeabi_ulcmp _aeabi_ldivmod _aeabi_uldivmod # Add the BPABI C functions. LIB2FUNCS_EXTRA = $(srcdir)/config/arm/bpabi.c \ - $(srcdir)/config/arm/unaligned-funcs.c - -LIB2FUNCS_STATIC_EXTRA = $(srcdir)/config/arm/fp16.c + $(srcdir)/config/arm/unaligned-funcs.c \ + $(srcdir)/config/arm/fp16.c UNWIND_H = $(srcdir)/config/arm/unwind-arm.h LIB2ADDEH = $(srcdir)/config/arm/unwind-arm.c \ --- a/gcc/config/arm/t-symbian +++ b/gcc/config/arm/t-symbian @@ -36,7 +36,7 @@ LIB2ADDEH = $(srcdir)/unwind-c.c $(srcdir)/config/arm/pr-support.c LIB2ADDEHDEP = $(UNWIND_H) # Include half-float helpers. -LIB2FUNCS_STATIC_EXTRA = $(srcdir)/config/arm/fp16.c +LIB2FUNCS_EXTRA += $(srcdir)/config/arm/fp16.c # Create a multilib for processors with VFP floating-point, and a # multilib for those without -- using the soft-float ABI in both --- a/gcc/libgcc-std.ver +++ b/gcc/libgcc-std.ver @@ -1919,3 +1919,7 @@ GCC_4.6.0 { __morestack_initial_sp __splitstack_find } + +%inherit GCC_4.7.0 GCC_4.6.0 +GCC_4.7.0 { +} --- a/gcc/testsuite/g++.dg/ext/arm-fp16/arm-fp16-ops-5.C +++ b/gcc/testsuite/g++.dg/ext/arm-fp16/arm-fp16-ops-5.C @@ -13,3 +13,5 @@ /* { dg-final { scan-assembler-not "\tbl\t__gnu_h\[a-z\]*_ieee" } } */ /* { dg-final { scan-assembler-not "\tbl\t__gnu_h2f_ieee" } } */ /* { dg-final { scan-assembler-not "\tbl\t__gnu_f2h_ieee" } } */ +/* { dg-final { scan-assembler-not "\tbl\t__aeabi_h2f" } } */ +/* { dg-final { scan-assembler-not "\tbl\t__aeabi_f2h" } } */ --- a/gcc/testsuite/g++.dg/ext/arm-fp16/arm-fp16-ops-6.C +++ b/gcc/testsuite/g++.dg/ext/arm-fp16/arm-fp16-ops-6.C @@ -13,3 +13,5 @@ /* { dg-final { scan-assembler-not "\tbl\t__gnu_h\[a-z\]*_ieee" } } */ /* { dg-final { scan-assembler-not "\tbl\t__gnu_h2f_ieee" } } */ /* { dg-final { scan-assembler-not "\tbl\t__gnu_f2h_ieee" } } */ +/* { dg-final { scan-assembler-not "\tbl\t__aeabi_h2f" } } */ +/* { dg-final { scan-assembler-not "\tbl\t__aeabi_f2h" } } */ --- a/gcc/testsuite/gcc.dg/torture/arm-fp16-ops-5.c +++ b/gcc/testsuite/gcc.dg/torture/arm-fp16-ops-5.c @@ -13,3 +13,5 @@ /* { dg-final { scan-assembler-not "\tbl\t__gnu_h\[a-z\]*_ieee" } } */ /* { dg-final { scan-assembler-not "\tbl\t__gnu_h2f_ieee" } } */ /* { dg-final { scan-assembler-not "\tbl\t__gnu_f2h_ieee" } } */ +/* { dg-final { scan-assembler-not "\tbl\t__aeabi_h2f" } } */ +/* { dg-final { scan-assembler-not "\tbl\t__aeabi_f2h" } } */ --- a/gcc/testsuite/gcc.dg/torture/arm-fp16-ops-6.c +++ b/gcc/testsuite/gcc.dg/torture/arm-fp16-ops-6.c @@ -13,3 +13,5 @@ /* { dg-final { scan-assembler-not "\tbl\t__gnu_h\[a-z\]*_ieee" } } */ /* { dg-final { scan-assembler-not "\tbl\t__gnu_h2f_ieee" } } */ /* { dg-final { scan-assembler-not "\tbl\t__gnu_f2h_ieee" } } */ +/* { dg-final { scan-assembler-not "\tbl\t__aeabi_h2f" } } */ +/* { dg-final { scan-assembler-not "\tbl\t__aeabi_f2h" } } */ ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH][ARM] RTABI half-precision conversion functions 2011-04-27 16:39 ` Andrew Stubbs @ 2011-05-04 12:35 ` Ramana Radhakrishnan 0 siblings, 0 replies; 7+ messages in thread From: Ramana Radhakrishnan @ 2011-05-04 12:35 UTC (permalink / raw) To: Andrew Stubbs; +Cc: Joseph S. Myers, patches, gcc-patches, Richard Earnshaw On 27 April 2011 17:26, Andrew Stubbs <ams@codesourcery.com> wrote: > On 21/04/11 16:58, Joseph S. Myers wrote: >> >> You need to add >> >> %inherit GCC_4.7.0 GCC_4.6.0 >> GCC_4.7.0 { >> } > > Ok, done. Is this OK now? I can't approve the target independent parts of this but as I said on IRC based on a brief look I'm not sure why the changes in fp16.c from unsigned short -> unsigned int are needed in this case ? There is theoretically no reason for this change as far as the Runtime PCS is concerned. Richard ? cheers Ramana > > Andrew > ^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2011-05-04 12:31 UTC | newest] Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2011-02-14 12:43 [PATCH][ARM] RTABI half-precision conversion functions Andrew Stubbs 2011-02-14 13:17 ` Andrew Stubbs 2011-02-14 18:22 ` Joseph S. Myers 2011-04-14 14:17 ` Andrew Stubbs 2011-04-21 16:39 ` Joseph S. Myers 2011-04-27 16:39 ` Andrew Stubbs 2011-05-04 12:35 ` Ramana Radhakrishnan
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).