https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103686

--- Comment #3 from Peter Bergner <bergner at gcc dot gnu.org> ---
Maybe something like this untested patch:

diff --git a/gcc/config/rs6000/rs6000-call.c b/gcc/config/rs6000/rs6000-call.c
index d9736eaf21c..c7babefa32d 100644
--- a/gcc/config/rs6000/rs6000-call.c
+++ b/gcc/config/rs6000/rs6000-call.c
@@ -13615,12 +13615,14 @@ rs6000_gimple_fold_new_builtin (gimple_stmt_iterator
*gsi)
   const char *fn_name2 = (icode != CODE_FOR_nothing)
                          ? get_insn_name ((int) icode)
                          : "nothing";
+  unsigned attr = rs6000_builtin_info[fn_code].attr;

   if (TARGET_DEBUG_BUILTIN)
       fprintf (stderr, "rs6000_gimple_fold_new_builtin %d %s %s\n",
               fn_code, fn_name1, fn_name2);

-  if (!rs6000_fold_gimple)
+  if ((attr & RS6000_BTC_GIMPLE) == 0
+      && !rs6000_fold_gimple)
     return false;

   /* Prevent gimple folding for code that does not have a LHS, unless it is

Same thing needs to happen to rs6000_gimple_fold_builtin too

Reply via email to