The following testcase fails on 4.1.0 and 4.2.0 when compiled with: gcc -O2 -march=athlon64 -ftree-vectorize -c test.c test.c: In function ‘vis_clear_data’: test.c:9: error: unrecognizable insn: (insn 28 27 29 5 (set (reg:V4SF 73) (vec_duplicate:V4SF (reg/v:SI 71 [ vis_type ]))) -1 (nil) (nil)) test.c:9: internal compiler error: in extract_insn, at recog.c:2037 float vs_data[75]; void vis_clear_data () { int vis_type, i; for (i = 0; i < 75; i++) { vs_data[i] = (vis_type == 1); } }
What the vectorizer does looks good: MEM[symbol: vs_data, base: (vector float *) ivtmp.54 * 16B] = VEC_COND_EXPR < vect_cst_.35 != { 1, 1, 1, 1 } , { 0.0, 0.0, 0.0, 0.0 } , { 1.0e+0, 1.0e+0, 1.0e+0, 1.0e+0 } > ;
I get: t.c:7: internal compiler error: in immed_double_const, at emit-rtl.c:464 Anyways this is either a middle-end issue while expanding the VEC_COND_EXPR or a target one while expanding it.
Confirmed, it also ICEs on powerpc-linux-gnu with -maltivec -O1 -ftree-vectorize so it is a middle-end issue.
Actually I take that back about being a middle-end issue and not a vectorizer one. vector float vect_cst_.35; int vis_type; .... vect_cst_.35 = {vis_type, vis_type, vis_type, vis_type}; so it is getting the wrong type for the vector.
*** Bug 27154 has been marked as a duplicate of this bug. ***
The vectorizer doesn't seem to handle differing types for COND_EXPRs. So something along *** tree-vect-transform.c (revision 113296) --- tree-vect-transform.c (working copy) *************** vectorizable_condition (tree stmt, block *** 2115,2120 **** --- 2115,2125 ---- then_clause = TREE_OPERAND (op, 1); else_clause = TREE_OPERAND (op, 2); + /* 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; + if (!vect_is_simple_cond (cond_expr, loop_vinfo)) return false; should fix it.
Subject: Bug number PR27151 A patch for this bug has been added to the patch tracker. The mailing list url for the patch is http://gcc.gnu.org/ml/gcc-patches/2006-04/msg01034.html
Subject: Bug 27151 Author: rguenth Date: Sat May 6 17:37:53 2006 New Revision: 113580 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=113580 Log: 2006-05-06 Richard Guenther <rguenther@suse.de> PR tree-optimization/27151 * tree-vect-transform.c (vectorizable_condition): Punt on values that have a different type than the condition. * gcc.dg/vect/pr27151.c: New testcase. Added: trunk/gcc/testsuite/gcc.dg/vect/pr27151.c Modified: trunk/gcc/ChangeLog trunk/gcc/testsuite/ChangeLog trunk/gcc/tree-vect-transform.c
Subject: Bug 27151 Author: rguenth Date: Sat May 6 17:41:48 2006 New Revision: 113581 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=113581 Log: 2006-05-06 Richard Guenther <rguenther@suse.de> PR tree-optimization/27151 * tree-vect-transform.c (vectorizable_condition): Punt on values that have a different type than the condition. * gcc.dg/vect/pr27151.c: New testcase. Added: branches/gcc-4_1-branch/gcc/testsuite/gcc.dg/vect/pr27151.c - copied unchanged from r113580, trunk/gcc/testsuite/gcc.dg/vect/pr27151.c Modified: branches/gcc-4_1-branch/gcc/ChangeLog branches/gcc-4_1-branch/gcc/testsuite/ChangeLog branches/gcc-4_1-branch/gcc/tree-vect-transform.c
Fixed.