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, rs6000] Add -maltivec=be semantics in LE mode for vec_ld and vec_st


On Thu, Feb 20, 2014 at 2:46 PM, Bill Schmidt
<wschmidt@linux.vnet.ibm.com> wrote:
> Hi,
>
> For compatibility with the XL compilers, we need to support -maltivec=be
> for vec_ld, vec_ldl, vec_st, and vec_stl.  (A later patch will also
> handle vec_lde and vec_ste.)
>
> This is a much simpler patch than its size would indicate.  The original
> implementation of these built-ins treated them all as always loading and
> storing V4SI values, relying on subregs to adjust type mismatches.  For
> this work we need to have the true type so that we know how to reverse
> the order of vector elements.  So most of this patch is the busy-work of
> adding new built-in definitions for all the supported types (six types
> for each of the four built-ins).
>
> The real work is done in altivec.md to call altivec_expand_{lvx,stvx}_be
> for these built-ins when -maltivec=be is selected for a little endian
> target, and in rs6000.c where these functions are defined.  For the
> loads, the usual load insn is generated followed by a permute to reverse
> the order of the vector elements.  For the stores, the usual store insn
> is generated preceded by a permute to reverse the order of the vector
> elements.  A common routine swap_selector_for_mode is used to generate
> the permute control vector for the permute.
>
> There are 16 new tests, 4 for each built-in.  These cover the VMX and
> VSX built-ins for big-endian, little-endian, and little-endian with
> -maltivec=be.
>
> Bootstrapped and tested on powerpc64{,le}-unknown-linux-gnu with no
> regressions.  All the new tests pass in all endian environments.  Is
> this ok for trunk?
>
> Thanks,
> Bill
>
>
> gcc:
>
> 2014-02-20  Bill Schmidt  <wschmidt@linux.vnet.ibm.com>
>
>         * config/rs6000/altivec.md (altivec_lvxl): Rename as
>         *altivec_lvxl_<mode>_internal and use VM2 iterator instead of
>         V4SI.
>         (altivec_lvxl_<mode>): New define_expand incorporating
>         -maltivec=be semantics where needed.
>         (altivec_lvx): Rename as *altivec_lvx_<mode>_internal.
>         (altivec_lvx_<mode>): New define_expand incorporating -maltivec=be
>         semantics where needed.
>         (altivec_stvx): Rename as *altivec_stvx_<mode>_internal.
>         (altivec_stvx_<mode>): New define_expand incorporating
>         -maltivec=be semantics where needed.
>         (altivec_stvxl): Rename as *altivec_stvxl_<mode>_internal and use
>         VM2 iterator instead of V4SI.
>         (altivec_stvxl_<mode>): New define_expand incorporating
>         -maltivec=be semantics where needed.
>         * config/rs6000/rs6000-builtin.def: Add new built-in definitions
>         LVXL_V2DF, LVXL_V2DI, LVXL_V4SF, LVXL_V4SI, LVXL_V8HI, LVXL_V16QI,
>         LVX_V2DF, LVX_V2DI, LVX_V4SF, LVX_V4SI, LVX_V8HI, LVX_V16QI,
>         STVX_V2DF, STVX_V2DI, STVX_V4SF, STVX_V4SI, STVX_V8HI, STVX_V16QI,
>         STVXL_V2DF, STVXL_V2DI, STVXL_V4SF, STVXL_V4SI, STVXL_V8HI,
>         STVXL_V16QI.
>         * config/rs6000/rs6000-c.c (altivec_overloaded_builtins): Replace
>         ALTIVEC_BUILTIN_LVX with ALTIVEC_BUILTIN_LVX_<MODE> throughout;
>         similarly for ALTIVEC_BUILTIN_LVXL, ALTIVEC_BUILTIN_STVX, and
>         ALTIVEC_BUILTIN_STVXL.
>         * config/rs6000/rs6000-protos.h (altivec_expand_lvx_be): New
>         prototype.
>         (altivec_expand_stvx_be): Likewise.
>         * config/rs6000/rs6000.c (swap_selector_for_mode): New function.
>         (altivec_expand_lvx_be): Likewise.
>         (altivec_expand_stvx_be): Likewise.
>         (altivec_expand_builtin): Add cases for
>         ALTIVEC_BUILTIN_STVX_<MODE>, ALTIVEC_BUILTIN_STVXL_<MODE>,
>         ALTIVEC_BUILTIN_LVXL_<MODE>, and ALTIVEC_BUILTIN_LVX_<MODE>.
>         (altivec_init_builtins): Add definitions for
>         __builtin_altivec_lvxl_<mode>, __builtin_altivec_lvx_<mode>,
>         __builtin_altivec_stvx_<mode>, and
>         __builtin_altivec_stvxl_<mode>.
>
>
> gcc/testsuite:
>
> 2014-02-20  Bill Schmidt  <wschmidt@linux.vnet.ibm.com>
>
>         * gcc.dg/vmx/ld.c: New test.
>         * gcc.dg/vmx/ld-be-order.c: New test.
>         * gcc.dg/vmx/ld-vsx.c: New test.
>         * gcc.dg/vmx/ld-vsx-be-order.c: New test.
>         * gcc.dg/vmx/ldl.c: New test.
>         * gcc.dg/vmx/ldl-be-order.c: New test.
>         * gcc.dg/vmx/ldl-vsx.c: New test.
>         * gcc.dg/vmx/ldl-vsx-be-order.c: New test.
>         * gcc.dg/vmx/st.c: New test.
>         * gcc.dg/vmx/st-be-order.c: New test.
>         * gcc.dg/vmx/st-vsx.c: New test.
>         * gcc.dg/vmx/st-vsx-be-order.c: New test.
>         * gcc.dg/vmx/stl.c: New test.
>         * gcc.dg/vmx/stl-be-order.c: New test.
>         * gcc.dg/vmx/stl-vsx.c: New test.
>         * gcc.dg/vmx/stl-vsx-be-order.c: New test.

Okay.
Thanks, David


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