re PR tree-optimization/70252 (ICE in vect_get_vec_def_for_stmt_copy with -O3 -march=skylake-avx512.)

gcc/

	PR tree-optimization/70252
	* tree-vect-stmts.c (supportable_widening_operation): Check resulting
	boolean vector has a proper number of elements.
	(supportable_narrowing_operation): Likewise.

gcc/testsuite/

	PR tree-optimization/70252
	* gcc.dg/pr70252.c: New test.

From-SVN: r234323
This commit is contained in:
Ilya Enkovich 2016-03-18 09:36:32 +00:00 committed by Ilya Enkovich
parent d0e7e40319
commit 5e8d6dff27
4 changed files with 46 additions and 4 deletions

View File

@ -1,3 +1,10 @@
2016-03-18 Ilya Enkovich <enkovich.gnu@gmail.com>
PR tree-optimization/70252
* tree-vect-stmts.c (supportable_widening_operation): Check resulting
boolean vector has a proper number of elements.
(supportable_narrowing_operation): Likewise.
2016-03-18 Tom de Vries <tom@codesourcery.com>
PR ipa/70269

View File

@ -1,3 +1,8 @@
2016-03-18 Ilya Enkovich <enkovich.gnu@gmail.com>
PR tree-optimization/70252
* gcc.dg/pr70252.c: New test.
2016-03-18 Tom de Vries <tom@codesourcery.com>
* gcc.dg/pr70161-2.c: New test.

View File

@ -0,0 +1,16 @@
/* { dg-do compile } */
/* { dg-options "-O3" } */
/* { dg-additional-options "-march=skylake-avx512" { target { i?86-*-* x86_64-*-* } } } */
extern unsigned char a [150];
extern unsigned char b [150];
extern unsigned char c [150];
extern unsigned char d [150];
extern unsigned char e [150];
void foo () {
for (int i = 92; i <= 141; i += 2) {
int tmp = (d [i] && b [i]) <= (a [i] > c [i]);
e [i] = tmp >> b [i];
}
}

View File

@ -8940,7 +8940,12 @@ supportable_widening_operation (enum tree_code code, gimple *stmt,
if (insn_data[icode1].operand[0].mode == TYPE_MODE (wide_vectype)
&& insn_data[icode2].operand[0].mode == TYPE_MODE (wide_vectype))
return true;
/* For scalar masks we may have different boolean
vector types having the same QImode. Thus we
add additional check for elements number. */
return (!VECTOR_BOOLEAN_TYPE_P (vectype)
|| (TYPE_VECTOR_SUBPARTS (vectype) / 2
== TYPE_VECTOR_SUBPARTS (wide_vectype)));
/* Check if it's a multi-step conversion that can be done using intermediate
types. */
@ -8991,7 +8996,9 @@ supportable_widening_operation (enum tree_code code, gimple *stmt,
if (insn_data[icode1].operand[0].mode == TYPE_MODE (wide_vectype)
&& insn_data[icode2].operand[0].mode == TYPE_MODE (wide_vectype))
return true;
return (!VECTOR_BOOLEAN_TYPE_P (vectype)
|| (TYPE_VECTOR_SUBPARTS (intermediate_type) / 2
== TYPE_VECTOR_SUBPARTS (wide_vectype)));
prev_type = intermediate_type;
prev_mode = intermediate_mode;
@ -9075,7 +9082,12 @@ supportable_narrowing_operation (enum tree_code code,
*code1 = c1;
if (insn_data[icode1].operand[0].mode == TYPE_MODE (narrow_vectype))
return true;
/* For scalar masks we may have different boolean
vector types having the same QImode. Thus we
add additional check for elements number. */
return (!VECTOR_BOOLEAN_TYPE_P (vectype)
|| (TYPE_VECTOR_SUBPARTS (vectype) * 2
== TYPE_VECTOR_SUBPARTS (narrow_vectype)));
/* Check if it's a multi-step conversion that can be done using intermediate
types. */
@ -9140,7 +9152,9 @@ supportable_narrowing_operation (enum tree_code code,
(*multi_step_cvt)++;
if (insn_data[icode1].operand[0].mode == TYPE_MODE (narrow_vectype))
return true;
return (!VECTOR_BOOLEAN_TYPE_P (vectype)
|| (TYPE_VECTOR_SUBPARTS (intermediate_type) * 2
== TYPE_VECTOR_SUBPARTS (narrow_vectype)));
prev_mode = intermediate_mode;
prev_type = intermediate_type;