From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 96256 invoked by alias); 9 Jun 2016 15:22:09 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Received: (qmail 96243 invoked by uid 89); 9 Jun 2016 15:22:09 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.3 required=5.0 tests=BAYES_00,KAM_LAZY_DOMAIN_SECURITY,RP_MATCHES_RCVD autolearn=ham version=3.3.2 spammy=ts1 X-HELO: foss.arm.com Received: from foss.arm.com (HELO foss.arm.com) (217.140.101.70) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 09 Jun 2016 15:21:58 +0000 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id DBA82F; Thu, 9 Jun 2016 08:22:32 -0700 (PDT) Received: from [10.2.206.222] (e108033-lin.cambridge.arm.com [10.2.206.222]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 4A7163F21A; Thu, 9 Jun 2016 08:21:56 -0700 (PDT) To: gcc-patches Cc: Christophe Lyon From: Matthew Wahab Subject: [ARM] Fix, add tests for FP16 aapcs. Message-ID: <57598992.8090106@foss.arm.com> Date: Thu, 09 Jun 2016 15:22:00 -0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.5.1 MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="------------030502020504050609000001" X-IsSubscribed: yes X-SW-Source: 2016-06/txt/msg00695.txt.bz2 This is a multi-part message in MIME format. --------------030502020504050609000001 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Content-length: 1417 Hello, A number of tests were added to check for FP16 arguments and return values being passed in registers. These require mfloat-abi=hard to be selected but in some test configurations they were run with -mfloat-abi=soft or -mfloat-abi=softfp. Explict skip-if directives are added to the tests to ensure that they only run on valid configurations. In addition, the code in the gcc.target/arm/fp16-aapcs-1.c test is reworked to focus on argument passing and return values and a softfp variant is added as fp16-aapcs-2.c. Tested for arm-none-linux-gnueabihf with native make check and for arm-none-eabi with cross-compiled check-gcc. Also checked the new tests with cross-compiled arm-eabi-qemu/-mcpu=cortex-m3/-mthumb. Ok for trunk? Matthew 2016-06-09 Matthew Wahab * testsuite/gcc.target/arm/aapcs/neon-vect10.c: Skip for mfloat-abi=soft and mfloat-abi=softfp. Replace arm_neon_fp16_ok with arm_neon_fp16_hw. * testsuite/gcc.target/arm/aapcs/neon-vect9.c: Likewise. * testsuite/gcc.target/arm/aapcs/vfp18.c: Likewise. * testsuite/gcc.target/arm/aapcs/vfp19.c: Likewise. * testsuite/gcc.target/arm/aapcs/vfp20.c: Likewise. * testsuite/gcc.target/arm/aapcs/vfp21.c: Likewise. * testsuite/gcc.target/arm/fp16-aapcs-1.c: Skip for mfloat-abi=soft and mfloat-abi=softfp. Also, simplify the test and set option -mfloat-abi=hard. * testsuite/gcc.target/arm/fp16-aapcs-2.c: New. --------------030502020504050609000001 Content-Type: text/x-patch; name="0001-ARM-Fix-add-tests-for-FP16-aapcs.patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="0001-ARM-Fix-add-tests-for-FP16-aapcs.patch" Content-length: 8006 >From b02f0283367d4a4c1b012e8ca8e7b5c91f3ac561 Mon Sep 17 00:00:00 2001 From: Matthew Wahab Date: Tue, 24 May 2016 09:21:11 +0100 Subject: [PATCH] [ARM] Fix, add tests for FP16 aapcs. A number of tests were added to check for FP16 arguments and return values being passed in register. These require mfloat-abi=hard to be selected but, in some test configurations, they were run with -mfloat-abi=soft or -mfloat-abi=softfp. Explict skip-if directives are added to the tests to ensure that they only run on valid configurations. In addition, the code in the gcc.target/arm/fp16-aapcs-1.c test is reworked to focus on argument passing and return values and a softfp variant is added as fp16-aapcs-2.c. 2016-06-09 Matthew Wahab * testsuite/gcc.target/arm/aapcs/neon-vect10.c: Skip for mfloat-abi=soft and mfloat-abi=softfp. Replace arm_neon_fp16_ok with arm_neon_fp16_hw. * testsuite/gcc.target/arm/aapcs/neon-vect9.c: Likewise. * testsuite/gcc.target/arm/aapcs/vfp18.c: Likewise. * testsuite/gcc.target/arm/aapcs/vfp19.c: Likewise. * testsuite/gcc.target/arm/aapcs/vfp20.c: Likewise. * testsuite/gcc.target/arm/aapcs/vfp21.c: Likewise. * testsuite/gcc.target/arm/fp16-aapcs-1.c: Skip for mfloat-abi=soft and mfloat-abi=softfp. Also, simplify the test and set option -mfloat-abi=hard. * testsuite/gcc.target/arm/fp16-aapcs-2.c: New. --- gcc/testsuite/gcc.target/arm/aapcs/neon-vect10.c | 3 ++- gcc/testsuite/gcc.target/arm/aapcs/neon-vect9.c | 3 ++- gcc/testsuite/gcc.target/arm/aapcs/vfp18.c | 3 ++- gcc/testsuite/gcc.target/arm/aapcs/vfp19.c | 3 ++- gcc/testsuite/gcc.target/arm/aapcs/vfp20.c | 3 ++- gcc/testsuite/gcc.target/arm/aapcs/vfp21.c | 3 ++- gcc/testsuite/gcc.target/arm/fp16-aapcs-1.c | 22 +++++++++++++--------- gcc/testsuite/gcc.target/arm/fp16-aapcs-2.c | 21 +++++++++++++++++++++ 8 files changed, 46 insertions(+), 15 deletions(-) create mode 100644 gcc/testsuite/gcc.target/arm/fp16-aapcs-2.c diff --git a/gcc/testsuite/gcc.target/arm/aapcs/neon-vect10.c b/gcc/testsuite/gcc.target/arm/aapcs/neon-vect10.c index 680a3b5..6764a19 100644 --- a/gcc/testsuite/gcc.target/arm/aapcs/neon-vect10.c +++ b/gcc/testsuite/gcc.target/arm/aapcs/neon-vect10.c @@ -1,8 +1,9 @@ /* Test AAPCS layout (VFP variant for Neon types) */ /* { dg-do run { target arm_eabi } } */ -/* { dg-require-effective-target arm_neon_fp16_ok } */ +/* { dg-require-effective-target arm_neon_fp16_hw } */ /* { dg-add-options arm_neon_fp16 } */ +/* { dg-skip-if "" { *-*-* } { "-mfloat-abi=soft" "-mfloat-abi=softfp" } } */ #ifndef IN_FRAMEWORK #define VFP diff --git a/gcc/testsuite/gcc.target/arm/aapcs/neon-vect9.c b/gcc/testsuite/gcc.target/arm/aapcs/neon-vect9.c index fc2b13b..b2526a1 100644 --- a/gcc/testsuite/gcc.target/arm/aapcs/neon-vect9.c +++ b/gcc/testsuite/gcc.target/arm/aapcs/neon-vect9.c @@ -1,8 +1,9 @@ /* Test AAPCS layout (VFP variant for Neon types) */ /* { dg-do run { target arm_eabi } } */ -/* { dg-require-effective-target arm_neon_fp16_ok } */ +/* { dg-require-effective-target arm_neon_fp16_hw } */ /* { dg-add-options arm_neon_fp16 } */ +/* { dg-skip-if "" { *-*-* } { "-mfloat-abi=soft" "-mfloat-abi=softfp" } } */ #ifndef IN_FRAMEWORK #define VFP diff --git a/gcc/testsuite/gcc.target/arm/aapcs/vfp18.c b/gcc/testsuite/gcc.target/arm/aapcs/vfp18.c index 225e9ce..629b884 100644 --- a/gcc/testsuite/gcc.target/arm/aapcs/vfp18.c +++ b/gcc/testsuite/gcc.target/arm/aapcs/vfp18.c @@ -1,8 +1,9 @@ /* Test AAPCS layout (VFP variant) */ /* { dg-do run { target arm_eabi } } */ -/* { dg-require-effective-target arm_neon_fp16_ok } */ +/* { dg-require-effective-target arm_neon_fp16_hw } */ /* { dg-options "-O -mfpu=vfp -mfloat-abi=hard -mfp16-format=ieee" } */ +/* { dg-skip-if "" { *-*-* } { "-mfloat-abi=soft" "-mfloat-abi=softfp" } } */ #ifndef IN_FRAMEWORK #define VFP diff --git a/gcc/testsuite/gcc.target/arm/aapcs/vfp19.c b/gcc/testsuite/gcc.target/arm/aapcs/vfp19.c index 8928b15..39effbc 100644 --- a/gcc/testsuite/gcc.target/arm/aapcs/vfp19.c +++ b/gcc/testsuite/gcc.target/arm/aapcs/vfp19.c @@ -1,8 +1,9 @@ /* Test AAPCS layout (VFP variant) */ /* { dg-do run { target arm_eabi } } */ -/* { dg-require-effective-target arm_neon_fp16_ok } */ +/* { dg-require-effective-target arm_neon_fp16_hw } */ /* { dg-options "-O -mfpu=vfp -mfloat-abi=hard -mfp16-format=ieee" } */ +/* { dg-skip-if "" { *-*-* } { "-mfloat-abi=soft" "-mfloat-abi=softfp" } } */ #ifndef IN_FRAMEWORK #define VFP diff --git a/gcc/testsuite/gcc.target/arm/aapcs/vfp20.c b/gcc/testsuite/gcc.target/arm/aapcs/vfp20.c index 61f0704..38e3d46 100644 --- a/gcc/testsuite/gcc.target/arm/aapcs/vfp20.c +++ b/gcc/testsuite/gcc.target/arm/aapcs/vfp20.c @@ -1,8 +1,9 @@ /* Test AAPCS layout (VFP variant) */ /* { dg-do run { target arm_eabi } } */ -/* { dg-require-effective-target arm_neon_fp16_ok } */ +/* { dg-require-effective-target arm_neon_fp16_hw } */ /* { dg-options "-O -mfpu=vfp -mfloat-abi=hard -mfp16-format=ieee" } */ +/* { dg-skip-if "" { *-*-* } { "-mfloat-abi=soft" "-mfloat-abi=softfp" } } */ #ifndef IN_FRAMEWORK #define VFP diff --git a/gcc/testsuite/gcc.target/arm/aapcs/vfp21.c b/gcc/testsuite/gcc.target/arm/aapcs/vfp21.c index 15dff7d..d875bdc 100644 --- a/gcc/testsuite/gcc.target/arm/aapcs/vfp21.c +++ b/gcc/testsuite/gcc.target/arm/aapcs/vfp21.c @@ -1,8 +1,9 @@ /* Test AAPCS layout (VFP variant) */ /* { dg-do run { target arm_eabi } } */ -/* { dg-require-effective-target arm_neon_fp16_ok } */ +/* { dg-require-effective-target arm_neon_fp16_hw } */ /* { dg-options "-O -mfpu=vfp -mfloat-abi=hard -mfp16-format=ieee" } */ +/* { dg-skip-if "" { *-*-* } { "-mfloat-abi=soft" "-mfloat-abi=softfp" } } */ #ifndef IN_FRAMEWORK #define VFP diff --git a/gcc/testsuite/gcc.target/arm/fp16-aapcs-1.c b/gcc/testsuite/gcc.target/arm/fp16-aapcs-1.c index 5eab3e2..049f9e3 100644 --- a/gcc/testsuite/gcc.target/arm/fp16-aapcs-1.c +++ b/gcc/testsuite/gcc.target/arm/fp16-aapcs-1.c @@ -1,17 +1,21 @@ /* { dg-do compile } */ /* { dg-require-effective-target arm_fp16_ok } */ -/* { dg-options "-mfp16-format=ieee -O2" } */ +/* { dg-options "-mfp16-format=ieee -mfloat-abi=hard -O2" } */ /* { dg-add-options arm_fp16 } */ +/* { dg-skip-if "" { *-*-* } { "-mfloat-abi=soft" "-mfloat-abi=softfp" } } */ -/* Test __fp16 arguments and return value in registers. */ +/* Test __fp16 arguments and return value in registers (hard-float). */ -__fp16 F (__fp16 a, __fp16 b, __fp16 c) +void +swap (__fp16, __fp16); + +__fp16 +F (__fp16 a, __fp16 b, __fp16 c) { - if (a == b) - return c; - return a; + swap (b, a); + return c; } -/* { dg-final { scan-assembler-times {vcvtb\.f32\.f16\ts[0-9]+, s0} 1 } } */ -/* { dg-final { scan-assembler-times {vcvtb\.f32\.f16\ts[0-9]+, s1} 1 } } */ -/* { dg-final { scan-assembler-times {vmov\ts0, r[0-9]+} 1 } } */ +/* { dg-final { scan-assembler-times {vmov\tr[0-9]+, s[0-2]} 2 } } */ +/* { dg-final { scan-assembler-times {vmov.f32\ts1, s0} 1 } } */ +/* { dg-final { scan-assembler-times {vmov\ts0, r[0-9]+} 2 } } */ diff --git a/gcc/testsuite/gcc.target/arm/fp16-aapcs-2.c b/gcc/testsuite/gcc.target/arm/fp16-aapcs-2.c new file mode 100644 index 0000000..546e650 --- /dev/null +++ b/gcc/testsuite/gcc.target/arm/fp16-aapcs-2.c @@ -0,0 +1,21 @@ +/* { dg-do compile } */ +/* { dg-require-effective-target arm_fp16_ok } */ +/* { dg-options "-mfp16-format=ieee -mfloat-abi=softfp -O2" } */ +/* { dg-add-options arm_fp16 } */ +/* { dg-skip-if "" { *-*-* } { "-mfloat-abi=soft" "-mfloat-abi=hard" } } */ + +/* Test __fp16 arguments and return value in registers (softfp). */ + +void +swap (__fp16, __fp16); + +__fp16 +F (__fp16 a, __fp16 b, __fp16 c) +{ + swap (b, a); + return c; +} + +/* { dg-final { scan-assembler-times {mov\tr[0-9]+, r[0-2]} 3 } } */ +/* { dg-final { scan-assembler-times {mov\tr1, r0} 1 } } */ +/* { dg-final { scan-assembler-times {mov\tr0, r[0-9]+} 2 } } */ -- 2.1.4 --------------030502020504050609000001--