[GCC, Arm] Fix availability of FP16-FP64 conversion instructions
authorAndre Vieira <andre.simoesdiasvieira@arm.com>
Fri, 8 Mar 2019 17:29:02 +0000 (17:29 +0000)
committerAndre Vieira <avieira@gcc.gnu.org>
Fri, 8 Mar 2019 17:29:02 +0000 (17:29 +0000)
vcvtb.f16.f64 and vcvtb.f64.f16 were being made available even for FPUs that do
not support double precision.  This patch fixes that.

gcc/ChangeLog:
2019-03-08  Andre Vieira  <andre.simoesdiasvieira@arm.com>

* config/arm/arm.h (TARGET_FP16_TO_DOUBLE): Add TARGET_VFP_DOUBLE
requirement.

gcc/testsuite/ChangeLog:
2019-03-08  Andre Vieira  <andre.simoesdiasvieira@arm.com>

* gcc.target/arm/f16_f64_conv_no_dp.c: New test.

From-SVN: r269499

gcc/ChangeLog
gcc/config/arm/arm.h
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.target/arm/f16_f64_conv_no_dp.c [new file with mode: 0644]

index 9ecc07d0d28d7344805f31e4c6848d9a9cf891c6..ad486b4d862bc556ec356289a55dacbe0a33e167 100644 (file)
@@ -1,3 +1,8 @@
+2019-03-08  Andre Vieira  <andre.simoesdiasvieira@arm.com>
+
+       * config/arm/arm.h (TARGET_FP16_TO_DOUBLE): Add TARGET_VFP_DOUBLE
+       requirement.
+
 2019-03-08  Uroš Bizjak  <ubizjak@gmail.com>
 
        PR target/68924
index 103d390dd17273e947bbd4d605be2c1ef70fb137..7adafead0f20832467b873f53d298a2e1a25ab0a 100644 (file)
@@ -195,7 +195,7 @@ extern tree arm_fp16_type_node;
 /* FPU supports converting between HFmode and DFmode in a single hardware
    step.  */
 #define TARGET_FP16_TO_DOUBLE                                          \
-  (TARGET_HARD_FLOAT && (TARGET_FP16 && TARGET_VFP5))
+  (TARGET_HARD_FLOAT && TARGET_FP16 && TARGET_VFP5 && TARGET_VFP_DOUBLE)
 
 /* FPU supports fused-multiply-add operations.  */
 #define TARGET_FMA (bitmap_bit_p (arm_active_target.isa, isa_bit_vfpv4))
index a58b29dbfd23a7913daf1806424a51ac71abaa7f..13b91c7965ca0d84d61170488c87cbe62382eb04 100644 (file)
@@ -1,3 +1,7 @@
+2019-03-08  Andre Vieira  <andre.simoesdiasvieira@arm.com>
+
+       * gcc.target/arm/f16_f64_conv_no_dp.c: New test.
+
 2019-03-08  Uroš Bizjak  <ubizjak@gmail.com>
 
        PR target/68924
diff --git a/gcc/testsuite/gcc.target/arm/f16_f64_conv_no_dp.c b/gcc/testsuite/gcc.target/arm/f16_f64_conv_no_dp.c
new file mode 100644 (file)
index 0000000..99b62a8
--- /dev/null
@@ -0,0 +1,15 @@
+/* { dg-do compile } */
+/* { dg-skip-if "do not override fpu" { *-*-* } { "-mfpu=*" } { "-mfpu=fpv5-sp-d16" } } */
+/* { dg-skip-if "do not disable fpu" { *-*-* } { "-mfloat-abi=soft" } { * } } */
+/* { dg-skip-if "do not override fp16-format" { *-*-* } { "-mfp16-format=*" } { "-mfp16-format=ieee" } } */
+/* { dg-options "-O1 -mfpu=fpv5-sp-d16 -mfloat-abi=hard -mfp16-format=ieee" } */
+
+__fp16 foo (double a)
+{
+  return a;
+}
+
+double bar (__fp16 a)
+{
+  return a;
+}