diff options
author | mwahab <mwahab@138bc75d-0d04-0410-961f-82ee72b054a4> | 2016-09-23 09:09:28 +0000 |
---|---|---|
committer | mwahab <mwahab@138bc75d-0d04-0410-961f-82ee72b054a4> | 2016-09-23 09:09:28 +0000 |
commit | e183c2b8d0aad7f6cc787d6d9703c78ce4b956c8 (patch) | |
tree | 38097b66a0f324274c966b4a29fc70b3dcedcc2d | |
parent | cd6fbed6cb35306800671e424e630758479e5a73 (diff) | |
download | gcc-e183c2b8d0aad7f6cc787d6d9703c78ce4b956c8.tar.gz |
[PATCH 4/17][ARM] Define feature macros for FP16.
2016-09-23 Matthew Wahab <matthew.wahab@arm.com>
* config/arm/arm-c.c (arm_cpu_builtins): Define
"__ARM_FEATURE_FP16_SCALAR_ARITHMETIC" and
"__ARM_FEATURE_FP16_VECTOR_ARITHMETIC".
testsuite/
2016-09-23 Matthew Wahab <matthew.wahab@arm.com>
* gcc.target/arm/attr-fp16-arith-1.c: New.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@240402 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r-- | gcc/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/config/arm/arm-c.c | 5 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 4 | ||||
-rw-r--r-- | gcc/testsuite/gcc.target/arm/attr-fp16-arith-1.c | 45 |
4 files changed, 60 insertions, 0 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 3e440959e48..12adfb96c9a 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,5 +1,11 @@ 2016-09-23 Matthew Wahab <matthew.wahab@arm.com> + * config/arm/arm-c.c (arm_cpu_builtins): Define + "__ARM_FEATURE_FP16_SCALAR_ARITHMETIC" and + "__ARM_FEATURE_FP16_VECTOR_ARITHMETIC". + +2016-09-23 Matthew Wahab <matthew.wahab@arm.com> + * doc/sourcebuild.texi (ARM-specific attributes): Add anchor for arm_v8_1a_neon_ok. Add entries for arm_v8_2a_fp16_scalar_ok, arm_v8_2a_fp16_scalar_hw, arm_v8_2a_fp16_neon_ok and diff --git a/gcc/config/arm/arm-c.c b/gcc/config/arm/arm-c.c index b98470fff45..72837001d10 100644 --- a/gcc/config/arm/arm-c.c +++ b/gcc/config/arm/arm-c.c @@ -142,6 +142,11 @@ arm_cpu_builtins (struct cpp_reader* pfile) def_or_undef_macro (pfile, "__ARM_FP16_ARGS", arm_fp16_format != ARM_FP16_FORMAT_NONE); + def_or_undef_macro (pfile, "__ARM_FEATURE_FP16_SCALAR_ARITHMETIC", + TARGET_VFP_FP16INST); + def_or_undef_macro (pfile, "__ARM_FEATURE_FP16_VECTOR_ARITHMETIC", + TARGET_NEON_FP16INST); + def_or_undef_macro (pfile, "__ARM_FEATURE_FMA", TARGET_FMA); def_or_undef_macro (pfile, "__ARM_NEON__", TARGET_NEON); def_or_undef_macro (pfile, "__ARM_NEON", TARGET_NEON); diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index c60fdf2b1dd..f2fb03ca693 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,5 +1,9 @@ 2016-09-23 Matthew Wahab <matthew.wahab@arm.com> + * gcc.target/arm/attr-fp16-arith-1.c: New. + +2016-09-23 Matthew Wahab <matthew.wahab@arm.com> + * lib/target-supports.exp (add_options_for_arm_v8_2a_fp16_scalar): New. (add_options_for_arm_v8_2a_fp16_neon): New. diff --git a/gcc/testsuite/gcc.target/arm/attr-fp16-arith-1.c b/gcc/testsuite/gcc.target/arm/attr-fp16-arith-1.c new file mode 100644 index 00000000000..5011315961c --- /dev/null +++ b/gcc/testsuite/gcc.target/arm/attr-fp16-arith-1.c @@ -0,0 +1,45 @@ +/* { dg-do compile } */ +/* { dg-require-effective-target arm_v8_2a_fp16_neon_ok } */ +/* { dg-options "-O2" } */ +/* { dg-add-options arm_v8_2a_fp16_scalar } */ + +/* Reset fpu to a value compatible with the next pragmas. */ +#pragma GCC target ("fpu=vfp") + +#pragma GCC push_options +#pragma GCC target ("fpu=fp-armv8") + +#ifndef __ARM_FEATURE_FP16_SCALAR_ARITHMETIC +#error __ARM_FEATURE_FP16_SCALAR_ARITHMETIC not defined. +#endif + +#pragma GCC push_options +#pragma GCC target ("fpu=neon-fp-armv8") + +#ifndef __ARM_FEATURE_FP16_VECTOR_ARITHMETIC +#error __ARM_FEATURE_FP16_VECTOR_ARITHMETIC not defined. +#endif + +#ifndef __ARM_NEON +#error __ARM_NEON not defined. +#endif + +#if !defined (__ARM_FP) || !(__ARM_FP & 0x2) +#error Invalid value for __ARM_FP +#endif + +#pragma GCC pop_options + +/* Check that the FP version is correctly reset to mfpu=fp-armv8. */ + +#if !defined (__ARM_FP) || !(__ARM_FP & 0x2) +#error __ARM_FP should record FP16 support. +#endif + +#pragma GCC pop_options + +/* Check that the FP version is correctly reset to mfpu=vfp. */ + +#if !defined (__ARM_FP) || (__ARM_FP & 0x2) +#error Unexpected value for __ARM_FP. +#endif |