From 108b83c1fd97b06f1e99ffb5127f2c5b9623bb11 Mon Sep 17 00:00:00 2001 From: Jakub Jelinek Date: Wed, 21 Mar 2018 11:13:29 +0100 Subject: [PATCH] re PR rtl-optimization/84989 (_mm512_broadcast_f32x4 triggers ICE in simplify_const_unary_operation, at simplify-rtx.c:1731) PR rtl-optimization/84989 * simplify-rtx.c (simplify_unary_operation_1): Don't try to simplify VEC_DUPLICATE with scalar result mode. * gcc.target/i386/pr84989.c: New test. From-SVN: r258709 --- gcc/ChangeLog | 6 ++++++ gcc/simplify-rtx.c | 4 +++- gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/gcc.target/i386/pr84989.c | 12 ++++++++++++ 4 files changed, 26 insertions(+), 1 deletion(-) create mode 100644 gcc/testsuite/gcc.target/i386/pr84989.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 41f4b3b3422..1fd6490bdc5 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2018-03-21 Jakub Jelinek + + PR rtl-optimization/84989 + * simplify-rtx.c (simplify_unary_operation_1): Don't try to simplify + VEC_DUPLICATE with scalar result mode. + 2018-03-21 Martin Liska PR ipa/84963 diff --git a/gcc/simplify-rtx.c b/gcc/simplify-rtx.c index 2e7aa5c1295..23244a12545 100644 --- a/gcc/simplify-rtx.c +++ b/gcc/simplify-rtx.c @@ -1692,7 +1692,9 @@ simplify_unary_operation_1 (enum rtx_code code, machine_mode mode, rtx op) break; } - if (VECTOR_MODE_P (mode) && vec_duplicate_p (op, &elt)) + if (VECTOR_MODE_P (mode) + && vec_duplicate_p (op, &elt) + && code != VEC_DUPLICATE) { /* Try applying the operator to ELT and see if that simplifies. We can duplicate the result if so. diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 7e844e5a82c..20e7dd9f2a0 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2018-03-21 Jakub Jelinek + + PR rtl-optimization/84989 + * gcc.target/i386/pr84989.c: New test. + 2018-03-21 Christophe Lyon * gcc.target/arm/pr82518.c: Require arm_neon_hw. diff --git a/gcc/testsuite/gcc.target/i386/pr84989.c b/gcc/testsuite/gcc.target/i386/pr84989.c new file mode 100644 index 00000000000..10655d3f92d --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/pr84989.c @@ -0,0 +1,12 @@ +/* PR rtl-optimization/84989 */ +/* { dg-do compile } */ +/* { dg-options "-O2 -mavx512f" } */ + +#include + +__m512 +foo (float a, float *b) +{ + return _mm512_sub_ps (_mm512_broadcast_f32x4 (_mm_load_ps (b)), + _mm512_broadcast_f32x4 (_mm_set1_ps (a))); +} -- 2.30.2