From 4714942e0fbd2aa23f12f88d80b93e9b6ff4c041 Mon Sep 17 00:00:00 2001 From: Jakub Jelinek Date: Tue, 18 Dec 2018 12:22:00 +0100 Subject: re PR target/88513 (FAIL: gcc.target/i386/pr59591-1.c) PR target/88513 PR target/88514 * optabs.def (vec_pack_sbool_trunc_optab, vec_unpacks_sbool_hi_optab, vec_unpacks_sbool_lo_optab): New optabs. * optabs.c (expand_widen_pattern_expr): Use vec_unpacks_sbool_*_optab and pass additional argument if both input and target have the same scalar mode of VECTOR_BOOLEAN_TYPE_P vectors. * expr.c (expand_expr_real_2) : Handle VECTOR_BOOLEAN_TYPE_P pack where result has the same scalar mode as the operands using vec_pack_sbool_trunc_optab. * tree-vect-stmts.c (supportable_widening_operation): Use vec_unpacks_sbool_{lo,hi}_optab for VECTOR_BOOLEAN_TYPE_P conversions where both wider_vectype and vectype have the same scalar mode. (supportable_narrowing_operation): Similarly use vec_pack_sbool_trunc_optab if narrow_vectype and vectype have the same scalar mode. * config/i386/i386.c (ix86_get_builtin) : Check for VECTOR_MODE_P rather than non-VOIDmode. * config/i386/sse.md (vec_pack_trunc_qi, vec_pack_trunc_): Remove useless ()s around "register_operand", formatting fixes. (vec_pack_sbool_trunc_qi, vec_unpacks_sbool_lo_qi, vec_unpacks_sbool_hi_qi): New expanders. * doc/md.texi (vec_pack_sbool_trunc_M, vec_unpacks_sbool_hi_M, vec_unpacks_sbool_lo_M): Document. * gcc.target/i386/avx512f-pr88513-1.c: New test. * gcc.target/i386/avx512f-pr88513-2.c: New test. * gcc.target/i386/avx512vl-pr88464-1.c: New test. * gcc.target/i386/avx512vl-pr88464-2.c: New test. * gcc.target/i386/avx512vl-pr88464-3.c: New test. * gcc.target/i386/avx512vl-pr88464-4.c: New test. * gcc.target/i386/avx512vl-pr88513-1.c: New test. * gcc.target/i386/avx512vl-pr88513-2.c: New test. * gcc.target/i386/avx512vl-pr88513-3.c: New test. * gcc.target/i386/avx512vl-pr88513-4.c: New test. * gcc.target/i386/avx512vl-pr88514-1.c: New test. * gcc.target/i386/avx512vl-pr88514-2.c: New test. * gcc.target/i386/avx512vl-pr88514-3.c: New test. From-SVN: r267228 --- gcc/optabs.c | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'gcc/optabs.c') diff --git a/gcc/optabs.c b/gcc/optabs.c index 1f87e42..68270bd 100644 --- a/gcc/optabs.c +++ b/gcc/optabs.c @@ -256,6 +256,7 @@ expand_widen_pattern_expr (sepops ops, rtx op0, rtx op1, rtx wide_op, enum insn_code icode; int nops = TREE_CODE_LENGTH (ops->code); int op; + bool sbool = false; oprnd0 = ops->op0; tmode0 = TYPE_MODE (TREE_TYPE (oprnd0)); @@ -265,6 +266,22 @@ expand_widen_pattern_expr (sepops ops, rtx op0, rtx op1, rtx wide_op, for these ops. */ widen_pattern_optab = optab_for_tree_code (ops->code, ops->type, optab_default); + else if ((ops->code == VEC_UNPACK_HI_EXPR + || ops->code == VEC_UNPACK_LO_EXPR) + && VECTOR_BOOLEAN_TYPE_P (ops->type) + && VECTOR_BOOLEAN_TYPE_P (TREE_TYPE (oprnd0)) + && TYPE_MODE (ops->type) == TYPE_MODE (TREE_TYPE (oprnd0)) + && SCALAR_INT_MODE_P (TYPE_MODE (ops->type))) + { + /* For VEC_UNPACK_{LO,HI}_EXPR if the mode of op0 and result is + the same scalar mode for VECTOR_BOOLEAN_TYPE_P vectors, use + vec_unpacks_sbool_{lo,hi}_optab, so that we can pass in + the pattern number of elements in the wider vector. */ + widen_pattern_optab + = (ops->code == VEC_UNPACK_HI_EXPR + ? vec_unpacks_sbool_hi_optab : vec_unpacks_sbool_lo_optab); + sbool = true; + } else widen_pattern_optab = optab_for_tree_code (ops->code, TREE_TYPE (oprnd0), optab_default); @@ -282,6 +299,12 @@ expand_widen_pattern_expr (sepops ops, rtx op0, rtx op1, rtx wide_op, oprnd1 = ops->op1; tmode1 = TYPE_MODE (TREE_TYPE (oprnd1)); } + else if (sbool) + { + nops = 2; + op1 = GEN_INT (TYPE_VECTOR_SUBPARTS (TREE_TYPE (oprnd0)).to_constant ()); + tmode1 = tmode0; + } /* The last operand is of a wider mode than the rest of the operands. */ if (nops == 2) -- cgit v1.1