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

Kewen Lin <linkw at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |ASSIGNED

--- Comment #2 from Kewen Lin <linkw at gcc dot gnu.org> ---
In function rs6000_expand_builtin, we have one hunk to check if one bif has
been enabled under the expected target flags, otherwise it will emit error but
still tries to expand the call.

  if (!(e == ENB_ALWAYS
        || (e == ENB_P5 && TARGET_POPCNTB)
        || (e == ENB_P6 && TARGET_CMPB)
        ...

        || (e == ENB_P10_64 && TARGET_POWER10 && TARGET_POWERPC64)
        || (e == ENB_MMA && TARGET_MMA)))
    {
      rs6000_invalid_builtin (fcode);
      return expand_call (exp, target, ignore);
    }

I simply hacked it into:

diff --git a/gcc/config/rs6000/rs6000-builtin.cc
b/gcc/config/rs6000/rs6000-builtin.cc
index 5d34c1bcfc9..f888ce80c62 100644
--- a/gcc/config/rs6000/rs6000-builtin.cc
+++ b/gcc/config/rs6000/rs6000-builtin.cc
@@ -3284,7 +3284,7 @@ htm_expand_builtin (bifdata *bifaddr, rs6000_gen_builtins
fcode,
    Use the new builtin infrastructure.  */
 rtx
 rs6000_expand_builtin (tree exp, rtx target, rtx /* subtarget */,
-                       machine_mode /* mode */, int ignore)
+                       machine_mode /* mode */, int ignore ATTRIBUTE_UNUSED)
 {
   tree fndecl = TREE_OPERAND (CALL_EXPR_FN (exp), 0);
   enum rs6000_gen_builtins fcode
@@ -3394,7 +3394,7 @@ rs6000_expand_builtin (tree exp, rtx target, rtx /*
subtarget */,
         || (e == ENB_MMA && TARGET_MMA)))
     {
       rs6000_invalid_builtin (fcode);
-      return expand_call (exp, target, ignore);
+      return const0_rtx;
     }

   if (bif_is_nosoft (*bifaddr)

and it's bootstrapped and no regression failures found on ppc64le p9/p10 and
ppc64 p8. It's a bit surprising to me. By checking its history, it's added by
r0-113861-g15ce64af29141f.  Either we miss some coverage here or it's unused
any more.

I'm not sure why we still want to expand the call further, I guess we still
want the bif to act like a normal function call and can link with some library
definition?

Reply via email to