mbox series

[0/8] Optimize emulation of ten Altivec instructions: lvsl,

Message ID 1559816130-17113-1-git-send-email-stefan.brankovic@rt-rk.com (mailing list archive)
Headers show
Series Optimize emulation of ten Altivec instructions: lvsl, | expand

Message

Stefan Brankovic June 6, 2019, 10:15 a.m. UTC
This series buils up on and complements recent work of Thomas Murta, Mark
Cave-Ayland and Richard Henderson in the same area. It is based on devising TCG
translation implementation for selected instructions rather than using helpers.
The selected instructions are most of the time idiosyncratic to ppc platform,
so relatively complex TCG translation (without direct mapping to host
instruction that is not possible in these cases) seems to be the best option,
and that approach is presented in this series. The performance improvements are
significant in all cases.

Stefan Brankovic (8):
  target/ppc: Optimize emulation of lvsl and lvsr instructions
  target/ppc: Optimize emulation of vsl and vsr instructions
  target/ppc: Optimize emulation of vpkpx instruction
  target/ppc: Optimize emulation of vgbbd instruction
  target/ppc: Optimize emulation of vclzd instruction
  target/ppc: Optimize emulation of vclzw instruction
  target/ppc: Optimize emulation of vclzh and vclzb instructions
  target/ppc: Refactor emulation of vmrgew and vmrgow instructions

 target/ppc/translate/vmx-impl.inc.c | 705 ++++++++++++++++++++++++++++++++----
 1 file changed, 636 insertions(+), 69 deletions(-)

Comments

Richard Henderson June 6, 2019, 5:13 p.m. UTC | #1
On 6/6/19 5:15 AM, Stefan Brankovic wrote:
> Stefan Brankovic (8):
>   target/ppc: Optimize emulation of lvsl and lvsr instructions
>   target/ppc: Optimize emulation of vsl and vsr instructions
>   target/ppc: Optimize emulation of vpkpx instruction
>   target/ppc: Optimize emulation of vgbbd instruction
>   target/ppc: Optimize emulation of vclzd instruction
>   target/ppc: Optimize emulation of vclzw instruction
>   target/ppc: Optimize emulation of vclzh and vclzb instructions
>   target/ppc: Refactor emulation of vmrgew and vmrgow instructions
> 
>  target/ppc/translate/vmx-impl.inc.c | 705 ++++++++++++++++++++++++++++++++----
>  1 file changed, 636 insertions(+), 69 deletions(-)

You should be removing the out-of-line helpers that are no longer used.


r~
Howard Spoelstra June 7, 2019, 3:51 a.m. UTC | #2
Hi,

This series gives me several compilation errors.
When compiled with --disable-werror, OSX 10.3 guest on qemu-system-ppc
shows corrupted desktop graphics.

Compiled with:
./configure --target-list="ppc-softmmu" --enable-sdl --enable-gtk  && make
-j8

gcc is:
[hsp@fedora30 qemu-master]$ gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/libexec/gcc/x86_64-redhat-linux/9/lto-wrapper
OFFLOAD_TARGET_NAMES=nvptx-none
OFFLOAD_TARGET_DEFAULT=1
Target: x86_64-redhat-linux
Configured with: ../configure --enable-bootstrap
--enable-languages=c,c++,fortran,objc,obj-c++,ada,go,d,lto --prefix=/usr
--mandir=/usr/share/man --infodir=/usr/share/info --with-bugurl=
http://bugzilla.redhat.com/bugzilla --enable-shared --enable-threads=posix
--enable-checking=release --enable-multilib --with-system-zlib
--enable-__cxa_atexit --disable-libunwind-exceptions
--enable-gnu-unique-object --enable-linker-build-id
--with-gcc-major-version-only --with-linker-hash-style=gnu --enable-plugin
--enable-initfini-array --with-isl --enable-offload-targets=nvptx-none
--without-cuda-driver --enable-gnu-indirect-function --enable-cet
--with-tune=generic --with-arch_32=i686 --build=x86_64-redhat-linux
Thread model: posix
gcc version 9.1.1 20190503 (Red Hat 9.1.1-1) (GCC)

Errors are:

