qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] Hexagon (gen_tcg_funcs.py): avoid duplicated tcg code on A_CVI_NEW
@ 2022-09-30 20:08 Matheus Tavares Bernardino
  2022-09-30 20:16 ` Richard Henderson
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Matheus Tavares Bernardino @ 2022-09-30 20:08 UTC (permalink / raw)
  To: qemu-devel; +Cc: tsimpson

Hexagon instructions with the A_CVI_NEW attribute produce a vector value
that can be used in the same packet. The python function responsible for
generating code for such instructions has a typo ("if" instead of
"elif"), which makes genptr_dst_write_ext() be executed twice, thus also
generating the same tcg code twice. Fortunately, this doesn't cause any
problems for correctness, but it is less efficient than it could be. Fix
it by using an "elif" and avoiding the unnecessary extra code gen.

Signed-off-by: Matheus Tavares Bernardino <quic_mathbern@quicinc.com>
---
 target/hexagon/gen_tcg_funcs.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/target/hexagon/gen_tcg_funcs.py b/target/hexagon/gen_tcg_funcs.py
index d72c689ad7..6dea02b0b9 100755
--- a/target/hexagon/gen_tcg_funcs.py
+++ b/target/hexagon/gen_tcg_funcs.py
@@ -548,7 +548,7 @@ def genptr_dst_write_opn(f,regtype, regid, tag):
         if (hex_common.is_hvx_reg(regtype)):
             if (hex_common.is_new_result(tag)):
                 genptr_dst_write_ext(f, tag, regtype, regid, "EXT_NEW")
-            if (hex_common.is_tmp_result(tag)):
+            elif (hex_common.is_tmp_result(tag)):
                 genptr_dst_write_ext(f, tag, regtype, regid, "EXT_TMP")
             else:
                 genptr_dst_write_ext(f, tag, regtype, regid, "EXT_DFL")
-- 
2.37.2



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

* Re: [PATCH] Hexagon (gen_tcg_funcs.py): avoid duplicated tcg code on A_CVI_NEW
  2022-09-30 20:08 [PATCH] Hexagon (gen_tcg_funcs.py): avoid duplicated tcg code on A_CVI_NEW Matheus Tavares Bernardino
@ 2022-09-30 20:16 ` Richard Henderson
  2022-09-30 21:52 ` Taylor Simpson
  2022-10-03 14:25 ` Philippe Mathieu-Daudé via
  2 siblings, 0 replies; 4+ messages in thread
From: Richard Henderson @ 2022-09-30 20:16 UTC (permalink / raw)
  To: Matheus Tavares Bernardino, qemu-devel; +Cc: tsimpson

On 9/30/22 13:08, Matheus Tavares Bernardino wrote:
> Hexagon instructions with the A_CVI_NEW attribute produce a vector value
> that can be used in the same packet. The python function responsible for
> generating code for such instructions has a typo ("if" instead of
> "elif"), which makes genptr_dst_write_ext() be executed twice, thus also
> generating the same tcg code twice. Fortunately, this doesn't cause any
> problems for correctness, but it is less efficient than it could be. Fix
> it by using an "elif" and avoiding the unnecessary extra code gen.
> 
> Signed-off-by: Matheus Tavares Bernardino <quic_mathbern@quicinc.com>
> ---
>   target/hexagon/gen_tcg_funcs.py | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/target/hexagon/gen_tcg_funcs.py b/target/hexagon/gen_tcg_funcs.py
> index d72c689ad7..6dea02b0b9 100755
> --- a/target/hexagon/gen_tcg_funcs.py
> +++ b/target/hexagon/gen_tcg_funcs.py
> @@ -548,7 +548,7 @@ def genptr_dst_write_opn(f,regtype, regid, tag):
>           if (hex_common.is_hvx_reg(regtype)):
>               if (hex_common.is_new_result(tag)):
>                   genptr_dst_write_ext(f, tag, regtype, regid, "EXT_NEW")
> -            if (hex_common.is_tmp_result(tag)):
> +            elif (hex_common.is_tmp_result(tag)):
>                   genptr_dst_write_ext(f, tag, regtype, regid, "EXT_TMP")
>               else:
>                   genptr_dst_write_ext(f, tag, regtype, regid, "EXT_DFL")

Reviewed-by: Richard Henderson <richard.henderson@linaro.org>


r~


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

