[AArch64] Fix ICE on (const_double:HF 0.0)
authorAlan Lawrence <alan.lawrence@arm.com>
Tue, 3 Nov 2015 10:35:31 +0000 (10:35 +0000)
committerAlan Lawrence <alalaw01@gcc.gnu.org>
Tue, 3 Nov 2015 10:35:31 +0000 (10:35 +0000)
gcc/:

* config/aarch64/aarch64.md (*movhf_aarch64): Use
aarch64_reg_or_fp_zero for second operand.

gcc/testsuite/:

* gcc.target/aarch64/fp16/set_zero_1.c: New.

From-SVN: r229701

gcc/ChangeLog
gcc/config/aarch64/aarch64.md
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.target/aarch64/fp16/set_zero_1.c [new file with mode: 0644]

index 3034d3733d7c0b68b410af11d60bc0feeb003259..204716ecb0a85d73d4e1c0c315fcdbc563746286 100644 (file)
@@ -1,3 +1,8 @@
+2015-11-03  Alan Lawrence  <alan.lawrence@arm.com>
+
+       * config/aarch64/aarch64.md (*movhf_aarch64): Use
+       aarch64_reg_or_fp_zero for second operand.
+
 2015-11-03  Alexandre Oliva <aoliva@redhat.com>
 
        * gimple-expr.c: Include hash-set.h and rtl.h.
index 42c9b5e72e59af24b678f582ddb1d430afd46165..6cdddf491029adbc1f8ddadc758641ec1cd0a510 100644 (file)
   [(set (match_operand:HF 0 "nonimmediate_operand" "=w, ?r,w,w,m,r,m ,r")
        (match_operand:HF 1 "general_operand"      "?rY, w,w,m,w,m,rY,r"))]
   "TARGET_FLOAT && (register_operand (operands[0], HFmode)
-    || register_operand (operands[1], HFmode))"
+    || aarch64_reg_or_fp_zero (operands[1], HFmode))"
   "@
    mov\\t%0.h[0], %w1
    umov\\t%w0, %1.h[0]
index fb84ea0dc8e30cc0bbffa590862aebc5d1b08d8a..48185b38131fc8ab28a98dcfd3a298de1ce87e63 100644 (file)
@@ -1,3 +1,7 @@
+2015-11-03  Alan Lawrence  <alan.lawrence@arm.com>
+
+       * gcc.target/aarch64/fp16/set_zero_1.c: New.
+
 2015-11-03  Uros Bizjak  <ubizjak@gmail.com>
 
        * gcc.dg/mvc1.c: Move to ...
diff --git a/gcc/testsuite/gcc.target/aarch64/fp16/set_zero_1.c b/gcc/testsuite/gcc.target/aarch64/fp16/set_zero_1.c
new file mode 100644 (file)
index 0000000..69fd1e8
--- /dev/null
@@ -0,0 +1,21 @@
+/* { dg-do run } */
+/* { dg-options "-O2" } */
+/* { dg-additional-options "-mfp16-format=ieee" { target "arm*-*-*" } } */
+
+extern void abort (void);
+
+__attribute__ ((noinline))
+void setfoo (__fp16 *f)
+{
+  *f = 0.0;
+}
+
+int
+main (int argc, char **argv)
+{
+  __fp16 a = 1.0;
+  setfoo (&a);
+  if (a != 0.0)
+    abort ();
+  return 0;
+}