/home/hsp/src/qemu-master/tcg/tcg-op.h:837:24: error: initialization of
‘TCGv_i64’ {aka ‘struct TCGv_i64_d *’} from incompatible pointer type
‘TCGv_i32’ {aka ‘struct TCGv_i32_d *’} [-Werror=incompatible-pointer-types]
  837 | #define tcg_temp_new() tcg_temp_new_i32()
      |                        ^~~~~~~~~~~~~~~~
/home/hsp/src/qemu-master/target/ppc/translate/vmx-impl.inc.c:513:19: note:
in expansion of macro ‘tcg_temp_new’
  513 |     TCGv_i64 EA = tcg_temp_new();
      |                   ^~~~~~~~~~~~
In file included from /home/hsp/src/qemu-master/target/ppc/translate.c:6826:
/home/hsp/src/qemu-master/target/ppc/translate/vmx-impl.inc.c:517:29:
error: passing argument 2 of ‘gen_addr_reg_index’ from incompatible pointer
type [-Werror=incompatible-pointer-types]
  517 |     gen_addr_reg_index(ctx, EA);
      |                             ^~
      |                             |
      |                             TCGv_i64 {aka struct TCGv_i64_d *}
/home/hsp/src/qemu-master/target/ppc/translate.c:2398:63: note: expected
‘TCGv_i32’ {aka ‘struct TCGv_i32_d *’} but argument is of type ‘TCGv_i64’
{aka ‘struct TCGv_i64_d *’}
 2398 | static inline void gen_addr_reg_index(DisasContext *ctx, TCGv EA)
In file included from /home/hsp/src/qemu-master/target/ppc/translate.c:6826:
/home/hsp/src/qemu-master/target/ppc/translate/vmx-impl.inc.c:545:19:
error: passing argument 1 of ‘tcg_temp_free_i32’ from incompatible pointer
type [-Werror=incompatible-pointer-types]
  545 |     tcg_temp_free(EA);
      |                   ^~
      |                   |
      |                   TCGv_i64 {aka struct TCGv_i64_d *}
In file included from /home/hsp/src/qemu-master/tcg/tcg-op.h:28,
                 from /home/hsp/src/qemu-master/target/ppc/translate.c:26:
/home/hsp/src/qemu-master/tcg/tcg.h:933:47: note: expected ‘TCGv_i32’ {aka
‘struct TCGv_i32_d *’} but argument is of type ‘TCGv_i64’ {aka ‘struct
TCGv_i64_d *’}
  933 | static inline void tcg_temp_free_i32(TCGv_i32 arg)
      |                                      ~~~~~~~~~^~~
In file included from /home/hsp/src/qemu-master/target/ppc/translate.c:26:
/home/hsp/src/qemu-master/target/ppc/translate/vmx-impl.inc.c: In function
‘trans_lvsr’:
/home/hsp/src/qemu-master/tcg/tcg-op.h:837:24: error: initialization of
‘TCGv_i64’ {aka ‘struct TCGv_i64_d *’} from incompatible pointer type
‘TCGv_i32’ {aka ‘struct TCGv_i32_d *’} [-Werror=incompatible-pointer-types]
  837 | #define tcg_temp_new() tcg_temp_new_i32()
      |                        ^~~~~~~~~~~~~~~~
/home/hsp/src/qemu-master/target/ppc/translate/vmx-impl.inc.c:561:19: note:
in expansion of macro ‘tcg_temp_new’
  561 |     TCGv_i64 EA = tcg_temp_new();
      |                   ^~~~~~~~~~~~
In file included from /home/hsp/src/qemu-master/target/ppc/translate.c:6826:
/home/hsp/src/qemu-master/target/ppc/translate/vmx-impl.inc.c:565:29:
error: passing argument 2 of ‘gen_addr_reg_index’ from incompatible pointer
type [-Werror=incompatible-pointer-types]
  565 |     gen_addr_reg_index(ctx, EA);
      |                             ^~
      |                             |
      |                             TCGv_i64 {aka struct TCGv_i64_d *}
/home/hsp/src/qemu-master/target/ppc/translate.c:2398:63: note: expected
‘TCGv_i32’ {aka ‘struct TCGv_i32_d *’} but argument is of type ‘TCGv_i64’
{aka ‘struct TCGv_i64_d *’}
 2398 | static inline void gen_addr_reg_index(DisasContext *ctx, TCGv EA)
