From 8fec4d222f0a35925bfdc4641612120b06d51c59 Mon Sep 17 00:00:00 2001 From: Jakub Jelinek Date: Sat, 6 Jan 2018 08:47:32 +0100 Subject: [PATCH] re PR rtl-optimization/83682 (ICE in simplify_subreg, at simplify-rtx.c:6296) PR rtl-optimization/83682 * rtl.h (const_vec_duplicate_p): Only return true for VEC_DUPLICATE if it has non-VECTOR_MODE element mode. (vec_duplicate_p): Likewise. * gcc.target/i386/pr83682.c: New test. From-SVN: r256308 --- gcc/ChangeLog | 5 +++++ gcc/rtl.h | 7 +++++-- gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/gcc.target/i386/pr83682.c | 17 +++++++++++++++++ 4 files changed, 32 insertions(+), 2 deletions(-) create mode 100644 gcc/testsuite/gcc.target/i386/pr83682.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 51f92bcf0b0..283f792dcf7 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,5 +1,10 @@ 2018-01-06 Jakub Jelinek + PR rtl-optimization/83682 + * rtl.h (const_vec_duplicate_p): Only return true for VEC_DUPLICATE + if it has non-VECTOR_MODE element mode. + (vec_duplicate_p): Likewise. + PR middle-end/83694 * cfgexpand.c (expand_debug_expr): Punt if mode1 is VOIDmode and bitsize might be greater than MAX_BITSIZE_MODE_ANY_INT. diff --git a/gcc/rtl.h b/gcc/rtl.h index 224dc966332..71a81a211f1 100644 --- a/gcc/rtl.h +++ b/gcc/rtl.h @@ -2969,7 +2969,9 @@ const_vec_duplicate_p (T x, T *elt) *elt = CONST_VECTOR_ENCODED_ELT (x, 0); return true; } - if (GET_CODE (x) == CONST && GET_CODE (XEXP (x, 0)) == VEC_DUPLICATE) + if (GET_CODE (x) == CONST + && GET_CODE (XEXP (x, 0)) == VEC_DUPLICATE + && !VECTOR_MODE_P (GET_MODE (XEXP (XEXP (x, 0), 0)))) { *elt = XEXP (XEXP (x, 0), 0); return true; @@ -2984,7 +2986,8 @@ template inline bool vec_duplicate_p (T x, T *elt) { - if (GET_CODE (x) == VEC_DUPLICATE) + if (GET_CODE (x) == VEC_DUPLICATE + && !VECTOR_MODE_P (GET_MODE (XEXP (x, 0)))) { *elt = XEXP (x, 0); return true; diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 1d3603a34f9..7ebe12992e5 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2018-01-06 Jakub Jelinek + + PR rtl-optimization/83682 + * gcc.target/i386/pr83682.c: New test. + 2018-01-05 Janne Blomqvist PR fortran/78534 diff --git a/gcc/testsuite/gcc.target/i386/pr83682.c b/gcc/testsuite/gcc.target/i386/pr83682.c new file mode 100644 index 00000000000..cbb61ff3210 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/pr83682.c @@ -0,0 +1,17 @@ +/* PR rtl-optimization/83682 */ +/* { dg-do compile } */ +/* { dg-options "-O2 -msse2" } */ + +typedef float V __attribute__((__vector_size__(16))); +typedef double W __attribute__((__vector_size__(16))); +V b; +W c; + +void +foo (void *p) +{ + V e = __builtin_ia32_cvtsd2ss (b, c); + V g = e; + float f = g[0]; + __builtin_memcpy (p, &f, sizeof (f)); +} -- 2.30.2