[PATCH v3 1/3] Hexagon (target/hexagon) Pass P0 explicitly to helpers that need it

Taylor Simpson posted 3 patches 9 months, 2 weeks ago
Maintainers: Brian Cain <bcain@quicinc.com>
[PATCH v3 1/3] Hexagon (target/hexagon) Pass P0 explicitly to helpers that need it
Posted by Taylor Simpson 9 months, 2 weeks ago
Rather than reading P0 from the env, pass it explicitly

Signed-off-by: Taylor Simpson <ltaylorsimpson@gmail.com>
Reviewed-by: Anton Johansson <anjo@rev.ng>
Tested-by: Anton Johansson <anjo@rev.ng>
---
 target/hexagon/macros.h      |  4 ++--
 target/hexagon/hex_common.py | 12 +++++++++++-
 2 files changed, 13 insertions(+), 3 deletions(-)

diff --git a/target/hexagon/macros.h b/target/hexagon/macros.h
index 1376d6ccc1..aedc863fab 100644
--- a/target/hexagon/macros.h
+++ b/target/hexagon/macros.h
@@ -1,5 +1,5 @@
 /*
- *  Copyright(c) 2019-2023 Qualcomm Innovation Center, Inc. All Rights Reserved.
+ *  Copyright(c) 2019-2024 Qualcomm Innovation Center, Inc. All Rights Reserved.
  *
  *  This program is free software; you can redistribute it and/or modify
  *  it under the terms of the GNU General Public License as published by
@@ -358,7 +358,7 @@ static inline TCGv gen_read_ireg(TCGv result, TCGv val, int shift)
 #endif
 #define fREAD_PC() (PC)
 
-#define fREAD_P0() (env->pred[0])
+#define fREAD_P0() (P0)
 
 #define fCHECK_PCALIGN(A)
 
diff --git a/target/hexagon/hex_common.py b/target/hexagon/hex_common.py
index 195620c7ec..14dcf261b4 100755
--- a/target/hexagon/hex_common.py
+++ b/target/hexagon/hex_common.py
@@ -1,7 +1,7 @@
 #!/usr/bin/env python3
 
 ##
-##  Copyright(c) 2019-2023 Qualcomm Innovation Center, Inc. All Rights Reserved.
+##  Copyright(c) 2019-2024 Qualcomm Innovation Center, Inc. All Rights Reserved.
 ##
 ##  This program is free software; you can redistribute it and/or modify
 ##  it under the terms of the GNU General Public License as published by
@@ -197,6 +197,10 @@ def get_tagimms():
     return dict(zip(tags, list(map(compute_tag_immediates, tags))))
 
 
+def need_p0(tag):
+    return "A_IMPLICIT_READS_P0" in attribdict[tag]
+
+
 def need_slot(tag):
     if (
         "A_CVI_SCATTER" not in attribdict[tag]
@@ -1118,6 +1122,12 @@ def helper_args(tag, regs, imms):
             "tcg_constant_tl(ctx->next_PC)",
             "target_ulong next_PC"
         ))
+    if need_p0(tag):
+        args.append(HelperArg(
+            "i32",
+            "hex_pred[0]",
+            "uint32_t P0"
+        ))
     if need_slot(tag):
         args.append(HelperArg(
             "i32",
-- 
2.34.1
RE: [PATCH v3 1/3] Hexagon (target/hexagon) Pass P0 explicitly to helpers that need it
Posted by Brian Cain 9 months, 1 week ago

> -----Original Message-----
> From: Taylor Simpson <ltaylorsimpson@gmail.com>
> Sent: Tuesday, February 13, 2024 10:27 PM
> To: qemu-devel@nongnu.org
> Cc: Brian Cain <bcain@quicinc.com>; Matheus Bernardino (QUIC)
> <quic_mathbern@quicinc.com>; Sid Manning <sidneym@quicinc.com>; Marco
> Liebel (QUIC) <quic_mliebel@quicinc.com>; richard.henderson@linaro.org;
> philmd@linaro.org; ale@rev.ng; anjo@rev.ng; ltaylorsimpson@gmail.com
> Subject: [PATCH v3 1/3] Hexagon (target/hexagon) Pass P0 explicitly to helpers
> that need it
> 
> WARNING: This email originated from outside of Qualcomm. Please be wary of
> any links or attachments, and do not enable macros.
> 
> Rather than reading P0 from the env, pass it explicitly
> 
> Signed-off-by: Taylor Simpson <ltaylorsimpson@gmail.com>
> Reviewed-by: Anton Johansson <anjo@rev.ng>
> Tested-by: Anton Johansson <anjo@rev.ng>
> ---

Reviewed-by: Brian Cain <bcain@quicinc.com>

>  target/hexagon/macros.h      |  4 ++--
>  target/hexagon/hex_common.py | 12 +++++++++++-
>  2 files changed, 13 insertions(+), 3 deletions(-)
> 
> diff --git a/target/hexagon/macros.h b/target/hexagon/macros.h
> index 1376d6ccc1..aedc863fab 100644
> --- a/target/hexagon/macros.h
> +++ b/target/hexagon/macros.h
> @@ -1,5 +1,5 @@
>  /*
> - *  Copyright(c) 2019-2023 Qualcomm Innovation Center, Inc. All Rights
> Reserved.
> + *  Copyright(c) 2019-2024 Qualcomm Innovation Center, Inc. All Rights
> Reserved.
>   *
>   *  This program is free software; you can redistribute it and/or modify
>   *  it under the terms of the GNU General Public License as published by
> @@ -358,7 +358,7 @@ static inline TCGv gen_read_ireg(TCGv result, TCGv val,
> int shift)
>  #endif
>  #define fREAD_PC() (PC)
> 
> -#define fREAD_P0() (env->pred[0])
> +#define fREAD_P0() (P0)
> 
>  #define fCHECK_PCALIGN(A)
> 
> diff --git a/target/hexagon/hex_common.py b/target/hexagon/hex_common.py
> index 195620c7ec..14dcf261b4 100755
> --- a/target/hexagon/hex_common.py
> +++ b/target/hexagon/hex_common.py
> @@ -1,7 +1,7 @@
>  #!/usr/bin/env python3
> 
>  ##
> -##  Copyright(c) 2019-2023 Qualcomm Innovation Center, Inc. All Rights
> Reserved.
> +##  Copyright(c) 2019-2024 Qualcomm Innovation Center, Inc. All Rights
> Reserved.
>  ##
>  ##  This program is free software; you can redistribute it and/or modify
>  ##  it under the terms of the GNU General Public License as published by
> @@ -197,6 +197,10 @@ def get_tagimms():
>      return dict(zip(tags, list(map(compute_tag_immediates, tags))))
> 
> 
> +def need_p0(tag):
> +    return "A_IMPLICIT_READS_P0" in attribdict[tag]
> +
> +
>  def need_slot(tag):
>      if (
>          "A_CVI_SCATTER" not in attribdict[tag]
> @@ -1118,6 +1122,12 @@ def helper_args(tag, regs, imms):
>              "tcg_constant_tl(ctx->next_PC)",
>              "target_ulong next_PC"
>          ))
> +    if need_p0(tag):
> +        args.append(HelperArg(
> +            "i32",
> +            "hex_pred[0]",
> +            "uint32_t P0"
> +        ))
>      if need_slot(tag):
>          args.append(HelperArg(
>              "i32",
> --
> 2.34.1