Skip to content

Commit 9fb4ef4

Browse files
author
hubicka
committed
PR target/82713 * i386.c (ix86_builtin_vectorization_cost): Be ready for insane types. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@254933 138bc75d-0d04-0410-961f-82ee72b054a4
1 parent 69cd03b commit 9fb4ef4

File tree

4 files changed

+42
-1
lines changed

4 files changed

+42
-1
lines changed

gcc/ChangeLog

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
2017-11-19 Jan Hubicka <[email protected]>
2+
3+
PR target/82713
4+
* i386.c (ix86_builtin_vectorization_cost): Be ready for insane
5+
types.
6+
17
2017-11-19 Tom de Vries <[email protected]>
28

39
* config/arc/arc.h (FUNCTION_PROFILER): Remove semicolon after

gcc/config/i386/i386.c

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44628,13 +44628,18 @@ ix86_builtin_vectorization_cost (enum vect_cost_for_stmt type_of_cost,
4462844628

4462944629
case vector_load:
4463044630
index = sse_store_index (mode);
44631-
gcc_assert (index >= 0);
44631+
/* See PR82713 - we may end up being called on non-vector type. */
44632+
if (index < 0)
44633+
index = 2;
4463244634
return ix86_vec_cost (mode,
4463344635
COSTS_N_INSNS (ix86_cost->sse_load[index]) / 2,
4463444636
true);
4463544637

4463644638
case vector_store:
4463744639
index = sse_store_index (mode);
44640+
/* See PR82713 - we may end up being called on non-vector type. */
44641+
if (index < 0)
44642+
index = 2;
4463844643
return ix86_vec_cost (mode,
4463944644
COSTS_N_INSNS (ix86_cost->sse_store[index]) / 2,
4464044645
true);
@@ -44647,13 +44652,19 @@ ix86_builtin_vectorization_cost (enum vect_cost_for_stmt type_of_cost,
4464744652
Do that incrementally. */
4464844653
case unaligned_load:
4464944654
index = sse_store_index (mode);
44655+
/* See PR82713 - we may end up being called on non-vector type. */
44656+
if (index < 0)
44657+
index = 2;
4465044658
return ix86_vec_cost (mode,
4465144659
COSTS_N_INSNS
4465244660
(ix86_cost->sse_unaligned_load[index]) / 2,
4465344661
true);
4465444662

4465544663
case unaligned_store:
4465644664
index = sse_store_index (mode);
44665+
/* See PR82713 - we may end up being called on non-vector type. */
44666+
if (index < 0)
44667+
index = 2;
4465744668
return ix86_vec_cost (mode,
4465844669
COSTS_N_INSNS
4465944670
(ix86_cost->sse_unaligned_store[index]) / 2,

gcc/testsuite/ChangeLog

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
2017-11-19 Jan Hubicka <[email protected]>
2+
3+
PR target/82713
4+
* gcc.target/i386/pr82713.c: New testcase.
5+
16
2017-11-19 Jakub Jelinek <[email protected]>
27

38
PR c/66618
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
/* { dg-do compile } */
2+
* { dg-options "-O3 -mavx512bw" } */
3+
4+
_Bool a[2048];
5+
int b[2048];
6+
7+
void
8+
foo ()
9+
{
10+
int i;
11+
for (i = 0; i < 2048; i += 4)
12+
{
13+
a[i] = b[i] <= 10;
14+
a[i + 3] = b[i + 1] <= 10;
15+
a[i + 2] = b[i + 2] <= 10;
16+
a[i + 1] = b[i + 3] <= 10;
17+
}
18+
}
19+

0 commit comments

Comments
 (0)