[v4] bpf: fixed template for neg (added second operand)

Message ID 20230721181954.31073-1-cupertino.miranda@oracle.com
State Accepted
Headers
Series [v4] bpf: fixed template for neg (added second operand) |

Checks

Context Check Description
snail/gcc-patch-check success Github commit url

Commit Message

Cupertino Miranda July 21, 2023, 6:19 p.m. UTC
  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(-)
  

Comments

Jose E. Marchesi July 21, 2023, 6:21 p.m. UTC | #1
Better with the commit message.
OK.  Thanks.

> 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
  

Patch

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