[Qemu-devel] [PATCH v2 3/7] s390x/tcg: Clarify terminology in vec_reg_offset()

David Hildenbrand posted 7 patches 6 years, 8 months ago
Maintainers: Cornelia Huck <cohuck@redhat.com>, Richard Henderson <rth@twiddle.net>, David Hildenbrand <david@redhat.com>
[Qemu-devel] [PATCH v2 3/7] s390x/tcg: Clarify terminology in vec_reg_offset()
Posted by David Hildenbrand 6 years, 8 months ago
We will use s390x speak "Element Size" (es) for MO_8 == 0, MO_16 == 1
... Simple rename of variables.

Reviewed-by: Thomas Huth <thuth@redhat.com>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: David Hildenbrand <david@redhat.com>
---
 target/s390x/translate.c | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/target/s390x/translate.c b/target/s390x/translate.c
index c646e50eb3..5e3955e4d7 100644
--- a/target/s390x/translate.c
+++ b/target/s390x/translate.c
@@ -145,10 +145,11 @@ void s390x_translate_init(void)
     }
 }
 
-static inline int vec_reg_offset(uint8_t reg, uint8_t enr, TCGMemOp size)
+static inline int vec_reg_offset(uint8_t reg, uint8_t enr, TCGMemOp es)
 {
-    const uint8_t es = 1 << size;
-    int offs = enr * es;
+    /* Convert element size (es) - e.g. MO_U8 - to bytes */
+    const uint8_t bytes = 1 << es;
+    int offs = enr * bytes;
 
     g_assert(reg < 32);
     /*
@@ -173,9 +174,9 @@ static inline int vec_reg_offset(uint8_t reg, uint8_t enr, TCGMemOp size)
      * the two 8 byte elements have to be loaded separately. Let's force all
      * 16 byte operations to handle it in a special way.
      */
-    g_assert(size <= MO_64);
+    g_assert(es <= MO_64);
 #ifndef HOST_WORDS_BIGENDIAN
-    offs ^= (8 - es);
+    offs ^= (8 - bytes);
 #endif
     return offs + offsetof(CPUS390XState, vregs[reg][0].d);
 }
-- 
2.17.2


Re: [Qemu-devel] [PATCH v2 3/7] s390x/tcg: Clarify terminology in vec_reg_offset()
Posted by David Hildenbrand 6 years, 8 months ago
On 25.02.19 21:03, David Hildenbrand wrote:
> We will use s390x speak "Element Size" (es) for MO_8 == 0, MO_16 == 1
> ... Simple rename of variables.
> 
> Reviewed-by: Thomas Huth <thuth@redhat.com>
> Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
> Signed-off-by: David Hildenbrand <david@redhat.com>
> ---
>  target/s390x/translate.c | 11 ++++++-----
>  1 file changed, 6 insertions(+), 5 deletions(-)
> 
> diff --git a/target/s390x/translate.c b/target/s390x/translate.c
> index c646e50eb3..5e3955e4d7 100644
> --- a/target/s390x/translate.c
> +++ b/target/s390x/translate.c
> @@ -145,10 +145,11 @@ void s390x_translate_init(void)
>      }
>  }
>  
> -static inline int vec_reg_offset(uint8_t reg, uint8_t enr, TCGMemOp size)
> +static inline int vec_reg_offset(uint8_t reg, uint8_t enr, TCGMemOp es)
>  {
> -    const uint8_t es = 1 << size;
> -    int offs = enr * es;
> +    /* Convert element size (es) - e.g. MO_U8 - to bytes */

s/MO_U8/MO_8/  :(

Conny, I assume you can fix that up in case there are no other comments.
Thanks!

> +    const uint8_t bytes = 1 << es;
> +    int offs = enr * bytes;
>  
>      g_assert(reg < 32);
>      /*
> @@ -173,9 +174,9 @@ static inline int vec_reg_offset(uint8_t reg, uint8_t enr, TCGMemOp size)
>       * the two 8 byte elements have to be loaded separately. Let's force all
>       * 16 byte operations to handle it in a special way.
>       */
> -    g_assert(size <= MO_64);
> +    g_assert(es <= MO_64);
>  #ifndef HOST_WORDS_BIGENDIAN
> -    offs ^= (8 - es);
> +    offs ^= (8 - bytes);
>  #endif
>      return offs + offsetof(CPUS390XState, vregs[reg][0].d);
>  }
> 


-- 

Thanks,

David / dhildenb

Re: [Qemu-devel] [PATCH v2 3/7] s390x/tcg: Clarify terminology in vec_reg_offset()
Posted by Cornelia Huck 6 years, 8 months ago
On Mon, 25 Feb 2019 23:28:27 +0100
David Hildenbrand <david@redhat.com> wrote:

> On 25.02.19 21:03, David Hildenbrand wrote:
> > We will use s390x speak "Element Size" (es) for MO_8 == 0, MO_16 == 1
> > ... Simple rename of variables.
> > 
> > Reviewed-by: Thomas Huth <thuth@redhat.com>
> > Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
> > Signed-off-by: David Hildenbrand <david@redhat.com>
> > ---
> >  target/s390x/translate.c | 11 ++++++-----
> >  1 file changed, 6 insertions(+), 5 deletions(-)
> > 
> > diff --git a/target/s390x/translate.c b/target/s390x/translate.c
> > index c646e50eb3..5e3955e4d7 100644
> > --- a/target/s390x/translate.c
> > +++ b/target/s390x/translate.c
> > @@ -145,10 +145,11 @@ void s390x_translate_init(void)
> >      }
> >  }
> >  
> > -static inline int vec_reg_offset(uint8_t reg, uint8_t enr, TCGMemOp size)
> > +static inline int vec_reg_offset(uint8_t reg, uint8_t enr, TCGMemOp es)
> >  {
> > -    const uint8_t es = 1 << size;
> > -    int offs = enr * es;
> > +    /* Convert element size (es) - e.g. MO_U8 - to bytes */  
> 
> s/MO_U8/MO_8/  :(
> 
> Conny, I assume you can fix that up in case there are no other comments.
> Thanks!

Sure, no problem.

> 
> > +    const uint8_t bytes = 1 << es;
> > +    int offs = enr * bytes;
> >  
> >      g_assert(reg < 32);
> >      /*
> > @@ -173,9 +174,9 @@ static inline int vec_reg_offset(uint8_t reg, uint8_t enr, TCGMemOp size)
> >       * the two 8 byte elements have to be loaded separately. Let's force all
> >       * 16 byte operations to handle it in a special way.
> >       */
> > -    g_assert(size <= MO_64);
> > +    g_assert(es <= MO_64);
> >  #ifndef HOST_WORDS_BIGENDIAN
> > -    offs ^= (8 - es);
> > +    offs ^= (8 - bytes);
> >  #endif
> >      return offs + offsetof(CPUS390XState, vregs[reg][0].d);
> >  }
> >   
> 
>