public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH V2] RISC-V: Add _mu C++ overloaded intrinsics for load && viota && vid
@ 2023-06-02  2:04 juzhe.zhong
  2023-06-02  7:25 ` Kito Cheng
  0 siblings, 1 reply; 3+ messages in thread
From: juzhe.zhong @ 2023-06-02  2:04 UTC (permalink / raw)
  To: gcc-patches
  Cc: kito.cheng, kito.cheng, palmer, palmer, jeffreyalaw, rdapp.gcc,
	best124612, Juzhe-Zhong

From: Juzhe-Zhong <juzhe.zhong@rivai.ai>

Base on these:
https://github.com/riscv-non-isa/rvv-intrinsic-doc/issues/232
https://github.com/riscv-non-isa/rvv-intrinsic-doc/pull/233

Add _mu C++ overloaded intrinsics for load && viota && vid.

Co-authored-by: KuanLin Chen <best124612@gmail.com>

gcc/ChangeLog:

        * config/riscv/riscv-vector-builtins-bases.cc: Add _mu overloaded intrinsics.
        * config/riscv/riscv-vector-builtins-shapes.cc (struct fault_load_def): Ditto.

---
 gcc/config/riscv/riscv-vector-builtins-bases.cc | 17 +++++++++++------
 .../riscv/riscv-vector-builtins-shapes.cc       |  5 ++---
 2 files changed, 13 insertions(+), 9 deletions(-)

diff --git a/gcc/config/riscv/riscv-vector-builtins-bases.cc b/gcc/config/riscv/riscv-vector-builtins-bases.cc
index 3f92084929d..09870c327fa 100644
--- a/gcc/config/riscv/riscv-vector-builtins-bases.cc
+++ b/gcc/config/riscv/riscv-vector-builtins-bases.cc
@@ -164,7 +164,7 @@ public:
   {
     if (STORE_P || LST_TYPE == LST_INDEXED)
       return true;
-    return pred != PRED_TYPE_none && pred != PRED_TYPE_mu;
+    return pred != PRED_TYPE_none;
   }
 
   rtx expand (function_expander &e) const override
@@ -967,7 +967,7 @@ public:
   bool can_be_overloaded_p (enum predication_type_index pred) const override
   {
     return pred == PRED_TYPE_tu || pred == PRED_TYPE_tum
-	   || pred == PRED_TYPE_tumu;
+	   || pred == PRED_TYPE_tumu || pred == PRED_TYPE_mu;
   }
 
   rtx expand (function_expander &e) const override
@@ -983,7 +983,7 @@ public:
   bool can_be_overloaded_p (enum predication_type_index pred) const override
   {
     return pred == PRED_TYPE_tu || pred == PRED_TYPE_tum
-	   || pred == PRED_TYPE_tumu;
+	   || pred == PRED_TYPE_tumu || pred == PRED_TYPE_mu;
   }
 
   rtx expand (function_expander &e) const override
@@ -1715,6 +1715,11 @@ public:
     return CP_READ_MEMORY | CP_WRITE_CSR;
   }
 
+  bool can_be_overloaded_p (enum predication_type_index pred) const override
+  {
+    return pred != PRED_TYPE_none;
+  }
+
   gimple *fold (gimple_folder &f) const override
   {
     return fold_fault_load (f);
@@ -1753,7 +1758,7 @@ public:
 
   bool can_be_overloaded_p (enum predication_type_index pred) const override
   {
-    return pred != PRED_TYPE_none && pred != PRED_TYPE_mu;
+    return pred != PRED_TYPE_none;
   }
 
   rtx expand (function_expander &e) const override
@@ -1798,7 +1803,7 @@ public:
 
   bool can_be_overloaded_p (enum predication_type_index pred) const override
   {
-    return pred != PRED_TYPE_none && pred != PRED_TYPE_mu;
+    return pred != PRED_TYPE_none;
   }
 
   rtx expand (function_expander &e) const override
@@ -1888,7 +1893,7 @@ public:
 
   bool can_be_overloaded_p (enum predication_type_index pred) const override
   {
-    return pred != PRED_TYPE_none && pred != PRED_TYPE_mu;
+    return pred != PRED_TYPE_none;
   }
 
   gimple *fold (gimple_folder &f) const override
diff --git a/gcc/config/riscv/riscv-vector-builtins-shapes.cc b/gcc/config/riscv/riscv-vector-builtins-shapes.cc
index 76262f07ce4..c8daae01f91 100644
--- a/gcc/config/riscv/riscv-vector-builtins-shapes.cc
+++ b/gcc/config/riscv/riscv-vector-builtins-shapes.cc
@@ -550,9 +550,8 @@ struct fault_load_def : public build_base
   char *get_name (function_builder &b, const function_instance &instance,
 		  bool overloaded_p) const override
   {
-    if (overloaded_p)
-      if (instance.pred == PRED_TYPE_none || instance.pred == PRED_TYPE_mu)
-	return nullptr;
+    if (overloaded_p && !instance.base->can_be_overloaded_p (instance.pred))
+      return nullptr;
     tree type = builtin_types[instance.type.index].vector;
     machine_mode mode = TYPE_MODE (type);
     int sew = GET_MODE_BITSIZE (GET_MODE_INNER (mode));
-- 
2.36.1


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH V2] RISC-V: Add _mu C++ overloaded intrinsics for load && viota && vid
  2023-06-02  2:04 [PATCH V2] RISC-V: Add _mu C++ overloaded intrinsics for load && viota && vid juzhe.zhong
@ 2023-06-02  7:25 ` Kito Cheng
  2023-06-02  7:28   ` Li, Pan2
  0 siblings, 1 reply; 3+ messages in thread
From: Kito Cheng @ 2023-06-02  7:25 UTC (permalink / raw)
  To: juzhe.zhong
  Cc: gcc-patches, kito.cheng, palmer, palmer, jeffreyalaw, rdapp.gcc,
	best124612

LGTM, thanks for fixing this :)

On Fri, Jun 2, 2023 at 10:05 AM <juzhe.zhong@rivai.ai> wrote:
>
> From: Juzhe-Zhong <juzhe.zhong@rivai.ai>
>
> Base on these:
> https://github.com/riscv-non-isa/rvv-intrinsic-doc/issues/232
> https://github.com/riscv-non-isa/rvv-intrinsic-doc/pull/233
>
> Add _mu C++ overloaded intrinsics for load && viota && vid.
>
> Co-authored-by: KuanLin Chen <best124612@gmail.com>
>
> gcc/ChangeLog:
>
>         * config/riscv/riscv-vector-builtins-bases.cc: Add _mu overloaded intrinsics.
>         * config/riscv/riscv-vector-builtins-shapes.cc (struct fault_load_def): Ditto.
>
> ---
>  gcc/config/riscv/riscv-vector-builtins-bases.cc | 17 +++++++++++------
>  .../riscv/riscv-vector-builtins-shapes.cc       |  5 ++---
>  2 files changed, 13 insertions(+), 9 deletions(-)
>
> diff --git a/gcc/config/riscv/riscv-vector-builtins-bases.cc b/gcc/config/riscv/riscv-vector-builtins-bases.cc
> index 3f92084929d..09870c327fa 100644
> --- a/gcc/config/riscv/riscv-vector-builtins-bases.cc
> +++ b/gcc/config/riscv/riscv-vector-builtins-bases.cc
> @@ -164,7 +164,7 @@ public:
>    {
>      if (STORE_P || LST_TYPE == LST_INDEXED)
>        return true;
> -    return pred != PRED_TYPE_none && pred != PRED_TYPE_mu;
> +    return pred != PRED_TYPE_none;
>    }
>
>    rtx expand (function_expander &e) const override
> @@ -967,7 +967,7 @@ public:
>    bool can_be_overloaded_p (enum predication_type_index pred) const override
>    {
>      return pred == PRED_TYPE_tu || pred == PRED_TYPE_tum
> -          || pred == PRED_TYPE_tumu;
> +          || pred == PRED_TYPE_tumu || pred == PRED_TYPE_mu;
>    }
>
>    rtx expand (function_expander &e) const override
> @@ -983,7 +983,7 @@ public:
>    bool can_be_overloaded_p (enum predication_type_index pred) const override
>    {
>      return pred == PRED_TYPE_tu || pred == PRED_TYPE_tum
> -          || pred == PRED_TYPE_tumu;
> +          || pred == PRED_TYPE_tumu || pred == PRED_TYPE_mu;
>    }
>
>    rtx expand (function_expander &e) const override
> @@ -1715,6 +1715,11 @@ public:
>      return CP_READ_MEMORY | CP_WRITE_CSR;
>    }
>
> +  bool can_be_overloaded_p (enum predication_type_index pred) const override
> +  {
> +    return pred != PRED_TYPE_none;
> +  }
> +
>    gimple *fold (gimple_folder &f) const override
>    {
>      return fold_fault_load (f);
> @@ -1753,7 +1758,7 @@ public:
>
>    bool can_be_overloaded_p (enum predication_type_index pred) const override
>    {
> -    return pred != PRED_TYPE_none && pred != PRED_TYPE_mu;
> +    return pred != PRED_TYPE_none;
>    }
>
>    rtx expand (function_expander &e) const override
> @@ -1798,7 +1803,7 @@ public:
>
>    bool can_be_overloaded_p (enum predication_type_index pred) const override
>    {
> -    return pred != PRED_TYPE_none && pred != PRED_TYPE_mu;
> +    return pred != PRED_TYPE_none;
>    }
>
>    rtx expand (function_expander &e) const override
> @@ -1888,7 +1893,7 @@ public:
>
>    bool can_be_overloaded_p (enum predication_type_index pred) const override
>    {
> -    return pred != PRED_TYPE_none && pred != PRED_TYPE_mu;
> +    return pred != PRED_TYPE_none;
>    }
>
>    gimple *fold (gimple_folder &f) const override
> diff --git a/gcc/config/riscv/riscv-vector-builtins-shapes.cc b/gcc/config/riscv/riscv-vector-builtins-shapes.cc
> index 76262f07ce4..c8daae01f91 100644
> --- a/gcc/config/riscv/riscv-vector-builtins-shapes.cc
> +++ b/gcc/config/riscv/riscv-vector-builtins-shapes.cc
> @@ -550,9 +550,8 @@ struct fault_load_def : public build_base
>    char *get_name (function_builder &b, const function_instance &instance,
>                   bool overloaded_p) const override
>    {
> -    if (overloaded_p)
> -      if (instance.pred == PRED_TYPE_none || instance.pred == PRED_TYPE_mu)
> -       return nullptr;
> +    if (overloaded_p && !instance.base->can_be_overloaded_p (instance.pred))
> +      return nullptr;
>      tree type = builtin_types[instance.type.index].vector;
>      machine_mode mode = TYPE_MODE (type);
>      int sew = GET_MODE_BITSIZE (GET_MODE_INNER (mode));
> --
> 2.36.1
>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* RE: [PATCH V2] RISC-V: Add _mu C++ overloaded intrinsics for load && viota && vid
  2023-06-02  7:25 ` Kito Cheng
@ 2023-06-02  7:28   ` Li, Pan2
  0 siblings, 0 replies; 3+ messages in thread
From: Li, Pan2 @ 2023-06-02  7:28 UTC (permalink / raw)
  To: Kito Cheng, juzhe.zhong
  Cc: gcc-patches, kito.cheng, palmer, palmer, jeffreyalaw, rdapp.gcc,
	best124612

Committed, thanks Kito.

Pan

-----Original Message-----
From: Gcc-patches <gcc-patches-bounces+pan2.li=intel.com@gcc.gnu.org> On Behalf Of Kito Cheng via Gcc-patches
Sent: Friday, June 2, 2023 3:25 PM
To: juzhe.zhong@rivai.ai
Cc: gcc-patches@gcc.gnu.org; kito.cheng@sifive.com; palmer@dabbelt.com; palmer@rivosinc.com; jeffreyalaw@gmail.com; rdapp.gcc@gmail.com; best124612@gmail.com
Subject: Re: [PATCH V2] RISC-V: Add _mu C++ overloaded intrinsics for load && viota && vid

LGTM, thanks for fixing this :)

On Fri, Jun 2, 2023 at 10:05 AM <juzhe.zhong@rivai.ai> wrote:
>
> From: Juzhe-Zhong <juzhe.zhong@rivai.ai>
>
> Base on these:
> https://github.com/riscv-non-isa/rvv-intrinsic-doc/issues/232
> https://github.com/riscv-non-isa/rvv-intrinsic-doc/pull/233
>
> Add _mu C++ overloaded intrinsics for load && viota && vid.
>
> Co-authored-by: KuanLin Chen <best124612@gmail.com>
>
> gcc/ChangeLog:
>
>         * config/riscv/riscv-vector-builtins-bases.cc: Add _mu overloaded intrinsics.
>         * config/riscv/riscv-vector-builtins-shapes.cc (struct fault_load_def): Ditto.
>
> ---
>  gcc/config/riscv/riscv-vector-builtins-bases.cc | 17 +++++++++++------
>  .../riscv/riscv-vector-builtins-shapes.cc       |  5 ++---
>  2 files changed, 13 insertions(+), 9 deletions(-)
>
> diff --git a/gcc/config/riscv/riscv-vector-builtins-bases.cc 
> b/gcc/config/riscv/riscv-vector-builtins-bases.cc
> index 3f92084929d..09870c327fa 100644
> --- a/gcc/config/riscv/riscv-vector-builtins-bases.cc
> +++ b/gcc/config/riscv/riscv-vector-builtins-bases.cc
> @@ -164,7 +164,7 @@ public:
>    {
>      if (STORE_P || LST_TYPE == LST_INDEXED)
>        return true;
> -    return pred != PRED_TYPE_none && pred != PRED_TYPE_mu;
> +    return pred != PRED_TYPE_none;
>    }
>
>    rtx expand (function_expander &e) const override @@ -967,7 +967,7 
> @@ public:
>    bool can_be_overloaded_p (enum predication_type_index pred) const override
>    {
>      return pred == PRED_TYPE_tu || pred == PRED_TYPE_tum
> -          || pred == PRED_TYPE_tumu;
> +          || pred == PRED_TYPE_tumu || pred == PRED_TYPE_mu;
>    }
>
>    rtx expand (function_expander &e) const override @@ -983,7 +983,7 
> @@ public:
>    bool can_be_overloaded_p (enum predication_type_index pred) const override
>    {
>      return pred == PRED_TYPE_tu || pred == PRED_TYPE_tum
> -          || pred == PRED_TYPE_tumu;
> +          || pred == PRED_TYPE_tumu || pred == PRED_TYPE_mu;
>    }
>
>    rtx expand (function_expander &e) const override @@ -1715,6 
> +1715,11 @@ public:
>      return CP_READ_MEMORY | CP_WRITE_CSR;
>    }
>
> +  bool can_be_overloaded_p (enum predication_type_index pred) const 
> + override  {
> +    return pred != PRED_TYPE_none;
> +  }
> +
>    gimple *fold (gimple_folder &f) const override
>    {
>      return fold_fault_load (f);
> @@ -1753,7 +1758,7 @@ public:
>
>    bool can_be_overloaded_p (enum predication_type_index pred) const override
>    {
> -    return pred != PRED_TYPE_none && pred != PRED_TYPE_mu;
> +    return pred != PRED_TYPE_none;
>    }
>
>    rtx expand (function_expander &e) const override @@ -1798,7 +1803,7 
> @@ public:
>
>    bool can_be_overloaded_p (enum predication_type_index pred) const override
>    {
> -    return pred != PRED_TYPE_none && pred != PRED_TYPE_mu;
> +    return pred != PRED_TYPE_none;
>    }
>
>    rtx expand (function_expander &e) const override @@ -1888,7 +1893,7 
> @@ public:
>
>    bool can_be_overloaded_p (enum predication_type_index pred) const override
>    {
> -    return pred != PRED_TYPE_none && pred != PRED_TYPE_mu;
> +    return pred != PRED_TYPE_none;
>    }
>
>    gimple *fold (gimple_folder &f) const override diff --git 
> a/gcc/config/riscv/riscv-vector-builtins-shapes.cc 
> b/gcc/config/riscv/riscv-vector-builtins-shapes.cc
> index 76262f07ce4..c8daae01f91 100644
> --- a/gcc/config/riscv/riscv-vector-builtins-shapes.cc
> +++ b/gcc/config/riscv/riscv-vector-builtins-shapes.cc
> @@ -550,9 +550,8 @@ struct fault_load_def : public build_base
>    char *get_name (function_builder &b, const function_instance &instance,
>                   bool overloaded_p) const override
>    {
> -    if (overloaded_p)
> -      if (instance.pred == PRED_TYPE_none || instance.pred == PRED_TYPE_mu)
> -       return nullptr;
> +    if (overloaded_p && !instance.base->can_be_overloaded_p (instance.pred))
> +      return nullptr;
>      tree type = builtin_types[instance.type.index].vector;
>      machine_mode mode = TYPE_MODE (type);
>      int sew = GET_MODE_BITSIZE (GET_MODE_INNER (mode));
> --
> 2.36.1
>

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2023-06-02  7:29 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-06-02  2:04 [PATCH V2] RISC-V: Add _mu C++ overloaded intrinsics for load && viota && vid juzhe.zhong
2023-06-02  7:25 ` Kito Cheng
2023-06-02  7:28   ` Li, Pan2

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).