In file included from /home/hsp/src/qemu-master/target/ppc/translate.c:6826:
/home/hsp/src/qemu-master/target/ppc/translate/vmx-impl.inc.c:596:19:
error: passing argument 1 of ‘tcg_temp_free_i32’ from incompatible pointer
type [-Werror=incompatible-pointer-types]
  596 |     tcg_temp_free(EA);
      |                   ^~
      |                   |
      |                   TCGv_i64 {aka struct TCGv_i64_d *}
In file included from /home/hsp/src/qemu-master/tcg/tcg-op.h:28,
                 from /home/hsp/src/qemu-master/target/ppc/translate.c:26:
/home/hsp/src/qemu-master/tcg/tcg.h:933:47: note: expected ‘TCGv_i32’ {aka
‘struct TCGv_i32_d *’} but argument is of type ‘TCGv_i64’ {aka ‘struct
TCGv_i64_d *’}
  933 | static inline void tcg_temp_free_i32(TCGv_i32 arg)
      |                                      ~~~~~~~~~^~~


Best,
Howard
Stefan Brankovic June 12, 2019, 7:31 a.m. UTC | #3
>
>
> -------- Original Message --------
> Subject: Re: [Qemu-devel] [PATCH 0/8] Optimize emulation of ten Altivec instructions: lvsl,
> Date: Thursday, June 6, 2019 19:13 CEST
> From: Richard Henderson <richard.henderson@linaro.org>
> To: Stefan Brankovic <stefan.brankovic@rt-rk.com>, qemu-devel@nongnu.org
> CC: david@gibson.dropbear.id.au
> References: <1559816130-17113-1-git-send-email-stefan.brankovic@rt-rk.com>
>
>
>
> > On 6/6/19 5:15 AM, Stefan Brankovic wrote:
> > > Stefan Brankovic (8):
> > > target/ppc: Optimize emulation of lvsl and lvsr instructions
> > > target/ppc: Optimize emulation of vsl and vsr instructions
> > > target/ppc: Optimize emulation of vpkpx instruction
> > > target/ppc: Optimize emulation of vgbbd instruction
> > > target/ppc: Optimize emulation of vclzd instruction
> > > target/ppc: Optimize emulation of vclzw instruction
> > > target/ppc: Optimize emulation of vclzh and vclzb instructions
> > > target/ppc: Refactor emulation of vmrgew and vmrgow instructions
> > >
> > > target/ppc/translate/vmx-impl.inc.c | 705 ++++++++++++++++++++++++++++++++----
> > > 1 file changed, 636 insertions(+), 69 deletions(-)
> >
> > You should be removing the out-of-line helpers that are no longer used.
> >

Thank you for taking your time to review my code. I think that your suggestions
are all constructive and very useful. However, I was on a short leave this
week and I couldn't respond promptly. I will respond with more details in next
few days.

Kind Regards,
Stefan

> >
> > r~
>
>
>
Stefan Brankovic June 17, 2019, 11:32 a.m. UTC | #4
On 6.6.19. 19:13, Richard Henderson wrote:
> On 6/6/19 5:15 AM, Stefan Brankovic wrote:
>> Stefan Brankovic (8):
>>    target/ppc: Optimize emulation of lvsl and lvsr instructions
>>    target/ppc: Optimize emulation of vsl and vsr instructions
>>    target/ppc: Optimize emulation of vpkpx instruction
>>    target/ppc: Optimize emulation of vgbbd instruction
>>    target/ppc: Optimize emulation of vclzd instruction
>>    target/ppc: Optimize emulation of vclzw instruction
>>    target/ppc: Optimize emulation of vclzh and vclzb instructions
>>    target/ppc: Refactor emulation of vmrgew and vmrgow instructions
>>
>>   target/ppc/translate/vmx-impl.inc.c | 705 ++++++++++++++++++++++++++++++++----
>>   1 file changed, 636 insertions(+), 69 deletions(-)
> You should be removing the out-of-line helpers that are no longer used.
>
I agree. I will remove them in v2.

Kind Regards,

Stefan

> r~