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: [RFC] prototype altivec function overloading rewrite


This is my attempt at redoing AltiVec overloading, taking many concepts
from Richard's patch.  Many ideas of his patch were in my tree with a
different name; I renamed them to be consistent with his.  Maybe this is
a little less gross (and the fold_builtin hook seems useful on its own).
It is able to compile correctly this file:

#include <altivec.h>

vector unsigned int y;
vector int x;

char a[vec_step (x)];

void g ()
{
  y = vec_adds (vec_add (y, x), y);
  x = vec_adds (x, x);
}

Unfortunately I'm mostly offline now and the patch is against an old
snapshot I happened to have on this machine, previous to Zem's merge of
AltiVec type handling; I'll be able to bring it up to date on Thursday.  Also,
I will split the patch, so that the make_or_reuse_type and comptypes changes
can go in together
with an interim fix for PR/14899 (I'll take a look at Fariborz's C++
failures), and will submit the fix tomorrow.

        * builtins.c (fold_builtin): Call target hook for BUILT_IN_MD.
        * c-typeck.c (comptypes): Recurse for vector types instead of
        just comparing modes.
        * cp/typeck.c (comptypes): Recurse for vector types instead of
        just comparing modes.
        * hooks.c (hook_tree_tree_null): New.
        * hooks.h (hook_tree_tree_null): Declare it.
        * target-def.h (TARGET_FOLD_BUILTIN): New.
        * target.h (fold_builtin): New.
        * tree.c (make_or_reuse_type): New.
        (build_common_tree_nodes): Use it.
        * config/rs6000/rs6000.c (enum rs6000_builtin_type_index): New.
        (rs6000_builtin_types): New.
        (opaque_V2SI_type_node, opaque_V2SF_type_node,
        opaque_p_V2SI_type_node,
        V16QI_type_node, V2SI_type_node, V2SF_type_node, V4HI_type_node,
        V4SI_type_node, V4SF_type_node, V8HI_type_node,
        unsigned_V16QI_type_node, unsigned_V8HI_type_node,
        unsigned_V4SI_type_node, bool_char_type_node, bool_short_type_node,
        bool_int_type_node, pixel_type_node, bool_V16QI_type_node,
        bool_V8HI_type_node, bool_V4SI_type_node, pixel_V8HI_type_node):
        Redefine as macros.
        (opaque_V4SI_type_node): New.
        (rs6000_built_in_decls): New.
        (def_builtin): Set it.
        (TARGET_FOLD_BUILTIN): New.
        (rs6000_is_opaque_type): New name of is_ev64_opaque_type.  Handle
        opaque_V4SI_type_node.
        (TARGET_VECTOR_OPAQUE_P): Point to rs6000_is_opaque_type.
        (struct altivec_builtin_types_1arg): New.
        (struct altivec_builtin_types_2arg): New.
        (struct altivec_builtin_types_3arg): New.
        (altivec_overloaded_builtins_unary): New.
        (altivec_overloaded_builtins_binary): New.
        (altivec_overloaded_builtins_ternary): New.
        (altivec_resolve_overloaded_builtin): New.
        (rs6000_fold_builtin): New.
        (rs6000_init_builtins): Define builtins with
        opaque parameters if no insn_code associated.
        (bdesc_3arg, bdesc_dst, bdesc_2arg, bdesc_altivec_preds,
        bdesc_1arg): Add overloaded AltiVec builtins.
        * config/rs6000/rs6000.h (enum rs6000_builtins):
        Add overloaded AltiVec builtins.




Attachment: altivec.h
Description: Binary data

Attachment: altivec.patch
Description: Binary data


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