[COMMITTED] MAINTAINERS: Add myself to write after approval

2025-05-23 Thread Kishan Parmar
2025-05-22  Kishan Parmar  

* MAINTAINERS: Add myself to write after approval.
---
 MAINTAINERS | 1 +
 1 file changed, 1 insertion(+)

diff --git a/MAINTAINERS b/MAINTAINERS
index 8993d176c22..ac7e4de112e 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -717,6 +717,7 @@ Maxim Ostapenko chefmax 

 Jeevitha Palanisamy jeevitha
 Patrick Palka   ppalka  
 Seongbae Park   spark   
+Kishan Parmar   kishan  
 Srinath Parvathanenisripar01
 Devang Pateldpatel  
 Andris Pavenis  andris  
-- 
2.43.5



[PATCH v1] rs6000: Restore opaque overload variant for correct diagnostics

2025-05-26 Thread Kishan Parmar
Hi All,

The following patch has been bootstrapped and regtested on powerpc64le-linux.

After r12-5752-gd08236359eb229, a new bif infrastructure was introduced
which stopped using opaque vector types (e.g. opaque_V4SI_type_node)
for overloaded built-in functions, which led to incorrect and
misleading diagnostics when argument types didn’t exactly match.

This patch reinstates the opaque overload variant for entries with
multiple arguments where at least one is a vector, inserting it
at the beginning of each stanza. This helps recover the intended
fallback behavior and ensures clearer, type-generic error reporting.

2025-05-23  Kishan Parmar  

gcc:
PR target/104930
* config/rs6000/rs6000-c.cc (altivec_resolve_overloaded_builtin):
Skip the first overload entry during iteration if it uses opaque type
parameters.
* config/rs6000/rs6000-gen-builtins.cc
(maybe_generate_opaque_variant): New function.
(parse_first_ovld_entry): New function.
(parse_ovld_stanza): call parse_first_ovld_entry.
---
 gcc/config/rs6000/rs6000-c.cc|   9 +-
 gcc/config/rs6000/rs6000-gen-builtins.cc | 180 ++-
 2 files changed, 187 insertions(+), 2 deletions(-)

diff --git a/gcc/config/rs6000/rs6000-c.cc b/gcc/config/rs6000/rs6000-c.cc
index d3b0a566821..6217d585b40 100644
--- a/gcc/config/rs6000/rs6000-c.cc
+++ b/gcc/config/rs6000/rs6000-c.cc
@@ -1972,7 +1972,14 @@ altivec_resolve_overloaded_builtin (location_t loc, tree 
fndecl,
   arg_i++)
{
  tree parmtype = TREE_VALUE (nextparm);
- if (!rs6000_builtin_type_compatible (types[arg_i], parmtype))
+ /* Since we only need opaque vector type for the default
+prototype which is the same as the first instance, we
+only expect to see it in the first instance.  */
+ gcc_assert (instance == 
rs6000_overload_info[adj_fcode].first_instance
+ || parmtype != opaque_V4SI_type_node);
+ if ((instance == rs6000_overload_info[adj_fcode].first_instance
+  && parmtype == opaque_V4SI_type_node)
+ || !rs6000_builtin_type_compatible (types[arg_i], parmtype))
{
  mismatch = true;
  break;
diff --git a/gcc/config/rs6000/rs6000-gen-builtins.cc 
b/gcc/config/rs6000/rs6000-gen-builtins.cc
index f77087e0452..d442b93138e 100644
--- a/gcc/config/rs6000/rs6000-gen-builtins.cc
+++ b/gcc/config/rs6000/rs6000-gen-builtins.cc
@@ -353,6 +353,7 @@ struct typeinfo
   char isunsigned;
   char isbool;
   char ispixel;
+  char isopaque;
   char ispointer;
   basetype base;
   restriction restr;
@@ -579,6 +580,7 @@ static typemap type_map[] =
 { "v4sf",  "V4SF" },
 { "v4si",  "V4SI" },
 { "v8hi",  "V8HI" },
+{ "vop4si","opaque_V4SI" },
 { "vp8hi", "pixel_V8HI" },
   };
 
@@ -1058,6 +1060,7 @@ match_type (typeinfo *typedata, int voidok)
vd  vector double
v256__vector_pair
v512__vector_quad
+   vop vector opaque
 
  For simplicity, We don't support "short int" and "long long int".
  We don't currently support a  of "_Float16".  "signed"
@@ -1496,6 +1499,12 @@ complete_vector_type (typeinfo *typeptr, char *buf, int 
*bufi)
   *bufi += 4;
   return;
 }
+  else if (typeptr->isopaque)
+{
+  memcpy (&buf[*bufi], "op4si", 5);
+  *bufi += 5;
+  return;
+}
   switch (typeptr->base)
 {
 case BT_CHAR:
@@ -1661,7 +1670,8 @@ construct_fntype_id (prototype *protoptr)
  buf[bufi++] = '_';
  if (argptr->info.isconst
  && argptr->info.base == BT_INT
- && !argptr->info.ispointer)
+ && !argptr->info.ispointer
+ && !argptr->info.isopaque)
{
  buf[bufi++] = 'c';
  buf[bufi++] = 'i';
@@ -1969,6 +1979,168 @@ create_bif_order (void)
   rbt_inorder_callback (&bifo_rbt, bifo_rbt.rbt_root, set_bif_order);
 }
 
+/* Attempt to generate an opaque variant if needed and valid.  */
+static void
+maybe_generate_opaque_variant (ovlddata* entry)
+{
+  /* If no vector arg, no need to create opaque variant.  */
+  bool has_vector_arg = false;
+  for (typelist* arg = entry->proto.args; arg; arg = arg->next)
+{
+  if (arg->info.isvector)
+   {
+ has_vector_arg = true;
+ break;
+   }
+}
+
+  if (!has_vector_arg || entry->proto.nargs <= 1)
+return;
+
+  /* Construct the opaque variant.  */
+  ovlddata* opaque_entry = &ovlds[curr_ovld];
+  memcpy (opaque_entry, entry, sizeof (*entry));
+
+  /* Deep-co