On 7/4/21 11:32 AM, Bill Schmidt wrote
> On 7/1/21 2:48 PM, Peter Bergner via Gcc-patches wrote:
>> +      if (d[1].icode != CODE_FOR_nothing)
>> +        {
>> +          op[nopnds++] = void_type_node;
>> +          icode = d[1].icode;
>> +        }


> This hunk bothers me.  The new macros BU_MMA_PAIR_LD and BU_MMA_PAIR_ST
> define only one builtin, not two.

Correct, unlike the other MMA builtins, they do not expand from gimple
into internal builtins that are expanded at rtl time.  They instead are
expanded directly into gimple memory references.


> They are both flagged as RS6000_BTC_GIMPLE.

Yes, because they are supposed to be expanded at gimple time.

Note, other non-MMA builtins that expand at gimple time should
probably also set this flag.  That would allow an early exit
to be added to rs6000_gimple_fold_builtin().  I can add that
as a TODO.




> The use of d[1] in this case is suspect and fragile.  It appears you're 
> relying
> on the built-in following each of __builtin_vsx_lxvp and __builtin_vsx_stxvp
> to exist, as otherwise d[1] will be out of bounds.  

Ok, if they had been added as the last builtins in the array (they aren't),
that would be a problem.


> Can you please replace this with something less fragile?
> Perhaps leave the gimple_func leg alone, but first test for these two
> builtins and do the right thing for them instead.

These are RS6000_BTC_GIMPLE, so I think they should be handled within
the "if (gimple_func) ..." leg.  That said, how about the following
change to resolve the issue you have?  I'll kick off a bootstrap and
regtest for this change.

Peter


        * config/rs6000/rs6000-call.c (mma_init_builtins): Use VSX_BUILTIN_LXVP
        and VSX_BUILTIN_STXVP.

diff --git a/gcc/config/rs6000/rs6000-call.c b/gcc/config/rs6000/rs6000-call.c
index 6115e3b34d9..904e104c058 100644
--- a/gcc/config/rs6000/rs6000-call.c
+++ b/gcc/config/rs6000/rs6000-call.c
@@ -14293,7 +14293,8 @@ mma_init_builtins (void)
          /* Some MMA built-ins that are expanded into gimple are converted
             into internal MMA built-ins that are expanded into rtl.
             The internal built-in follows immediately after this built-in.  */
-         if (d[1].icode != CODE_FOR_nothing)
+         if (d->code != VSX_BUILTIN_LXVP
+             && d->code != VSX_BUILTIN_STXVP)
            {
              op[nopnds++] = void_type_node;
              icode = d[1].icode;



Reply via email to