[PATCH for-8.0 25/29] tcg/i386: Mark Win64 call-saved vector regs as reserved

Richard Henderson posted 29 patches 3 years, 2 months ago
There is a newer version of this series
[PATCH for-8.0 25/29] tcg/i386: Mark Win64 call-saved vector regs as reserved
Posted by Richard Henderson 3 years, 2 months ago
While we do not include these in tcg_target_reg_alloc_order,
and therefore they ought never be allocated, it seems safer
to mark them reserved as well.

Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
---
 tcg/i386/tcg-target.c.inc | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/tcg/i386/tcg-target.c.inc b/tcg/i386/tcg-target.c.inc
index e38f08bd12..e04818eef6 100644
--- a/tcg/i386/tcg-target.c.inc
+++ b/tcg/i386/tcg-target.c.inc
@@ -4224,6 +4224,19 @@ static void tcg_target_init(TCGContext *s)
 
     s->reserved_regs = 0;
     tcg_regset_set_reg(s->reserved_regs, TCG_REG_CALL_STACK);
+#ifdef _WIN64
+    /* These are call saved, and not we don't save them, so don't use them. */
+    tcg_regset_set_reg(s->reserved_regs, TCG_REG_XMM6);
+    tcg_regset_set_reg(s->reserved_regs, TCG_REG_XMM7);
+    tcg_regset_set_reg(s->reserved_regs, TCG_REG_XMM8);
+    tcg_regset_set_reg(s->reserved_regs, TCG_REG_XMM9);
+    tcg_regset_set_reg(s->reserved_regs, TCG_REG_XMM10);
+    tcg_regset_set_reg(s->reserved_regs, TCG_REG_XMM11);
+    tcg_regset_set_reg(s->reserved_regs, TCG_REG_XMM12);
+    tcg_regset_set_reg(s->reserved_regs, TCG_REG_XMM13);
+    tcg_regset_set_reg(s->reserved_regs, TCG_REG_XMM14);
+    tcg_regset_set_reg(s->reserved_regs, TCG_REG_XMM15);
+#endif
 }
 
 typedef struct {
-- 
2.34.1
Re: [PATCH for-8.0 25/29] tcg/i386: Mark Win64 call-saved vector regs as reserved
Posted by Philippe Mathieu-Daudé 3 years, 2 months ago
On 18/11/22 10:47, Richard Henderson wrote:
> While we do not include these in tcg_target_reg_alloc_order,
> and therefore they ought never be allocated, it seems safer
> to mark them reserved as well.
> 
> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
> ---
>   tcg/i386/tcg-target.c.inc | 13 +++++++++++++
>   1 file changed, 13 insertions(+)
> 
> diff --git a/tcg/i386/tcg-target.c.inc b/tcg/i386/tcg-target.c.inc
> index e38f08bd12..e04818eef6 100644
> --- a/tcg/i386/tcg-target.c.inc
> +++ b/tcg/i386/tcg-target.c.inc
> @@ -4224,6 +4224,19 @@ static void tcg_target_init(TCGContext *s)
>   
>       s->reserved_regs = 0;
>       tcg_regset_set_reg(s->reserved_regs, TCG_REG_CALL_STACK);
> +#ifdef _WIN64
> +    /* These are call saved, and not we don't save them, so don't use them. */

s/not//?

Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>

> +    tcg_regset_set_reg(s->reserved_regs, TCG_REG_XMM6);
> +    tcg_regset_set_reg(s->reserved_regs, TCG_REG_XMM7);
> +    tcg_regset_set_reg(s->reserved_regs, TCG_REG_XMM8);
> +    tcg_regset_set_reg(s->reserved_regs, TCG_REG_XMM9);
> +    tcg_regset_set_reg(s->reserved_regs, TCG_REG_XMM10);
> +    tcg_regset_set_reg(s->reserved_regs, TCG_REG_XMM11);
> +    tcg_regset_set_reg(s->reserved_regs, TCG_REG_XMM12);
> +    tcg_regset_set_reg(s->reserved_regs, TCG_REG_XMM13);
> +    tcg_regset_set_reg(s->reserved_regs, TCG_REG_XMM14);
> +    tcg_regset_set_reg(s->reserved_regs, TCG_REG_XMM15);
> +#endif
>   }
>   
>   typedef struct {