From patchwork Mon Feb 14 12:43:47 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Stubbs X-Patchwork-Id: 83073 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) by ozlabs.org (Postfix) with SMTP id 3B37EB7112 for ; Mon, 14 Feb 2011 23:44:00 +1100 (EST) Received: (qmail 17617 invoked by alias); 14 Feb 2011 12:43:58 -0000 Received: (qmail 17609 invoked by uid 22791); 14 Feb 2011 12:43:57 -0000 X-SWARE-Spam-Status: No, hits=-2.4 required=5.0 tests=AWL, BAYES_00, RCVD_IN_DNSWL_LOW, TW_DH, TW_FH, TW_SF, TW_XD X-Spam-Check-By: sourceware.org Received: from mail-wy0-f175.google.com (HELO mail-wy0-f175.google.com) (74.125.82.175) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Mon, 14 Feb 2011 12:43:53 +0000 Received: by wyb40 with SMTP id 40so4868840wyb.20 for ; Mon, 14 Feb 2011 04:43:50 -0800 (PST) Received: by 10.227.128.208 with SMTP id l16mr2508807wbs.53.1297687430719; Mon, 14 Feb 2011 04:43:50 -0800 (PST) Received: from [192.168.0.104] (cpc2-hawk4-0-0-cust828.aztw.cable.virginmedia.com [82.32.123.61]) by mx.google.com with ESMTPS id x1sm1885048wbh.2.2011.02.14.04.43.49 (version=SSLv3 cipher=OTHER); Mon, 14 Feb 2011 04:43:49 -0800 (PST) Message-ID: <4D592383.504@linaro.org> Date: Mon, 14 Feb 2011 12:43:47 +0000 From: Andrew Stubbs User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.13) Gecko/20101208 Lightning/1.0b2 Thunderbird/3.1.7 MIME-Version: 1.0 To: gcc-patches@gcc.gnu.org Subject: Re: [PATCH][ARM] RTABI half-precision conversion functions References: <4D5922F9.2040306@linaro.org> In-Reply-To: <4D5922F9.2040306@linaro.org> Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org 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 2011-02-03 Andrew Stubbs 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 . */ -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" } } */