public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/43430] New: Missed vectorization: "stmt not supported: cond_expr"
@ 2010-03-18 20:27 spop at gcc dot gnu dot org
2010-03-26 20:08 ` [Bug tree-optimization/43430] " spop at gcc dot gnu dot org
` (8 more replies)
0 siblings, 9 replies; 10+ messages in thread
From: spop at gcc dot gnu dot org @ 2010-03-18 20:27 UTC (permalink / raw)
To: gcc-bugs
This code from FFmpeg is not vectorized:
gcc-4.5 -c vsad_intra.c -O3 -ffast-math -ftree-vectorizer-verbose=7 -msse2
[...]
vsad_intra.c:15: note: not vectorized: relevant stmt not supported: iftmp.0_7 =
[cond_expr] iftmp.0_35 < 0 ? iftmp.0_77 : iftmp.0_35;
typedef short DCTELEM;
typedef unsigned char uint8_t;
typedef long int x86_reg;
typedef unsigned int uint32_t;
typedef unsigned long int uint64_t;
int
vsad16_c (void *c, uint8_t * s1, uint8_t * s2, int stride, int h)
{
int score = 0;
int x, y;
for (y = 1; y < h; y++)
{
for (x = 0; x < 16; x++)
{
score +=
((s1[x] - s2[x] - s1[x + stride] + s2[x + stride]) >=
0 ? (s1[x] - s2[x] - s1[x + stride] +
s2[x + stride]) : (-(s1[x] - s2[x] - s1[x + stride] +
s2[x + stride])));
}
s1 += stride;
s2 += stride;
}
return score;
}
--
Summary: Missed vectorization: "stmt not supported: cond_expr"
Product: gcc
Version: 4.5.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: tree-optimization
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: spop at gcc dot gnu dot org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43430
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug tree-optimization/43430] Missed vectorization: "stmt not supported: cond_expr"
2010-03-18 20:27 [Bug tree-optimization/43430] New: Missed vectorization: "stmt not supported: cond_expr" spop at gcc dot gnu dot org
@ 2010-03-26 20:08 ` spop at gcc dot gnu dot org
2010-03-26 20:13 ` spop at gcc dot gnu dot org
` (7 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: spop at gcc dot gnu dot org @ 2010-03-26 20:08 UTC (permalink / raw)
To: gcc-bugs
------- Comment #1 from spop at gcc dot gnu dot org 2010-03-26 20:08 -------
Due to the "FORNOW" fail in vectorizable_condition:
int nunits = TYPE_VECTOR_SUBPARTS (vectype);
int ncopies = LOOP_VINFO_VECT_FACTOR (loop_vinfo) / nunits;
if (ncopies > 1)
return false; /* FORNOW */
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43430
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug tree-optimization/43430] Missed vectorization: "stmt not supported: cond_expr"
2010-03-18 20:27 [Bug tree-optimization/43430] New: Missed vectorization: "stmt not supported: cond_expr" spop at gcc dot gnu dot org
2010-03-26 20:08 ` [Bug tree-optimization/43430] " spop at gcc dot gnu dot org
@ 2010-03-26 20:13 ` spop at gcc dot gnu dot org
2010-03-26 20:27 ` spop at gcc dot gnu dot org
` (6 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: spop at gcc dot gnu dot org @ 2010-03-26 20:13 UTC (permalink / raw)
To: gcc-bugs
------- Comment #2 from spop at gcc dot gnu dot org 2010-03-26 20:13 -------
Reduced testcase, for which ncopies is 4.
typedef unsigned char uint8_t;
vsad16_c (void *c, uint8_t * s1, uint8_t * s2, int stride, int h)
{
int score = 0;
int x, y;
for (x = 0; x < 16; x++)
score += ((s1[x] - s1[x + stride] + s2[x + stride]) >= 0 ?
s1[x] + s2[x + stride] :
s2[x + stride]);
return score;
}
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43430
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug tree-optimization/43430] Missed vectorization: "stmt not supported: cond_expr"
2010-03-18 20:27 [Bug tree-optimization/43430] New: Missed vectorization: "stmt not supported: cond_expr" spop at gcc dot gnu dot org
2010-03-26 20:08 ` [Bug tree-optimization/43430] " spop at gcc dot gnu dot org
2010-03-26 20:13 ` spop at gcc dot gnu dot org
@ 2010-03-26 20:27 ` spop at gcc dot gnu dot org
2010-03-26 20:49 ` spop at gcc dot gnu dot org
` (5 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: spop at gcc dot gnu dot org @ 2010-03-26 20:27 UTC (permalink / raw)
To: gcc-bugs
------- Comment #3 from spop at gcc dot gnu dot org 2010-03-26 20:26 -------
vectorizable_condition has to be cleaned up of this condition:
/* We do not handle two different vector types for the condition
and the values. */
if (TREE_TYPE (TREE_OPERAND (cond_expr, 0)) != TREE_TYPE (vectype))
return false;
When using:
typedef int uint8_t;
vsad16_c (void *c, uint8_t * s1, uint8_t * s2, int stride, int h)
{
int score = 0;
int x, y;
for (x = 0; x < 16; x++)
score += ((s1[x] - s1[x + stride] + s2[x + stride]) >= 0 ?
s1[x] + s2[x + stride] :
s2[x + stride]);
return score;
}
ncopies is then equal to 1, but then this condition is true:
"uint8_t" is a different type than "int"
type <integer_type 0x7ffff5a91498 uint8_t sizes-gimplified public SI
type <integer_type 0x7ffff7e7f498 int sizes-gimplified public SI
but using this version, we pass over this condition:
int vsad16_c (void *c, int * s1, int * s2, int stride, int h)
{
int score = 0;
int x, y;
for (x = 0; x < 16; x++)
score += ((s1[x] - s1[x + stride] + s2[x + stride]) >= 0 ?
s1[x] + s2[x + stride] :
s2[x + stride]);
return score;
}
and the loop is vectorized.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43430
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug tree-optimization/43430] Missed vectorization: "stmt not supported: cond_expr"
2010-03-18 20:27 [Bug tree-optimization/43430] New: Missed vectorization: "stmt not supported: cond_expr" spop at gcc dot gnu dot org
` (2 preceding siblings ...)
2010-03-26 20:27 ` spop at gcc dot gnu dot org
@ 2010-03-26 20:49 ` spop at gcc dot gnu dot org
2010-03-26 21:18 ` spop at gcc dot gnu dot org
` (4 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: spop at gcc dot gnu dot org @ 2010-03-26 20:49 UTC (permalink / raw)
To: gcc-bugs
------- Comment #4 from spop at gcc dot gnu dot org 2010-03-26 20:49 -------
This cleanup of vectorizable_condition allows this testcase to be vectorized:
typedef int uint8_t;
vsad16_c (void *c, uint8_t * s1, uint8_t * s2, int stride, int h)
{
int score = 0;
int x, y;
for (x = 0; x < 16; x++)
score += ((s1[x] - s1[x + stride] + s2[x + stride]) >= 0 ?
s1[x] + s2[x + stride] :
s2[x + stride]);
return score;
}
diff --git a/gcc/tree-vect-stmts.c b/gcc/tree-vect-stmts.c
index 4bce61a..cfb1471 100644
--- a/gcc/tree-vect-stmts.c
+++ b/gcc/tree-vect-stmts.c
@@ -3865,7 +3865,8 @@ vectorizable_condition (gimple stmt, gimple_stmt_iterator
*gsi,
/* We do not handle two different vector types for the condition
and the values. */
- if (TREE_TYPE (TREE_OPERAND (cond_expr, 0)) != TREE_TYPE (vectype))
+ if (!useless_type_conversion_p (TREE_TYPE (TREE_OPERAND (cond_expr, 0)),
+ TREE_TYPE (vectype)))
return false;
if (TREE_CODE (then_clause) == SSA_NAME)
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43430
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug tree-optimization/43430] Missed vectorization: "stmt not supported: cond_expr"
2010-03-18 20:27 [Bug tree-optimization/43430] New: Missed vectorization: "stmt not supported: cond_expr" spop at gcc dot gnu dot org
` (3 preceding siblings ...)
2010-03-26 20:49 ` spop at gcc dot gnu dot org
@ 2010-03-26 21:18 ` spop at gcc dot gnu dot org
2010-03-30 19:59 ` spop at gcc dot gnu dot org
` (3 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: spop at gcc dot gnu dot org @ 2010-03-26 21:18 UTC (permalink / raw)
To: gcc-bugs
------- Comment #5 from spop at gcc dot gnu dot org 2010-03-26 21:18 -------
Created an attachment (id=20218)
--> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=20218&action=view)
Cleanup comparisons of types
This patch replaces with types_compatible_p all the places in the
vectorizer that were comparing types by pointer equality.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43430
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug tree-optimization/43430] Missed vectorization: "stmt not supported: cond_expr"
2010-03-18 20:27 [Bug tree-optimization/43430] New: Missed vectorization: "stmt not supported: cond_expr" spop at gcc dot gnu dot org
` (4 preceding siblings ...)
2010-03-26 21:18 ` spop at gcc dot gnu dot org
@ 2010-03-30 19:59 ` spop at gcc dot gnu dot org
2010-09-07 13:28 ` matz at gcc dot gnu dot org
` (2 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: spop at gcc dot gnu dot org @ 2010-03-30 19:59 UTC (permalink / raw)
To: gcc-bugs
------- Comment #6 from spop at gcc dot gnu dot org 2010-03-30 19:58 -------
Subject: Bug 43430
Author: spop
Date: Tue Mar 30 19:58:35 2010
New Revision: 157833
URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=157833
Log:
Replace type != type comparisons with types_compatible_p.
2010-03-30 Sebastian Pop <sebastian.pop@amd.com>
PR middle-end/43430
* tree-vect-slp.c (vect_get_and_check_slp_defs): Replace type
pointer comparisons with types_compatible_p.
* tree-vect-stmts.c (vectorizable_call): Same.
(vectorizable_condition): Same.
* gcc.dg/vect/pr43430-1.c: New.
Added:
trunk/gcc/testsuite/gcc.dg/vect/pr43430-1.c
Modified:
trunk/gcc/ChangeLog
trunk/gcc/testsuite/ChangeLog
trunk/gcc/tree-vect-slp.c
trunk/gcc/tree-vect-stmts.c
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43430
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug tree-optimization/43430] Missed vectorization: "stmt not supported: cond_expr"
2010-03-18 20:27 [Bug tree-optimization/43430] New: Missed vectorization: "stmt not supported: cond_expr" spop at gcc dot gnu dot org
` (5 preceding siblings ...)
2010-03-30 19:59 ` spop at gcc dot gnu dot org
@ 2010-09-07 13:28 ` matz at gcc dot gnu dot org
2010-09-08 12:40 ` matz at gcc dot gnu dot org
2010-09-17 19:02 ` spop at gcc dot gnu dot org
8 siblings, 0 replies; 10+ messages in thread
From: matz at gcc dot gnu dot org @ 2010-09-07 13:28 UTC (permalink / raw)
To: gcc-bugs
------- Comment #7 from matz at gcc dot gnu dot org 2010-09-07 13:24 -------
The remaining problem is the support for ncopies > 1 in
vectorizable_condition. http://gcc.gnu.org/ml/gcc-patches/2010-09/msg00550.html
implements this.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43430
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug tree-optimization/43430] Missed vectorization: "stmt not supported: cond_expr"
2010-03-18 20:27 [Bug tree-optimization/43430] New: Missed vectorization: "stmt not supported: cond_expr" spop at gcc dot gnu dot org
` (6 preceding siblings ...)
2010-09-07 13:28 ` matz at gcc dot gnu dot org
@ 2010-09-08 12:40 ` matz at gcc dot gnu dot org
2010-09-17 19:02 ` spop at gcc dot gnu dot org
8 siblings, 0 replies; 10+ messages in thread
From: matz at gcc dot gnu dot org @ 2010-09-08 12:40 UTC (permalink / raw)
To: gcc-bugs
------- Comment #8 from matz at gcc dot gnu dot org 2010-09-08 12:40 -------
Subject: Bug 43430
Author: matz
Date: Wed Sep 8 12:40:24 2010
New Revision: 163999
URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=163999
Log:
PR tree-optimization/43430
* tree-vect-stmts.c (vectorizable_condition): Support multiple
copies for conditional statements if it's not part of a reduction.
testsuite/
PR tree-optimization/43430
* gcc.dg/vect/pr43430-2.c: New test.
Added:
trunk/gcc/testsuite/gcc.dg/vect/pr43430-2.c
Modified:
trunk/gcc/ChangeLog
trunk/gcc/testsuite/ChangeLog
trunk/gcc/tree-vect-stmts.c
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43430
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug tree-optimization/43430] Missed vectorization: "stmt not supported: cond_expr"
2010-03-18 20:27 [Bug tree-optimization/43430] New: Missed vectorization: "stmt not supported: cond_expr" spop at gcc dot gnu dot org
` (7 preceding siblings ...)
2010-09-08 12:40 ` matz at gcc dot gnu dot org
@ 2010-09-17 19:02 ` spop at gcc dot gnu dot org
8 siblings, 0 replies; 10+ messages in thread
From: spop at gcc dot gnu dot org @ 2010-09-17 19:02 UTC (permalink / raw)
To: gcc-bugs
------- Comment #9 from spop at gcc dot gnu dot org 2010-09-17 19:01 -------
Fixed.
--
spop at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |RESOLVED
Resolution| |FIXED
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43430
^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2010-09-17 19:02 UTC | newest]
Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-03-18 20:27 [Bug tree-optimization/43430] New: Missed vectorization: "stmt not supported: cond_expr" spop at gcc dot gnu dot org
2010-03-26 20:08 ` [Bug tree-optimization/43430] " spop at gcc dot gnu dot org
2010-03-26 20:13 ` spop at gcc dot gnu dot org
2010-03-26 20:27 ` spop at gcc dot gnu dot org
2010-03-26 20:49 ` spop at gcc dot gnu dot org
2010-03-26 21:18 ` spop at gcc dot gnu dot org
2010-03-30 19:59 ` spop at gcc dot gnu dot org
2010-09-07 13:28 ` matz at gcc dot gnu dot org
2010-09-08 12:40 ` matz at gcc dot gnu dot org
2010-09-17 19:02 ` spop at gcc dot gnu dot org
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).