Hi Kishan,

On 04/03/26 12:17 pm, Kishan Parmar wrote:
> Hello,
> 
> This patch depends on the -mcpu=future patch and will be upstreamed
> after that patch is upstreamed.
> 
> Thanks and regards,
> Kishan Parmar
> 
> Add support for gating rs6000 built-ins on a new target predicate
> "future", corresponding to -mcpu=future.
> 
> Extend rs6000-gen-builtins.cc and rs6000-builtin.cc to recognize
> [future] as a valid built-in gating predicate to enable defining new
> built-ins in .bif files.
> 
> 2025-03-03  Kishan Parmar  <[email protected]>
>             Michael Meissner  <[email protected]>
> 
> gcc/ChangeLog:
> 
>       * config/rs6000/rs6000-builtin.cc (rs6000_invalid_builtin): Handle 
> ENB_FUTURE
>       and issue diagnostic requiring -mcpu=future.
>       (rs6000_builtin_is_supported): Return TARGET_FUTURE for ENB_FUTURE 
> built-ins.
>       * config/rs6000/rs6000-gen-builtins.cc (enum bif_stanza): Add 
> BSTZ_FUTURE.
>       (struct attrinfo): Add isfuture member.

I don't see why we need 'future' as an attribute. We will be using it as a 
stanza
header, but I don't foresee any need of 'future' as an attribute.

-Surya

