Bug 27460 - Does not vectorize statements with mixed type COND_EXPRs
Summary: Does not vectorize statements with mixed type COND_EXPRs
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: tree-optimization (show other bugs)
Version: 4.2.0
: P3 enhancement
Target Milestone: 4.7.0
Assignee: Richard Biener
URL:
Keywords: missed-optimization
: 49457 (view as bug list)
Depends on:
Blocks: 27151
  Show dependency treegraph
 
Reported: 2006-05-06 17:44 UTC by Richard Biener
Modified: 2011-09-02 13:54 UTC (History)
3 users (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed: 2006-05-07 03:23:59


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Richard Biener 2006-05-06 17:44:32 UTC
See testsuite/gcc.dg/vect/pr27151.c:

float vs_data[75];
void vis_clear_data ()
{
  int vis_type, i;
  for (i = 0; i < 75; i++)
    {
      vs_data[i] = (vis_type == 1);
    }
}

the loop is not vectorized because the COND_EXPRs condition has a different
type than the COND_EXPRs true/false results.

See also http://gcc.gnu.org/ml/gcc-patches/2006-05/msg00255.html for
more analysis on this problem.
Comment 1 Andrew Pinski 2006-05-07 03:23:59 UTC
Confirmed.
Comment 2 Ira Rosen 2011-06-19 10:14:24 UTC
*** Bug 49457 has been marked as a duplicate of this bug. ***
Comment 3 vincenzo Innocente 2011-06-23 07:00:11 UTC
is not that the fix in PR49483 will help also in this case?
Please let me know if this is considered a bug that will be eventually fixed or a feature to be added to any sort of documentation or tutorial  about "vectorization with gcc"
Comment 4 Richard Biener 2011-08-30 08:54:42 UTC
Mine.
Comment 5 Richard Biener 2011-09-02 13:53:37 UTC
Author: rguenth
Date: Fri Sep  2 13:53:32 2011
New Revision: 178480

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=178480
Log:
2011-09-02  Richard Guenther  <rguenther@suse.de>

	PR tree-optimization/27460
	PR middle-end/29269
	* doc/md.texi (vcond): Document.
	* genopinit.c (optabs): Turn vcond{,u}_optab into a conversion
	optab with two modes.
	* optabs.h (enum convert_optab_index): Add COI_vcond, COI_vcondu.
	(enum direct_optab_index): Remove DOI_vcond, DOI_vcondu.
	(vcond_optab): Adjust.
	(vcondu_optab): Likewise.
	(expand_vec_cond_expr_p): Adjust prototype.
	* optabs.c (get_vcond_icode): Adjust.
	(expand_vec_cond_expr_p): Likewise.
	(expand_vec_cond_expr): Likewise.
	* tree-vect-stmts.c (vect_is_simple_cond): Return the comparison
	vector type.
	(vectorizable_condition): Allow differing types for comparison
	and result.

	* config/i386/i386.c (ix86_expand_sse_cmp): Use proper mode
	for the comparison.
	* config/i386/sse.md (vcond<mode>): Split to
	vcond<V_256:mode><VF_256:mode>, vcond<V_128:mode><VF_128:mode>,
	vcond<V_128:mode><VI124_128:mode> and
	vcondu<V_128:mode><VI124_128:mode>.
	(vcondv2di): Change to vcond<VI8F_128:mode>v2di.
	(vconduv2di): Likewise.
	* config/arm/neon.md (vcond<mode>): Change to vcond*<mode><mode>.
	(vcondu<mode>): Likewise.
	* config/ia64/vect.md (vcond<mode>): Likewise.
	(vcondu<mode>): Likewise.
	(vcondv2sf): Likewise.
	* config/mips/mips-ps-3d.md (vcondv2sf): Likewise.
	* config/rs6000/paired.md (vcondv2sf): Likewise.
	* config/rs6000/vector.md (vcond<mode>): Likewise.
	(vcondu<mode>): Likewise.
	* config/spu/spu.md (vcond<mode>): Likewise.
	(vcondu<mode>): Likewise.

	* gcc.dg/vect/vect-cond-7.c: New testcase.

Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/config/arm/neon.md
    trunk/gcc/config/i386/i386.c
    trunk/gcc/config/i386/sse.md
    trunk/gcc/config/ia64/vect.md
    trunk/gcc/config/mips/mips-ps-3d.md
    trunk/gcc/config/rs6000/paired.md
    trunk/gcc/config/rs6000/vector.md
    trunk/gcc/config/spu/spu.md
    trunk/gcc/doc/md.texi
    trunk/gcc/genopinit.c
    trunk/gcc/optabs.c
    trunk/gcc/optabs.h
    trunk/gcc/testsuite/ChangeLog
    trunk/gcc/tree-vect-stmts.c
Comment 6 Richard Biener 2011-09-02 13:54:18 UTC
Fixed for 4.7.