* RE: [PATCH] Hexagon (gen_tcg_funcs.py): avoid duplicated tcg code on A_CVI_NEW
  2022-09-30 20:08 [PATCH] Hexagon (gen_tcg_funcs.py): avoid duplicated tcg code on A_CVI_NEW Matheus Tavares Bernardino
  2022-09-30 20:16 ` Richard Henderson
@ 2022-09-30 21:52 ` Taylor Simpson
  2022-10-03 14:25 ` Philippe Mathieu-Daudé via
  2 siblings, 0 replies; 4+ messages in thread
From: Taylor Simpson @ 2022-09-30 21:52 UTC (permalink / raw)
  To: Matheus Bernardino (QUIC), qemu-devel@nongnu.org



> -----Original Message-----
> From: Matheus Tavares Bernardino <quic_mathbern@quicinc.com>
> Sent: Friday, September 30, 2022 3:08 PM
> To: qemu-devel@nongnu.org
> Cc: Taylor Simpson <tsimpson@quicinc.com>
> Subject: [PATCH] Hexagon (gen_tcg_funcs.py): avoid duplicated tcg code on
> A_CVI_NEW
> 
> Hexagon instructions with the A_CVI_NEW attribute produce a vector value
> that can be used in the same packet. The python function responsible for
> generating code for such instructions has a typo ("if" instead of "elif"), which
> makes genptr_dst_write_ext() be executed twice, thus also generating the
> same tcg code twice. Fortunately, this doesn't cause any problems for
> correctness, but it is less efficient than it could be. Fix it by using an "elif" and
> avoiding the unnecessary extra code gen.
> 
> Signed-off-by: Matheus Tavares Bernardino <quic_mathbern@quicinc.com>
> ---
>  target/hexagon/gen_tcg_funcs.py | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/target/hexagon/gen_tcg_funcs.py
> b/target/hexagon/gen_tcg_funcs.py index d72c689ad7..6dea02b0b9 100755
> --- a/target/hexagon/gen_tcg_funcs.py
> +++ b/target/hexagon/gen_tcg_funcs.py
> @@ -548,7 +548,7 @@ def genptr_dst_write_opn(f,regtype, regid, tag):
>          if (hex_common.is_hvx_reg(regtype)):
>              if (hex_common.is_new_result(tag)):
>                  genptr_dst_write_ext(f, tag, regtype, regid, "EXT_NEW")
> -            if (hex_common.is_tmp_result(tag)):
> +            elif (hex_common.is_tmp_result(tag)):
>                  genptr_dst_write_ext(f, tag, regtype, regid, "EXT_TMP")
>              else:
>                  genptr_dst_write_ext(f, tag, regtype, regid, "EXT_DFL")

Reviewed-by: Taylor Simpson <tsimpson@quicinc.com>


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

* Re: [PATCH] Hexagon (gen_tcg_funcs.py): avoid duplicated tcg code on A_CVI_NEW
  2022-09-30 20:08 [PATCH] Hexagon (gen_tcg_funcs.py): avoid duplicated tcg code on A_CVI_NEW Matheus Tavares Bernardino
  2022-09-30 20:16 ` Richard Henderson
  2022-09-30 21:52 ` Taylor Simpson
@ 2022-10-03 14:25 ` Philippe Mathieu-Daudé via
  2 siblings, 0 replies; 4+ messages in thread
From: Philippe Mathieu-Daudé via @ 2022-10-03 14:25 UTC (permalink / raw)
  To: Matheus Tavares Bernardino, qemu-devel; +Cc: tsimpson

On 30/9/22 22:08, Matheus Tavares Bernardino wrote:
> Hexagon instructions with the A_CVI_NEW attribute produce a vector value
> that can be used in the same packet. The python function responsible for
> generating code for such instructions has a typo ("if" instead of
> "elif"), which makes genptr_dst_write_ext() be executed twice, thus also
> generating the same tcg code twice. Fortunately, this doesn't cause any
> problems for correctness, but it is less efficient than it could be. Fix
> it by using an "elif" and avoiding the unnecessary extra code gen.
> 
> Signed-off-by: Matheus Tavares Bernardino <quic_mathbern@quicinc.com>
> ---
>   target/hexagon/gen_tcg_funcs.py | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)

Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>



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

end of thread, other threads:[~2022-10-03 14:35 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-09-30 20:08 [PATCH] Hexagon (gen_tcg_funcs.py): avoid duplicated tcg code on A_CVI_NEW Matheus Tavares Bernardino
2022-09-30 20:16 ` Richard Henderson
2022-09-30 21:52 ` Taylor Simpson
2022-10-03 14:25 ` Philippe Mathieu-Daudé via

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 NNTP newsgroup(s).