>       (parse_bif_attrs): Account for future attribute in debug output.
>       (write_decls): Emit ENB_FUTURE in enable enum and define bif_future_bit 
> and
>       bif_is_future.
>       (write_bif_static_init): Set bif_future_bit when isfuture is specified.
> ---
>  gcc/config/rs6000/rs6000-builtin.cc      |  5 +++++
>  gcc/config/rs6000/rs6000-gen-builtins.cc | 21 ++++++++++++++++-----
>  2 files changed, 21 insertions(+), 5 deletions(-)
> 
> diff --git a/gcc/config/rs6000/rs6000-builtin.cc 
> b/gcc/config/rs6000/rs6000-builtin.cc
> index 45c88fe063b..4d0e541351f 100644
> --- a/gcc/config/rs6000/rs6000-builtin.cc
> +++ b/gcc/config/rs6000/rs6000-builtin.cc
> @@ -139,6 +139,9 @@ rs6000_invalid_builtin (enum rs6000_gen_builtins fncode)
>      case ENB_MMA:
>        error ("%qs requires the %qs option", name, "-mmma");
>        break;
> +    case ENB_FUTURE:
> +      error ("%qs requires the %qs option", name, "-mcpu=future");
> +      break;
>      default:
>      case ENB_ALWAYS:
>        gcc_unreachable ();
> @@ -194,6 +197,8 @@ rs6000_builtin_is_supported (enum rs6000_gen_builtins 
> fncode)
>        return TARGET_HTM;
>      case ENB_MMA:
>        return TARGET_MMA;
> +    case ENB_FUTURE:
> +      return TARGET_FUTURE;
>      default:
>        gcc_unreachable ();
>      }
> diff --git a/gcc/config/rs6000/rs6000-gen-builtins.cc 
> b/gcc/config/rs6000/rs6000-gen-builtins.cc
> index c7ae5899c5c..a3435ded73d 100644
> --- a/gcc/config/rs6000/rs6000-gen-builtins.cc
> +++ b/gcc/config/rs6000/rs6000-gen-builtins.cc
> @@ -232,6 +232,7 @@ enum bif_stanza
>   BSTZ_P10,
>   BSTZ_P10_64,
>   BSTZ_MMA,
> + BSTZ_FUTURE,
>   NUMBIFSTANZAS
>  };
>  
> @@ -265,7 +266,8 @@ static stanza_entry stanza_map[NUMBIFSTANZAS] =
>      { "htm",         BSTZ_HTM        },
>      { "power10",     BSTZ_P10        },
>      { "power10-64",  BSTZ_P10_64     },
> -    { "mma",         BSTZ_MMA        }
> +    { "mma",         BSTZ_MMA        },
> +    { "future",      BSTZ_FUTURE     },
>    };
>  
>  static const char *enable_string[NUMBIFSTANZAS] =
> @@ -290,7 +292,8 @@ static const char *enable_string[NUMBIFSTANZAS] =
>      "ENB_HTM",
>      "ENB_P10",
>      "ENB_P10_64",
> -    "ENB_MMA"
> +    "ENB_MMA",
> +    "ENB_FUTURE",
>    };
>  
>  /* Function modifiers provide special handling for const, pure, and fpmath
> @@ -392,6 +395,7 @@ struct attrinfo
>    bool isendian;
>    bool isibmld;
>    bool isibm128;
> +  bool isfuture;
>  };
>  
>  /* Fields associated with a function prototype (bif or overload).  */
> @@ -1470,14 +1474,15 @@ parse_bif_attrs (attrinfo *attrptr)
>       "pred = %d, htm = %d, htmspr = %d, htmcr = %d, mma = %d, "
>       "quad = %d, pair = %d, mmaint = %d, no32bit = %d, 32bit = %d, "
>       "cpu = %d, ldstmask = %d, lxvrse = %d, lxvrze = %d, endian = %d, "
> -     "ibmdld = %d, ibm128 = %d.\n",
> +     "ibmdld = %d, ibm128 = %d, future = %d.\n",
>       attrptr->isextract, attrptr->isnosoft,attrptr->isldvec,
>       attrptr->isstvec, attrptr->isreve, attrptr->ispred, attrptr->ishtm,
>       attrptr->ishtmspr, attrptr->ishtmcr, attrptr->ismma,
>       attrptr->isquad, attrptr->ispair, attrptr->ismmaint,
>       attrptr->isno32bit, attrptr->is32bit, attrptr->iscpu,
>       attrptr->isldstmask, attrptr->islxvrse, attrptr->islxvrze,
> -     attrptr->isendian, attrptr->isibmld, attrptr->isibm128);
> +     attrptr->isendian, attrptr->isibmld, attrptr->isibm128,
> +     attrptr->isfuture);
>  #endif
>  
>    return PC_OK;
> @@ -2249,7 +2254,8 @@ write_decls (void)
>    fprintf (header_file, "  ENB_HTM,\n");
>    fprintf (header_file, "  ENB_P10,\n");
>    fprintf (header_file, "  ENB_P10_64,\n");
> -  fprintf (header_file, "  ENB_MMA\n");
> +  fprintf (header_file, "  ENB_MMA,\n");
> +  fprintf (header_file, "  ENB_FUTURE,\n");
>    fprintf (header_file, "};\n\n");
>  
>    fprintf (header_file, "#define PPC_MAXRESTROPNDS 3\n");
> @@ -2291,6 +2297,7 @@ write_decls (void)
>    fprintf (header_file, "#define bif_endian_bit\t\t(0x00200000)\n");
>    fprintf (header_file, "#define bif_ibmld_bit\t\t(0x00400000)\n");
>    fprintf (header_file, "#define bif_ibm128_bit\t\t(0x00800000)\n");
> +  fprintf (header_file, "#define bif_future_bit\t\t(0x01000000)\n");
>    fprintf (header_file, "\n");
>    fprintf (header_file,
>          "#define bif_is_extract(x)\t((x).bifattrs & bif_extract_bit)\n");
> @@ -2336,6 +2343,8 @@ write_decls (void)
>          "#define bif_is_ibmld(x)\t((x).bifattrs & bif_ibmld_bit)\n");
>    fprintf (header_file,
>          "#define bif_is_ibm128(x)\t((x).bifattrs & bif_ibm128_bit)\n");
> +  fprintf (header_file,
> +        "#define bif_is_future(x)\t((x).bifattrs & bif_future_bit)\n");
>    fprintf (header_file, "\n");
>  
>    fprintf (header_file,
> @@ -2535,6 +2544,8 @@ write_bif_static_init (void)
>       fprintf (init_file, " | bif_ibmld_bit");
>        if (bifp->attrs.isibm128)
>       fprintf (init_file, " | bif_ibm128_bit");
> +      if (bifp->attrs.isfuture)
> +     fprintf (init_file, " | bif_future_bit");
>        fprintf (init_file, ",\n");
>        fprintf (init_file, "      /* restr_opnd */\t{%d, %d, %d},\n",
>              bifp->proto.restr_opnd[0], bifp->proto.restr_opnd[1],

Reply via email to