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]

Re: [PATCH, vectorizer]: Update-1: Vectorize int->double and double->int conversions


Richard Guenther <rguenther@suse.de> wrote on 16/05/2007 18:31:32:

> On Tue, 15 May 2007, Uros Bizjak wrote:
>
> > Hello!
> >
> > This patch is an update of int->double and double->int conversions
> > vectorization patch. It fixes handling of signed/unsigned "unpack with
> > float" by handling the expansion of VEC_UNPACK_FLOAT_HI_EXPR and
> > VEC_UNPACK_FLOAT_LO_EXPR in the same way as FLOAT_EXPR is expanded via
> > expand_float(). I have checked that expand_widen_pattern_expr() worker
> > funciton expands these expressions to correct optabs.
> >
> > As a proof, this patch also implements signed short -> float and
> > unsigned short -> float conversions. As confirmed by added testcases,
> > conversion works correctly for all these types. (FWIW, this conversion
> > can also be implemented on powerpc by adding relevant named patterns
> > to its .md file).
> >
> > The conversions are limited by the vectorizer infrastructure, as
> > explained in [1], where the rationale for this implementation was also
> > described.
> >
> > The patch was bootstrapped on i686-pc-linux-gnu (with backed-out
> > r124715 commit) and regression tested on all default languages. OK for
> > mainline?
>
>
> This is ok if Dorit is fine with the vectorizer parts.
>

This is ok with me

thanks,

dorit

> Thanks,
> Richard.
>
> >
> > 2007-05-15  Uros Bizjak  <ubizjak@gmail.com>
> >
> >        PR tree-optimization/24659
> >        * optabs.h (enum optab_index): Add OTI_vec_unpacks_float_hi,
> >        OTI_vec_unpacks_float_lo, OTI_vec_unpacku_float_hi,
> >        OTI_vec_unpacku_float_lo, OTI_vec_pack_sfix_trunc and
> >        OTI_vec_pack_ufix_trunc.
> >        (vec_unpacks_float_hi_optab): Define new macro.
> >        (vec_unpacks_float_lo_optab): Ditto.
> >        (vec_unpacku_float_hi_optab): Ditto.
> >        (vec_unpacku_float_lo_optab): Ditto.
> >        (vec_pack_sfix_trunc_optab): Ditto.
> >        (vec_pack_ufix_trunc_optab): Ditto.
> >        * genopinit.c (optabs): Implement vec_unpack[s|u]_[hi|lo]_optab
> >        and vec_pack_[s|u]fix_trunc_optab using
> >        vec_unpack[s|u]_[hi\lo]_* and vec_pack_[u|s]fix_trunc_* patterns
> >        * tree-vectorizer.c (supportable_widening_operation): Handle
> >        FLOAT_EXPR and CONVERT_EXPR.  Update comment.
> >        (supportable_narrowing_operation): New function.
> >        * tree-vectorizer.h (supportable_narrowing_operation):
Prototype.
> >        * tree-vect-transform.c (vectorizable_conversion): Handle
> >        (nunits_in == nunits_out / 2) and (nunits_out == nunits_in
> / 2) cases.
> >        (vect_gen_widened_results_half): Move before
vectorizable_conversion.
> >        (vectorizable_type_demotion): Call
supportable_narrowing_operation()
> >        to check for target support.
> >        * optabs.c (optab_for_tree_code) Return vec_unpack[s|u]
> _float_hi_optab
> >        for VEC_UNPACK_FLOAT_HI_EXPR, vec_unpack[s|u]_float_lo_optab
> >        for VEC_UNPACK_FLOAT_LO_EXPR and vec_pack_[u|s]fix_trunc_optab
> >        for VEC_PACK_FIX_TRUNC_EXPR.
> >        (expand_binop): Special case mode of the result for
> >        vec_pack_[u|s]fix_trunc_optab.
> >        (init_optabs): Initialize vec_unpack[s|u]_[hi|lo]_optab and
> >        vec_pack_[u|s]fix_trunc_optab.
> >
> >        * tree.def (VEC_UNPACK_FLOAT_HI_EXPR, VEC_UNPACK_FLOAT_LO_EXPR,
> >        VEC_PACK_FIX_TRUNC_EXPR): New tree codes.
> >        * tree-pretty-print.c (dump_generic_node): Handle
> >        VEC_UNPACK_FLOAT_HI_EXPR, VEC_UNPACK_FLOAT_LO_EXPR and
> >        VEC_PACK_FIX_TRUNC_EXPR.
> >        (op_prio): Ditto.
> >        * expr.c (expand_expr_real_1): Ditto.
> >        * tree-inline.c (estimate_num_insns_1): Ditto.
> >        * tree-vect-generic.c (expand_vector_operations_1): Ditto.
> >
> >        * config/i386/sse.md (vec_unpacks_float_hi_v8hi): New expander.
> >        (vec_unpacks_float_lo_v8hi): Ditto.
> >        (vec_unpacku_float_hi_v8hi): Ditto.
> >        (vec_unpacku_float_lo_v8hi): Ditto.
> >        (vec_unpacks_float_hi_v4si): Ditto.
> >        (vec_unpacks_float_lo_v4si): Ditto.
> >        (vec_pack_sfix_trunc_v2df): Ditto.
> >
> >        * doc/c-tree.texi (Expression trees) [VEC_UNPACK_FLOAT_HI_EXPR]:
> >        Document.
> >        [VEC_UNPACK_FLOAT_LO_EXPR]: Ditto.
> >        [VEC_PACK_FIX_TRUNC_EXPR]: Ditto.
> >        * doc/md.texi (Standard Names) [vec_pack_sfix_trunc]: Document.
> >        [vec_pack_ufix_trunc]: Ditto.
> >        [vec_unpacks_float_hi]: Ditto.
> >        [vec_unpacks_float_lo]: Ditto.
> >        [vec_unpacku_float_hi]: Ditto.
> >        [vec_unpacku_float_lo]: Ditto.
> >
> > testsuite/ChangeLog:
> >
> > 2007-05-15  Uros Bizjak  <ubizjak@gmail.com>
> >
> >        PR tree-optimization/24659
> >        * gcc.dg/vect/vect-floatint-conversion-2.c: New test.
> >        * gcc.dg/vect/vect-intfloat-conversion-1.c: Require vect_float,
> >        not vect_int target.
> >        * gcc.dg/vect/vect-intfloat-conversion-2.c: Require vect_float,
> >        not vect_int target.  Loop is vectorized for vect_intfloat_cvt
> >        targets.
> >        * gcc.dg/vect/vect-intfloat-conversion-3.c: New test.
> >        * gcc.dg/vect/vect-intfloat-conversion-4a.c: New test.
> >        * gcc.dg/vect/vect-intfloat-conversion-4b.c: New test.
> >
> >
> > [1] http://gcc.gnu.org/ml/gcc-patches/2007-05/msg00701.html
> >
> > Uros.
> >
>
> --
> Richard Guenther <rguenther@suse.de>
> Novell / SUSE Labs
> SUSE LINUX Products GmbH - Nuernberg - AG Nuernberg - HRB 16746 -
> GF: Markus Rex


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]