Hi! On Wed, Sep 01, 2021 at 11:13:40AM -0500, Bill Schmidt wrote: > Peter Bergner recently added two new builtins __builtin_vsx_lxvp and > __builtin_vsx_stxvp. These happened to break a pattern in MMA builtins that > I had been using to automate gimple folding of MMA builtins. Previously, > every MMA function that could be folded had an associated internal function > that it was folded into. The LXVP/STXVP builtins are just folded directly > into memory operations. > > Instead of relying on this pattern, this patch adds a new attribute to > builtins called "mmaint," which is set for all MMA builtins that have an > associated internal builtin. The naming convention that adds _INTERNAL to > the builtin index name remains. > > The rest of the patch is just duplicating Peter's patch, using the new > builtin infrastructure.
> * config/rs6000/rs6000-call.c > (rs6000_gimple_fold_new_mma_builtin): Handle RS6000_BIF_LXVP and > RS6000_BIF_STXVP. It is fine to end a changelog line in a colon. > + else if (fncode == RS6000_BIF_LXVP) > + { > + push_gimplify_context (true); > + tree offset = gimple_call_arg (stmt, 0); > + tree ptr = gimple_call_arg (stmt, 1); > + tree lhs = gimple_call_lhs (stmt); > + if (TREE_TYPE (TREE_TYPE (ptr)) != vector_pair_type_node) > + ptr = build1 (VIEW_CONVERT_EXPR, > + build_pointer_type (vector_pair_type_node), ptr); > + tree mem = build_simple_mem_ref (build2 (POINTER_PLUS_EXPR, > + TREE_TYPE (ptr), ptr, offset)); > + gimplify_assign (lhs, mem, &new_seq); > + pop_gimplify_context (NULL); > + gsi_replace_with_seq (gsi, new_seq, true); > + return true; > + } Fwiw, all those cases return, so those "else" are not needed. Also it would be nice if this could be factored a bit better, hrm. Is that "if" in there useful? Maybe add a helper function for it, then? Anyway: okay for trunk. Thanks! Segher