From 04f725b90712254596630764cb2d5c69585d7337 Mon Sep 17 00:00:00 2001 From: Alan Lawrence Date: Tue, 3 Nov 2015 10:35:31 +0000 Subject: [PATCH] [AArch64] Fix ICE on (const_double:HF 0.0) 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 | 5 +++++ gcc/config/aarch64/aarch64.md | 2 +- gcc/testsuite/ChangeLog | 4 ++++ .../gcc.target/aarch64/fp16/set_zero_1.c | 21 +++++++++++++++++++ 4 files changed, 31 insertions(+), 1 deletion(-) create mode 100644 gcc/testsuite/gcc.target/aarch64/fp16/set_zero_1.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 3034d3733d7..204716ecb0a 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2015-11-03 Alan Lawrence + + * config/aarch64/aarch64.md (*movhf_aarch64): Use + aarch64_reg_or_fp_zero for second operand. + 2015-11-03 Alexandre Oliva * gimple-expr.c: Include hash-set.h and rtl.h. diff --git a/gcc/config/aarch64/aarch64.md b/gcc/config/aarch64/aarch64.md index 42c9b5e72e5..6cdddf49102 100644 --- a/gcc/config/aarch64/aarch64.md +++ b/gcc/config/aarch64/aarch64.md @@ -1124,7 +1124,7 @@ [(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] diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index fb84ea0dc8e..48185b38131 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,7 @@ +2015-11-03 Alan Lawrence + + * gcc.target/aarch64/fp16/set_zero_1.c: New. + 2015-11-03 Uros Bizjak * 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 index 00000000000..69fd1e8585b --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/fp16/set_zero_1.c @@ -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; +} -- 2.30.2