Bootstrapped and tested on x86_64-unknown-linux-gnu, applied. Richard.
2015-11-09 Richard Biener <rguent...@suse.de> PR tree-optimization/68248 * tree-vect-generic.c (expand_vector_operations_1): Handle scalar rhs2. * gcc.dg/torture/pr68248.c: New testcase. Index: gcc/tree-vect-generic.c =================================================================== *** gcc/tree-vect-generic.c (revision 230003) --- gcc/tree-vect-generic.c (working copy) *************** expand_vector_operations_1 (gimple_stmt_ *** 1527,1532 **** --- 1528,1535 ---- tree srhs1, srhs2 = NULL_TREE; if ((srhs1 = ssa_uniform_vector_p (rhs1)) != NULL_TREE && (rhs2 == NULL_TREE + || (! VECTOR_TYPE_P (TREE_TYPE (rhs2)) + && (srhs2 = rhs2)) || (srhs2 = ssa_uniform_vector_p (rhs2)) != NULL_TREE) /* As we query direct optabs restrict to non-convert operations. */ && TYPE_MODE (TREE_TYPE (type)) == TYPE_MODE (TREE_TYPE (srhs1))) Index: gcc/testsuite/gcc.dg/torture/pr68248.c =================================================================== *** gcc/testsuite/gcc.dg/torture/pr68248.c (revision 0) --- gcc/testsuite/gcc.dg/torture/pr68248.c (working copy) *************** *** 0 **** --- 1,20 ---- + /* { dg-do compile } */ + + int a, b, c, d; + + int + fn1 (int p1) + { + return a > 0 ? p1 : p1 >> a; + } + + void + fn2 () + { + char e; + for (; c; c++) + { + e = fn1 (!d ^ 2); + b ^= e; + } + }