Hi Kishan,

On 16/03/26 7:04 PM, Kishan Parmar wrote:
> Hello,
> 
> This patch depends on the -mcpu=future patch and will be upstreamed
> after that patch is upstreamed.
> 
> Bootstrapped and regtested on powerpc64le-linux-gnu.
> 
> Thanks and regards,
> Kishan Parmar
> 
> Changes from v1:
>       1. Remove the 'future' attribute; use stanza-based gating only.
> 
> 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-16  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 for future.
>       (write_decls): Add ENB_FUTURE in bif_enable enum of generated header
>       file.
> ---
>  gcc/config/rs6000/rs6000-builtin.cc      |  5 +++++
>  gcc/config/rs6000/rs6000-gen-builtins.cc | 10 +++++++---
>  2 files changed, 12 insertions(+), 3 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..3f74244dbe2 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
> @@ -2249,7 +2252,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");

There should not be a comma after ENB_FUTURE.

LGTM with this change. Please wait for Segher's approval

-Surya

>    fprintf (header_file, "};\n\n");
>  
>    fprintf (header_file, "#define PPC_MAXRESTROPNDS 3\n");

Reply via email to