This looks good. You need approval before upstreaming.

-Surya

On 15/06/26 11:34 PM, Kishan Parmar wrote:
> Hello,
> 
> Below patch is bootstrapped and regtested on powerpc64le-linux-gnu with
> no regressions.
> 
> This patch adds infrastructure support for future-altivec as a
> builtin-stanza predicate for PowerPC. This provides a framework for
> defining builtins that require both -mcpu=future and -maltivec options.
> 
> The future-altivec stanza can be used to add AltiVec-specific builtins for
> future PowerPC ISA extensions.
> 
> 2026-06-15  Kishan Parmar  <[email protected]>
> 
> gcc/ChangeLog:
>       * config/rs6000/rs6000-builtin.cc (rs6000_invalid_builtin): Handle
>       ENB_FUTURE_ALTIVEC and issue a diagnostic requiring -mcpu=future
>       and -maltivec.
>       (rs6000_builtin_is_supported): Check TARGET_FUTURE && TARGET_ALTIVEC
>       for ENB_FUTURE_ALTIVEC built-ins.
>       * config/rs6000/rs6000-gen-builtins.cc (enum bif_stanza): Add
>       BSTZ_FUTURE_ALTIVEC entry.
>       (stanza_map): Add future-altivec stanza mapping.
>       (enable_string): Add ENB_FUTURE_ALTIVEC.
>       (write_decls): Add ENB_FUTURE_ALTIVEC to the bif_enable enum in the
>       generated header file.
> ---
>  gcc/config/rs6000/rs6000-builtin.cc      |  6 ++++++
>  gcc/config/rs6000/rs6000-gen-builtins.cc | 10 +++++++---
>  2 files changed, 13 insertions(+), 3 deletions(-)
> 
> diff --git a/gcc/config/rs6000/rs6000-builtin.cc 
> b/gcc/config/rs6000/rs6000-builtin.cc
> index f4f3772d6cc..df45e2d82ed 100644
> --- a/gcc/config/rs6000/rs6000-builtin.cc
> +++ b/gcc/config/rs6000/rs6000-builtin.cc
> @@ -142,6 +142,10 @@ rs6000_invalid_builtin (enum rs6000_gen_builtins fncode)
>      case ENB_FUTURE:
>        error ("%qs requires the %qs option", name, "-mcpu=future");
>        break;
> +    case ENB_FUTURE_ALTIVEC:
> +      error ("%qs requires the %qs and %qs options", name, "-mcpu=future",
> +          "-maltivec");
> +      break;
>      default:
>      case ENB_ALWAYS:
>        gcc_unreachable ();
> @@ -199,6 +203,8 @@ rs6000_builtin_is_supported (enum rs6000_gen_builtins 
> fncode)
>        return TARGET_MMA;
>      case ENB_FUTURE:
>        return TARGET_FUTURE;
> +    case ENB_FUTURE_ALTIVEC:
> +      return TARGET_FUTURE && TARGET_ALTIVEC;
>      default:
>        gcc_unreachable ();
>      }
> diff --git a/gcc/config/rs6000/rs6000-gen-builtins.cc 
> b/gcc/config/rs6000/rs6000-gen-builtins.cc
> index 7436404cff5..32c1f4ef83d 100644
> --- a/gcc/config/rs6000/rs6000-gen-builtins.cc
> +++ b/gcc/config/rs6000/rs6000-gen-builtins.cc
> @@ -233,6 +233,7 @@ enum bif_stanza
>   BSTZ_P10_64,
>   BSTZ_MMA,
>   BSTZ_FUTURE,
> + BSTZ_FUTURE_ALTIVEC,
>   NUMBIFSTANZAS
>  };
>  
> @@ -267,7 +268,8 @@ static stanza_entry stanza_map[NUMBIFSTANZAS] =
>      { "power10",     BSTZ_P10        },
>      { "power10-64",  BSTZ_P10_64     },
>      { "mma",         BSTZ_MMA        },
> -    { "future",      BSTZ_FUTURE     }
> +    { "future",      BSTZ_FUTURE     },
> +    { "future-altivec", BSTZ_FUTURE_ALTIVEC }
>    };
>  
>  static const char *enable_string[NUMBIFSTANZAS] =
> @@ -293,7 +295,8 @@ static const char *enable_string[NUMBIFSTANZAS] =
>      "ENB_P10",
>      "ENB_P10_64",
>      "ENB_MMA",
> -    "ENB_FUTURE"
> +    "ENB_FUTURE",
> +    "ENB_FUTURE_ALTIVEC"
>    };
>  
>  /* Function modifiers provide special handling for const, pure, and fpmath
> @@ -2253,7 +2256,8 @@ write_decls (void)
>    fprintf (header_file, "  ENB_P10,\n");
>    fprintf (header_file, "  ENB_P10_64,\n");
>    fprintf (header_file, "  ENB_MMA,\n");
> -  fprintf (header_file, "  ENB_FUTURE\n");
> +  fprintf (header_file, "  ENB_FUTURE,\n");
> +  fprintf (header_file, "  ENB_FUTURE_ALTIVEC\n");
>    fprintf (header_file, "};\n\n");
>  
>    fprintf (header_file, "#define PPC_MAXRESTROPNDS 3\n");

Reply via email to