This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
Other format: | [Raw text] |
Please do the early outs where you compute the arguments. Thus, right after getting op0 in this case or right after computing n for the n != 1 check.
I think you need to verify that the type of 'op' is actually the element type of op0. The BIT_FIELD_REF can happily access elements two and three of { 1, 2, 3, 4 } as a long for example.
See the BIT_FIELD_REF foldings in fold-const.c.
+ if (code == VEC_PERM_EXPR) + { + tree p, m, index, tem; + unsigned nelts; + m = gimple_assign_rhs3 (def_stmt); + if (TREE_CODE (m) != VECTOR_CST) + return false; + nelts = VECTOR_CST_NELTS (m); + idx = TREE_INT_CST_LOW (VECTOR_CST_ELT (m, idx)); + idx %= 2 * nelts; + if (idx < nelts) + { + p = gimple_assign_rhs1 (def_stmt); + } + else + { + p = gimple_assign_rhs2 (def_stmt); + idx -= nelts; + } + index = build_int_cst (TREE_TYPE (TREE_TYPE (m)), idx * size); + tem = fold_build3 (BIT_FIELD_REF, TREE_TYPE (op), p, op1, index);
This shouldn't simplify, so you can use build3 instead.
Please also add handling of code == CONSTRUCTOR.
-- Marc Glisse
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |