public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] bpf: fixed template for neg (added second operand)
@ 2023-07-21 16:43 Cupertino Miranda
  2023-07-21 16:55 ` [PATCH v2] " Cupertino Miranda
  2023-07-21 16:57 ` [PATCH] " David Faust
  0 siblings, 2 replies; 6+ messages in thread
From: Cupertino Miranda @ 2023-07-21 16:43 UTC (permalink / raw)
  To: gcc-patches; +Cc: elena.zannoni, jose.marchesi, david.faust, Cupertino Miranda

gcc/ChangeLog:

	* config/bpf/bpf.md: fixed template for neg instruction.
---
 gcc/config/bpf/bpf.md | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/gcc/config/bpf/bpf.md b/gcc/config/bpf/bpf.md
index 329f62f55c33..bb414d8a4428 100644
--- a/gcc/config/bpf/bpf.md
+++ b/gcc/config/bpf/bpf.md
@@ -142,7 +142,7 @@
   [(set (match_operand:AM 0 "register_operand" "=r")
         (neg:AM (match_operand:AM 1 "register_operand" " 0")))]
   ""
-  "neg<msuffix>\t%0"
+  "neg<msuffix>\t%0,%1"
   [(set_attr "type" "<mtype>")])
 
 ;;; Multiplication
-- 
2.30.2


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

* Re: [PATCH v2] bpf: fixed template for neg (added second operand)
  2023-07-21 16:43 [PATCH] bpf: fixed template for neg (added second operand) Cupertino Miranda
@ 2023-07-21 16:55 ` Cupertino Miranda
  2023-07-21 17:18   ` [PATCH v3] " Cupertino Miranda
  2023-07-21 16:57 ` [PATCH] " David Faust
  1 sibling, 1 reply; 6+ messages in thread
From: Cupertino Miranda @ 2023-07-21 16:55 UTC (permalink / raw)
  To: gcc-patches; +Cc: elena.zannoni, jose.marchesi, david.faust, Cupertino Miranda

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: v2-0001-bpf-fixed-template-for-neg-added-second-operand.patch --]
[-- Type: text/x-diff, Size: 988 bytes --]

From 9db2044c1d20bd9f05acf3c910ad0ffc9d5fda8f Mon Sep 17 00:00:00 2001
From: Cupertino Miranda <cupertino.miranda@oracle.com>
Date: Fri, 21 Jul 2023 17:40:07 +0100
Subject: [PATCH v2] bpf: fixed template for neg (added second operand)

gcc/ChangeLog:

	* config/bpf/bpf.md: fixed template for neg instruction.
---
 gcc/config/bpf/bpf.md | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/gcc/config/bpf/bpf.md b/gcc/config/bpf/bpf.md
index 329f62f55c33..2ba862f3935a 100644
--- a/gcc/config/bpf/bpf.md
+++ b/gcc/config/bpf/bpf.md
@@ -139,10 +139,10 @@
 
 ;;; Negation
 (define_insn "neg<AM:mode>2"
-  [(set (match_operand:AM 0 "register_operand" "=r")
-        (neg:AM (match_operand:AM 1 "register_operand" " 0")))]
+  [(set (match_operand:AM         0 "register_operand" "=r")
+        (neg:AM (match_operand:AM 1 "register_operand" " r")))]
   ""
-  "neg<msuffix>\t%0"
+  "neg<msuffix>\t%0,%1"
   [(set_attr "type" "<mtype>")])
 
 ;;; Multiplication
-- 
2.30.2


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

* Re: [PATCH] bpf: fixed template for neg (added second operand)
  2023-07-21 16:43 [PATCH] bpf: fixed template for neg (added second operand) Cupertino Miranda
  2023-07-21 16:55 ` [PATCH v2] " Cupertino Miranda
@ 2023-07-21 16:57 ` David Faust
  1 sibling, 0 replies; 6+ messages in thread
From: David Faust @ 2023-07-21 16:57 UTC (permalink / raw)
  To: Cupertino Miranda; +Cc: elena.zannoni, jose.marchesi, gcc-patches

Hi Cupertino,

On 7/21/23 09:43, Cupertino Miranda wrote:
> gcc/ChangeLog:
> 
> 	* config/bpf/bpf.md: fixed template for neg instruction.
> ---
>  gcc/config/bpf/bpf.md | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/gcc/config/bpf/bpf.md b/gcc/config/bpf/bpf.md
> index 329f62f55c33..bb414d8a4428 100644
> --- a/gcc/config/bpf/bpf.md
> +++ b/gcc/config/bpf/bpf.md
> @@ -142,7 +142,7 @@
>    [(set (match_operand:AM 0 "register_operand" "=r")
>          (neg:AM (match_operand:AM 1 "register_operand" " 0")))]
>    ""
> -  "neg<msuffix>\t%0"
> +  "neg<msuffix>\t%0,%1"
>    [(set_attr "type" "<mtype>")])

I think you will need to update the constraint for the second
operand as well; it could be any register, or a 32-bit immediate.

>  
>  ;;; Multiplication

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

* Re: [PATCH v3] bpf: fixed template for neg (added second operand)
  2023-07-21 16:55 ` [PATCH v2] " Cupertino Miranda
@ 2023-07-21 17:18   ` Cupertino Miranda
  2023-07-21 18:06     ` Jose E. Marchesi
  0 siblings, 1 reply; 6+ messages in thread
From: Cupertino Miranda @ 2023-07-21 17:18 UTC (permalink / raw)
  To: gcc-patches; +Cc: elena.zannoni, jose.marchesi, david.faust, Cupertino Miranda

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: v3-0001-bpf-fixed-template-for-neg-added-second-operand.patch --]
[-- Type: text/x-diff, Size: 992 bytes --]

From 7756a4becd1934e55d6d14ac4a9fd6d408a4797b Mon Sep 17 00:00:00 2001
From: Cupertino Miranda <cupertino.miranda@oracle.com>
Date: Fri, 21 Jul 2023 17:40:07 +0100
Subject: [PATCH v3] bpf: fixed template for neg (added second operand)

gcc/ChangeLog:

	* config/bpf/bpf.md: fixed template for neg instruction.
---
 gcc/config/bpf/bpf.md | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/gcc/config/bpf/bpf.md b/gcc/config/bpf/bpf.md
index 329f62f55c33..adf11e151df1 100644
--- a/gcc/config/bpf/bpf.md
+++ b/gcc/config/bpf/bpf.md
@@ -139,10 +139,10 @@
 
 ;;; Negation
 (define_insn "neg<AM:mode>2"
-  [(set (match_operand:AM 0 "register_operand" "=r")
-        (neg:AM (match_operand:AM 1 "register_operand" " 0")))]
+  [(set (match_operand:AM         0 "register_operand" "=r,r")
+        (neg:AM (match_operand:AM 1 "register_operand" " r,I")))]
   ""
-  "neg<msuffix>\t%0"
+  "neg<msuffix>\t%0,%1"
   [(set_attr "type" "<mtype>")])
 
 ;;; Multiplication
-- 
2.30.2


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

* Re: [PATCH v3] bpf: fixed template for neg (added second operand)
  2023-07-21 17:18   ` [PATCH v3] " Cupertino Miranda
@ 2023-07-21 18:06     ` Jose E. Marchesi
  2023-07-21 18:40       ` [COMMITTED] " Cupertino Miranda
  0 siblings, 1 reply; 6+ messages in thread
From: Jose E. Marchesi @ 2023-07-21 18:06 UTC (permalink / raw)
  To: Cupertino Miranda; +Cc: gcc-patches, elena.zannoni, david.faust


Hi Cuper.
OK.  Thanks!

> From 7756a4becd1934e55d6d14ac4a9fd6d408a4797b Mon Sep 17 00:00:00 2001
> From: Cupertino Miranda <cupertino.miranda@oracle.com>
> Date: Fri, 21 Jul 2023 17:40:07 +0100
> Subject: [PATCH v3] bpf: fixed template for neg (added second operand)
>
> gcc/ChangeLog:
>
> 	* config/bpf/bpf.md: fixed template for neg instruction.
> ---
>  gcc/config/bpf/bpf.md | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/gcc/config/bpf/bpf.md b/gcc/config/bpf/bpf.md
> index 329f62f55c33..adf11e151df1 100644
> --- a/gcc/config/bpf/bpf.md
> +++ b/gcc/config/bpf/bpf.md
> @@ -139,10 +139,10 @@
>  
>  ;;; Negation
>  (define_insn "neg<AM:mode>2"
> -  [(set (match_operand:AM 0 "register_operand" "=r")
> -        (neg:AM (match_operand:AM 1 "register_operand" " 0")))]
> +  [(set (match_operand:AM         0 "register_operand" "=r,r")
> +        (neg:AM (match_operand:AM 1 "register_operand" " r,I")))]
>    ""
> -  "neg<msuffix>\t%0"
> +  "neg<msuffix>\t%0,%1"
>    [(set_attr "type" "<mtype>")])
>  
>  ;;; Multiplication

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

* Re: [COMMITTED] bpf: fixed template for neg (added second operand)
  2023-07-21 18:06     ` Jose E. Marchesi
@ 2023-07-21 18:40       ` Cupertino Miranda
  0 siblings, 0 replies; 6+ messages in thread
From: Cupertino Miranda @ 2023-07-21 18:40 UTC (permalink / raw)
  To: Jose E. Marchesi; +Cc: gcc-patches, elena.zannoni, david.faust


This patch fixes define_insn for "neg" to support 2 operands.
Initial implementation assumed the format "neg %0" while the instruction
allows both a destination and source operands. The second operand can
either be a register or an immediate value.

gcc/ChangeLog:

	* config/bpf/bpf.md: fixed template for neg instruction.
---
 gcc/config/bpf/bpf.md | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/gcc/config/bpf/bpf.md b/gcc/config/bpf/bpf.md
index 329f62f55c33..adf11e151df1 100644
--- a/gcc/config/bpf/bpf.md
+++ b/gcc/config/bpf/bpf.md
@@ -139,10 +139,10 @@

 ;;; Negation
 (define_insn "neg<AM:mode>2"
-  [(set (match_operand:AM 0 "register_operand" "=r")
-        (neg:AM (match_operand:AM 1 "register_operand" " 0")))]
+  [(set (match_operand:AM         0 "register_operand" "=r,r")
+        (neg:AM (match_operand:AM 1 "register_operand" " r,I")))]
   ""
-  "neg<msuffix>\t%0"
+  "neg<msuffix>\t%0,%1"
   [(set_attr "type" "<mtype>")])

 ;;; Multiplication
--
2.38.1

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

end of thread, other threads:[~2023-07-21 18:40 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-07-21 16:43 [PATCH] bpf: fixed template for neg (added second operand) Cupertino Miranda
2023-07-21 16:55 ` [PATCH v2] " Cupertino Miranda
2023-07-21 17:18   ` [PATCH v3] " Cupertino Miranda
2023-07-21 18:06     ` Jose E. Marchesi
2023-07-21 18:40       ` [COMMITTED] " Cupertino Miranda
2023-07-21 16:57 ` [PATCH] " David Faust

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).