From 1af21224e417d96b363e2b7dec0cbb0e3ed78f99 Mon Sep 17 00:00:00 2001 From: Matthew Wahab Date: Wed, 29 Jun 2016 12:37:00 +0000 Subject: [PATCH] [ARM] Fix, add tests for FP16 aapcs. testsuite/ * gcc.target/arm/aapcs/neon-vect10.c: Require -mfloat-ab=hard. Replace arm_neon_fp16_ok with arm_neon_fp16_hw. * gcc.target/arm/aapcs/neon-vect9.c: Likewise. * gcc.target/arm/aapcs/vfp18.c: Likewise. * gcc.target/arm/aapcs/vfp19.c: Likewise. * gcc.target/arm/aapcs/vfp20.c: Likewise. * gcc.target/arm/aapcs/vfp21.c: Likewise. * gcc.target/arm/fp16-aapcs-1.c: Require -mfloat-ab=hard. Also simplify the test. * gcc.target/arm/fp16-aapcs-2.c: New. From-SVN: r237849 --- gcc/testsuite/ChangeLog | 13 ++++++++++ .../gcc.target/arm/aapcs/neon-vect10.c | 3 ++- .../gcc.target/arm/aapcs/neon-vect9.c | 3 ++- gcc/testsuite/gcc.target/arm/aapcs/vfp18.c | 7 +++--- gcc/testsuite/gcc.target/arm/aapcs/vfp19.c | 9 +++---- gcc/testsuite/gcc.target/arm/aapcs/vfp20.c | 9 +++---- gcc/testsuite/gcc.target/arm/aapcs/vfp21.c | 9 +++---- gcc/testsuite/gcc.target/arm/fp16-aapcs-1.c | 24 +++++++++++-------- gcc/testsuite/gcc.target/arm/fp16-aapcs-2.c | 21 ++++++++++++++++ 9 files changed, 71 insertions(+), 27 deletions(-) create mode 100644 gcc/testsuite/gcc.target/arm/fp16-aapcs-2.c diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index c51c1bcda58..c8f96a98732 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,16 @@ +2016-06-29 Matthew Wahab + + * gcc.target/arm/aapcs/neon-vect10.c: Require + -mfloat-ab=hard. Replace arm_neon_fp16_ok with arm_neon_fp16_hw. + * gcc.target/arm/aapcs/neon-vect9.c: Likewise. + * gcc.target/arm/aapcs/vfp18.c: Likewise. + * gcc.target/arm/aapcs/vfp19.c: Likewise. + * gcc.target/arm/aapcs/vfp20.c: Likewise. + * gcc.target/arm/aapcs/vfp21.c: Likewise. + * gcc.target/arm/fp16-aapcs-1.c: Require + -mfloat-ab=hard. Also simplify the test. + * gcc.target/arm/fp16-aapcs-2.c: New. + 2016-06-29 Matthew Wahab * lib/target-supports.exp (add_options_for_arm_fp16): Reword diff --git a/gcc/testsuite/gcc.target/arm/aapcs/neon-vect10.c b/gcc/testsuite/gcc.target/arm/aapcs/neon-vect10.c index 680a3b560d7..788079bc104 100644 --- a/gcc/testsuite/gcc.target/arm/aapcs/neon-vect10.c +++ b/gcc/testsuite/gcc.target/arm/aapcs/neon-vect10.c @@ -1,7 +1,8 @@ /* 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_hard_vfp_ok } */ +/* { dg-require-effective-target arm_neon_fp16_hw } */ /* { dg-add-options arm_neon_fp16 } */ #ifndef IN_FRAMEWORK diff --git a/gcc/testsuite/gcc.target/arm/aapcs/neon-vect9.c b/gcc/testsuite/gcc.target/arm/aapcs/neon-vect9.c index fc2b13bf1b7..b42fdd23926 100644 --- a/gcc/testsuite/gcc.target/arm/aapcs/neon-vect9.c +++ b/gcc/testsuite/gcc.target/arm/aapcs/neon-vect9.c @@ -1,7 +1,8 @@ /* 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_hard_vfp_ok } */ +/* { dg-require-effective-target arm_neon_fp16_hw } */ /* { dg-add-options arm_neon_fp16 } */ #ifndef IN_FRAMEWORK diff --git a/gcc/testsuite/gcc.target/arm/aapcs/vfp18.c b/gcc/testsuite/gcc.target/arm/aapcs/vfp18.c index 225e9ce7c10..0745a82f5e8 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) */ +/* Test AAPCS layout (VFP variant) */ /* { dg-do run { target arm_eabi } } */ -/* { dg-require-effective-target arm_neon_fp16_ok } */ -/* { dg-options "-O -mfpu=vfp -mfloat-abi=hard -mfp16-format=ieee" } */ +/* { dg-require-effective-target arm_hard_vfp_ok } */ +/* { dg-require-effective-target arm_fp16_hw } */ +/* { dg-add-options arm_fp16_ieee } */ #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 8928b1562e9..950c1f6a6d4 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) */ +/* Test AAPCS layout (VFP variant) */ -/* { dg-do run { target arm_eabi } } */ -/* { dg-require-effective-target arm_neon_fp16_ok } */ -/* { dg-options "-O -mfpu=vfp -mfloat-abi=hard -mfp16-format=ieee" } */ +/* { dg-do run { target arm_eabi } } */ +/* { dg-require-effective-target arm_hard_vfp_ok } */ +/* { dg-require-effective-target arm_fp16_hw } */ +/* { dg-add-options arm_fp16_ieee } */ #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 61f07049f2c..f898d4cebd7 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) */ +/* Test AAPCS layout (VFP variant) */ -/* { dg-do run { target arm_eabi } } */ -/* { dg-require-effective-target arm_neon_fp16_ok } */ -/* { dg-options "-O -mfpu=vfp -mfloat-abi=hard -mfp16-format=ieee" } */ +/* { dg-do run { target arm_eabi } } */ +/* { dg-require-effective-target arm_hard_vfp_ok } */ +/* { dg-require-effective-target arm_fp16_hw } */ +/* { dg-add-options arm_fp16_ieee } */ #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 15dff7d19f8..48bb59856e0 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) */ +/* Test AAPCS layout (VFP variant) */ -/* { dg-do run { target arm_eabi } } */ -/* { dg-require-effective-target arm_neon_fp16_ok } */ -/* { dg-options "-O -mfpu=vfp -mfloat-abi=hard -mfp16-format=ieee" } */ +/* { dg-do run { target arm_eabi } } */ +/* { dg-require-effective-target arm_hard_vfp_ok } */ +/* { dg-require-effective-target arm_fp16_hw } */ +/* { dg-add-options arm_fp16_ieee } */ #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 5eab3e2ca78..9bf3fc07e7f 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_hard_vfp_ok } */ /* { dg-require-effective-target arm_fp16_ok } */ -/* { dg-options "-mfp16-format=ieee -O2" } */ -/* { dg-add-options arm_fp16 } */ +/* { dg-options "-O2" } */ +/* { dg-add-options arm_fp16_ieee } */ -/* 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 00000000000..4753e364a22 --- /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 "-mfloat-abi=softfp -O2" } */ +/* { dg-add-options arm_fp16_ieee } */ +/* { dg-skip-if "incompatible float-abi" { arm*-*-* } { "-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.30.2