target/arm: AArch32 VCVT fixed-point to float is always round-to-nearest

For AArch32, unlike the VCVT of integer to float, which honours the
rounding mode specified by the FPSCR, VCVT of fixed-point to float is
always round-to-nearest. (AArch64 fixed-point-to-float conversions
always honour the FPCR rounding mode.)

Implement this by providing _round_to_nearest versions of the
relevant helpers which set the rounding mode temporarily when making
the call to the underlying softfloat function.

We only need to change the VFP VCVT instructions, because the
standard- FPSCR value used by the Neon VCVT is always set to
round-to-nearest, so we don't need to do the extra work of saving
and restoring the rounding mode.

Backports commit 61db12d9f9eb36761edba4d9a414cd8dd34c512b
This commit is contained in:
Peter Maydell 2021-03-01 20:04:28 -05:00 committed by Lioncash
parent 31013d5a8f
commit d350644817
19 changed files with 239 additions and 13 deletions

View file

@ -2079,6 +2079,18 @@
#define helper_vfp_uqtod helper_vfp_uqtod_aarch64
#define helper_vfp_uqtoh helper_vfp_uqtoh_aarch64
#define helper_vfp_uqtos helper_vfp_uqtos_aarch64
#define helper_vfp_shtos_round_to_nearest helper_vfp_shtos_round_to_nearest_aarch64
#define helper_vfp_sltos_round_to_nearest helper_vfp_sltos_round_to_nearest_aarch64
#define helper_vfp_uhtos_round_to_nearest helper_vfp_uhtos_round_to_nearest_aarch64
#define helper_vfp_ultos_round_to_nearest helper_vfp_ultos_round_to_nearest_aarch64
#define helper_vfp_shtod_round_to_nearest helper_vfp_shtod_round_to_nearest_aarch64
#define helper_vfp_sltod_round_to_nearest helper_vfp_sltod_round_to_nearest_aarch64
#define helper_vfp_uhtod_round_to_nearest helper_vfp_uhtod_round_to_nearest_aarch64
#define helper_vfp_ultod_round_to_nearest helper_vfp_ultod_round_to_nearest_aarch64
#define helper_vfp_shtoh_round_to_nearest helper_vfp_shtoh_round_to_nearest_aarch64
#define helper_vfp_uhtoh_round_to_nearest helper_vfp_uhtoh_round_to_nearest_aarch64
#define helper_vfp_sltoh_round_to_nearest helper_vfp_sltoh_round_to_nearest_aarch64
#define helper_vfp_ultoh_round_to_nearest helper_vfp_ultoh_round_to_nearest_aarch64
#define helper_wfe helper_wfe_aarch64
#define helper_wfi helper_wfi_aarch64
#define helper_yield helper_yield_aarch64

View file

@ -2079,6 +2079,18 @@
#define helper_vfp_uqtod helper_vfp_uqtod_aarch64eb
#define helper_vfp_uqtoh helper_vfp_uqtoh_aarch64eb
#define helper_vfp_uqtos helper_vfp_uqtos_aarch64eb
#define helper_vfp_shtos_round_to_nearest helper_vfp_shtos_round_to_nearest_aarch64eb
#define helper_vfp_sltos_round_to_nearest helper_vfp_sltos_round_to_nearest_aarch64eb
#define helper_vfp_uhtos_round_to_nearest helper_vfp_uhtos_round_to_nearest_aarch64eb
#define helper_vfp_ultos_round_to_nearest helper_vfp_ultos_round_to_nearest_aarch64eb
#define helper_vfp_shtod_round_to_nearest helper_vfp_shtod_round_to_nearest_aarch64eb
#define helper_vfp_sltod_round_to_nearest helper_vfp_sltod_round_to_nearest_aarch64eb
#define helper_vfp_uhtod_round_to_nearest helper_vfp_uhtod_round_to_nearest_aarch64eb
#define helper_vfp_ultod_round_to_nearest helper_vfp_ultod_round_to_nearest_aarch64eb
#define helper_vfp_shtoh_round_to_nearest helper_vfp_shtoh_round_to_nearest_aarch64eb
#define helper_vfp_uhtoh_round_to_nearest helper_vfp_uhtoh_round_to_nearest_aarch64eb
#define helper_vfp_sltoh_round_to_nearest helper_vfp_sltoh_round_to_nearest_aarch64eb
#define helper_vfp_ultoh_round_to_nearest helper_vfp_ultoh_round_to_nearest_aarch64eb
#define helper_wfe helper_wfe_aarch64eb
#define helper_wfi helper_wfi_aarch64eb
#define helper_yield helper_yield_aarch64eb

View file

@ -2079,6 +2079,18 @@
#define helper_vfp_uqtod helper_vfp_uqtod_arm
#define helper_vfp_uqtoh helper_vfp_uqtoh_arm
#define helper_vfp_uqtos helper_vfp_uqtos_arm
#define helper_vfp_shtos_round_to_nearest helper_vfp_shtos_round_to_nearest_arm
#define helper_vfp_sltos_round_to_nearest helper_vfp_sltos_round_to_nearest_arm
#define helper_vfp_uhtos_round_to_nearest helper_vfp_uhtos_round_to_nearest_arm
#define helper_vfp_ultos_round_to_nearest helper_vfp_ultos_round_to_nearest_arm
#define helper_vfp_shtod_round_to_nearest helper_vfp_shtod_round_to_nearest_arm
#define helper_vfp_sltod_round_to_nearest helper_vfp_sltod_round_to_nearest_arm
#define helper_vfp_uhtod_round_to_nearest helper_vfp_uhtod_round_to_nearest_arm
#define helper_vfp_ultod_round_to_nearest helper_vfp_ultod_round_to_nearest_arm
#define helper_vfp_shtoh_round_to_nearest helper_vfp_shtoh_round_to_nearest_arm
#define helper_vfp_uhtoh_round_to_nearest helper_vfp_uhtoh_round_to_nearest_arm
#define helper_vfp_sltoh_round_to_nearest helper_vfp_sltoh_round_to_nearest_arm
#define helper_vfp_ultoh_round_to_nearest helper_vfp_ultoh_round_to_nearest_arm
#define helper_wfe helper_wfe_arm
#define helper_wfi helper_wfi_arm
#define helper_yield helper_yield_arm

View file

@ -2079,6 +2079,18 @@
#define helper_vfp_uqtod helper_vfp_uqtod_armeb
#define helper_vfp_uqtoh helper_vfp_uqtoh_armeb
#define helper_vfp_uqtos helper_vfp_uqtos_armeb
#define helper_vfp_shtos_round_to_nearest helper_vfp_shtos_round_to_nearest_armeb
#define helper_vfp_sltos_round_to_nearest helper_vfp_sltos_round_to_nearest_armeb
#define helper_vfp_uhtos_round_to_nearest helper_vfp_uhtos_round_to_nearest_armeb
#define helper_vfp_ultos_round_to_nearest helper_vfp_ultos_round_to_nearest_armeb
#define helper_vfp_shtod_round_to_nearest helper_vfp_shtod_round_to_nearest_armeb
#define helper_vfp_sltod_round_to_nearest helper_vfp_sltod_round_to_nearest_armeb
#define helper_vfp_uhtod_round_to_nearest helper_vfp_uhtod_round_to_nearest_armeb
#define helper_vfp_ultod_round_to_nearest helper_vfp_ultod_round_to_nearest_armeb
#define helper_vfp_shtoh_round_to_nearest helper_vfp_shtoh_round_to_nearest_armeb
#define helper_vfp_uhtoh_round_to_nearest helper_vfp_uhtoh_round_to_nearest_armeb
#define helper_vfp_sltoh_round_to_nearest helper_vfp_sltoh_round_to_nearest_armeb
#define helper_vfp_ultoh_round_to_nearest helper_vfp_ultoh_round_to_nearest_armeb
#define helper_wfe helper_wfe_armeb
#define helper_wfi helper_wfi_armeb
#define helper_yield helper_yield_armeb

View file

@ -2085,6 +2085,18 @@ symbols = (
'helper_vfp_uqtod',
'helper_vfp_uqtoh',
'helper_vfp_uqtos',
'helper_vfp_shtos_round_to_nearest',
'helper_vfp_sltos_round_to_nearest',
'helper_vfp_uhtos_round_to_nearest',
'helper_vfp_ultos_round_to_nearest',
'helper_vfp_shtod_round_to_nearest',
'helper_vfp_sltod_round_to_nearest',
'helper_vfp_uhtod_round_to_nearest',
'helper_vfp_ultod_round_to_nearest',
'helper_vfp_shtoh_round_to_nearest',
'helper_vfp_uhtoh_round_to_nearest',
'helper_vfp_sltoh_round_to_nearest',
'helper_vfp_ultoh_round_to_nearest',
'helper_wfe',
'helper_wfi',
'helper_yield',

View file

@ -2079,6 +2079,18 @@
#define helper_vfp_uqtod helper_vfp_uqtod_m68k
#define helper_vfp_uqtoh helper_vfp_uqtoh_m68k
#define helper_vfp_uqtos helper_vfp_uqtos_m68k
#define helper_vfp_shtos_round_to_nearest helper_vfp_shtos_round_to_nearest_m68k
#define helper_vfp_sltos_round_to_nearest helper_vfp_sltos_round_to_nearest_m68k
#define helper_vfp_uhtos_round_to_nearest helper_vfp_uhtos_round_to_nearest_m68k
#define helper_vfp_ultos_round_to_nearest helper_vfp_ultos_round_to_nearest_m68k
#define helper_vfp_shtod_round_to_nearest helper_vfp_shtod_round_to_nearest_m68k
#define helper_vfp_sltod_round_to_nearest helper_vfp_sltod_round_to_nearest_m68k
#define helper_vfp_uhtod_round_to_nearest helper_vfp_uhtod_round_to_nearest_m68k
#define helper_vfp_ultod_round_to_nearest helper_vfp_ultod_round_to_nearest_m68k
#define helper_vfp_shtoh_round_to_nearest helper_vfp_shtoh_round_to_nearest_m68k
#define helper_vfp_uhtoh_round_to_nearest helper_vfp_uhtoh_round_to_nearest_m68k
#define helper_vfp_sltoh_round_to_nearest helper_vfp_sltoh_round_to_nearest_m68k
#define helper_vfp_ultoh_round_to_nearest helper_vfp_ultoh_round_to_nearest_m68k
#define helper_wfe helper_wfe_m68k
#define helper_wfi helper_wfi_m68k
#define helper_yield helper_yield_m68k

View file

@ -2079,6 +2079,18 @@
#define helper_vfp_uqtod helper_vfp_uqtod_mips
#define helper_vfp_uqtoh helper_vfp_uqtoh_mips
#define helper_vfp_uqtos helper_vfp_uqtos_mips
#define helper_vfp_shtos_round_to_nearest helper_vfp_shtos_round_to_nearest_mips
#define helper_vfp_sltos_round_to_nearest helper_vfp_sltos_round_to_nearest_mips
#define helper_vfp_uhtos_round_to_nearest helper_vfp_uhtos_round_to_nearest_mips
#define helper_vfp_ultos_round_to_nearest helper_vfp_ultos_round_to_nearest_mips
#define helper_vfp_shtod_round_to_nearest helper_vfp_shtod_round_to_nearest_mips
#define helper_vfp_sltod_round_to_nearest helper_vfp_sltod_round_to_nearest_mips
#define helper_vfp_uhtod_round_to_nearest helper_vfp_uhtod_round_to_nearest_mips
#define helper_vfp_ultod_round_to_nearest helper_vfp_ultod_round_to_nearest_mips
#define helper_vfp_shtoh_round_to_nearest helper_vfp_shtoh_round_to_nearest_mips
#define helper_vfp_uhtoh_round_to_nearest helper_vfp_uhtoh_round_to_nearest_mips
#define helper_vfp_sltoh_round_to_nearest helper_vfp_sltoh_round_to_nearest_mips
#define helper_vfp_ultoh_round_to_nearest helper_vfp_ultoh_round_to_nearest_mips
#define helper_wfe helper_wfe_mips
#define helper_wfi helper_wfi_mips
#define helper_yield helper_yield_mips

View file

@ -2079,6 +2079,18 @@
#define helper_vfp_uqtod helper_vfp_uqtod_mips64
#define helper_vfp_uqtoh helper_vfp_uqtoh_mips64
#define helper_vfp_uqtos helper_vfp_uqtos_mips64
#define helper_vfp_shtos_round_to_nearest helper_vfp_shtos_round_to_nearest_mips64
#define helper_vfp_sltos_round_to_nearest helper_vfp_sltos_round_to_nearest_mips64
#define helper_vfp_uhtos_round_to_nearest helper_vfp_uhtos_round_to_nearest_mips64
#define helper_vfp_ultos_round_to_nearest helper_vfp_ultos_round_to_nearest_mips64
#define helper_vfp_shtod_round_to_nearest helper_vfp_shtod_round_to_nearest_mips64
#define helper_vfp_sltod_round_to_nearest helper_vfp_sltod_round_to_nearest_mips64
#define helper_vfp_uhtod_round_to_nearest helper_vfp_uhtod_round_to_nearest_mips64
#define helper_vfp_ultod_round_to_nearest helper_vfp_ultod_round_to_nearest_mips64
#define helper_vfp_shtoh_round_to_nearest helper_vfp_shtoh_round_to_nearest_mips64
#define helper_vfp_uhtoh_round_to_nearest helper_vfp_uhtoh_round_to_nearest_mips64
#define helper_vfp_sltoh_round_to_nearest helper_vfp_sltoh_round_to_nearest_mips64
#define helper_vfp_ultoh_round_to_nearest helper_vfp_ultoh_round_to_nearest_mips64
#define helper_wfe helper_wfe_mips64
#define helper_wfi helper_wfi_mips64
#define helper_yield helper_yield_mips64

View file

@ -2079,6 +2079,18 @@
#define helper_vfp_uqtod helper_vfp_uqtod_mips64el
#define helper_vfp_uqtoh helper_vfp_uqtoh_mips64el
#define helper_vfp_uqtos helper_vfp_uqtos_mips64el
#define helper_vfp_shtos_round_to_nearest helper_vfp_shtos_round_to_nearest_mips64el
#define helper_vfp_sltos_round_to_nearest helper_vfp_sltos_round_to_nearest_mips64el
#define helper_vfp_uhtos_round_to_nearest helper_vfp_uhtos_round_to_nearest_mips64el
#define helper_vfp_ultos_round_to_nearest helper_vfp_ultos_round_to_nearest_mips64el
#define helper_vfp_shtod_round_to_nearest helper_vfp_shtod_round_to_nearest_mips64el
#define helper_vfp_sltod_round_to_nearest helper_vfp_sltod_round_to_nearest_mips64el
#define helper_vfp_uhtod_round_to_nearest helper_vfp_uhtod_round_to_nearest_mips64el
#define helper_vfp_ultod_round_to_nearest helper_vfp_ultod_round_to_nearest_mips64el
#define helper_vfp_shtoh_round_to_nearest helper_vfp_shtoh_round_to_nearest_mips64el
#define helper_vfp_uhtoh_round_to_nearest helper_vfp_uhtoh_round_to_nearest_mips64el
#define helper_vfp_sltoh_round_to_nearest helper_vfp_sltoh_round_to_nearest_mips64el
#define helper_vfp_ultoh_round_to_nearest helper_vfp_ultoh_round_to_nearest_mips64el
#define helper_wfe helper_wfe_mips64el
#define helper_wfi helper_wfi_mips64el
#define helper_yield helper_yield_mips64el

View file

@ -2079,6 +2079,18 @@
#define helper_vfp_uqtod helper_vfp_uqtod_mipsel
#define helper_vfp_uqtoh helper_vfp_uqtoh_mipsel
#define helper_vfp_uqtos helper_vfp_uqtos_mipsel
#define helper_vfp_shtos_round_to_nearest helper_vfp_shtos_round_to_nearest_mipsel
#define helper_vfp_sltos_round_to_nearest helper_vfp_sltos_round_to_nearest_mipsel
#define helper_vfp_uhtos_round_to_nearest helper_vfp_uhtos_round_to_nearest_mipsel
#define helper_vfp_ultos_round_to_nearest helper_vfp_ultos_round_to_nearest_mipsel
#define helper_vfp_shtod_round_to_nearest helper_vfp_shtod_round_to_nearest_mipsel
#define helper_vfp_sltod_round_to_nearest helper_vfp_sltod_round_to_nearest_mipsel
#define helper_vfp_uhtod_round_to_nearest helper_vfp_uhtod_round_to_nearest_mipsel
#define helper_vfp_ultod_round_to_nearest helper_vfp_ultod_round_to_nearest_mipsel
#define helper_vfp_shtoh_round_to_nearest helper_vfp_shtoh_round_to_nearest_mipsel
#define helper_vfp_uhtoh_round_to_nearest helper_vfp_uhtoh_round_to_nearest_mipsel
#define helper_vfp_sltoh_round_to_nearest helper_vfp_sltoh_round_to_nearest_mipsel
#define helper_vfp_ultoh_round_to_nearest helper_vfp_ultoh_round_to_nearest_mipsel
#define helper_wfe helper_wfe_mipsel
#define helper_wfi helper_wfi_mipsel
#define helper_yield helper_yield_mipsel

View file

@ -2079,6 +2079,18 @@
#define helper_vfp_uqtod helper_vfp_uqtod_powerpc
#define helper_vfp_uqtoh helper_vfp_uqtoh_powerpc
#define helper_vfp_uqtos helper_vfp_uqtos_powerpc
#define helper_vfp_shtos_round_to_nearest helper_vfp_shtos_round_to_nearest_powerpc
#define helper_vfp_sltos_round_to_nearest helper_vfp_sltos_round_to_nearest_powerpc
#define helper_vfp_uhtos_round_to_nearest helper_vfp_uhtos_round_to_nearest_powerpc
#define helper_vfp_ultos_round_to_nearest helper_vfp_ultos_round_to_nearest_powerpc
#define helper_vfp_shtod_round_to_nearest helper_vfp_shtod_round_to_nearest_powerpc
#define helper_vfp_sltod_round_to_nearest helper_vfp_sltod_round_to_nearest_powerpc
#define helper_vfp_uhtod_round_to_nearest helper_vfp_uhtod_round_to_nearest_powerpc
#define helper_vfp_ultod_round_to_nearest helper_vfp_ultod_round_to_nearest_powerpc
#define helper_vfp_shtoh_round_to_nearest helper_vfp_shtoh_round_to_nearest_powerpc
#define helper_vfp_uhtoh_round_to_nearest helper_vfp_uhtoh_round_to_nearest_powerpc
#define helper_vfp_sltoh_round_to_nearest helper_vfp_sltoh_round_to_nearest_powerpc
#define helper_vfp_ultoh_round_to_nearest helper_vfp_ultoh_round_to_nearest_powerpc
#define helper_wfe helper_wfe_powerpc
#define helper_wfi helper_wfi_powerpc
#define helper_yield helper_yield_powerpc

View file

@ -2079,6 +2079,18 @@
#define helper_vfp_uqtod helper_vfp_uqtod_riscv32
#define helper_vfp_uqtoh helper_vfp_uqtoh_riscv32
#define helper_vfp_uqtos helper_vfp_uqtos_riscv32
#define helper_vfp_shtos_round_to_nearest helper_vfp_shtos_round_to_nearest_riscv32
#define helper_vfp_sltos_round_to_nearest helper_vfp_sltos_round_to_nearest_riscv32
#define helper_vfp_uhtos_round_to_nearest helper_vfp_uhtos_round_to_nearest_riscv32
#define helper_vfp_ultos_round_to_nearest helper_vfp_ultos_round_to_nearest_riscv32
#define helper_vfp_shtod_round_to_nearest helper_vfp_shtod_round_to_nearest_riscv32
#define helper_vfp_sltod_round_to_nearest helper_vfp_sltod_round_to_nearest_riscv32
#define helper_vfp_uhtod_round_to_nearest helper_vfp_uhtod_round_to_nearest_riscv32
#define helper_vfp_ultod_round_to_nearest helper_vfp_ultod_round_to_nearest_riscv32
#define helper_vfp_shtoh_round_to_nearest helper_vfp_shtoh_round_to_nearest_riscv32
#define helper_vfp_uhtoh_round_to_nearest helper_vfp_uhtoh_round_to_nearest_riscv32
#define helper_vfp_sltoh_round_to_nearest helper_vfp_sltoh_round_to_nearest_riscv32
#define helper_vfp_ultoh_round_to_nearest helper_vfp_ultoh_round_to_nearest_riscv32
#define helper_wfe helper_wfe_riscv32
#define helper_wfi helper_wfi_riscv32
#define helper_yield helper_yield_riscv32

View file

@ -2079,6 +2079,18 @@
#define helper_vfp_uqtod helper_vfp_uqtod_riscv64
#define helper_vfp_uqtoh helper_vfp_uqtoh_riscv64
#define helper_vfp_uqtos helper_vfp_uqtos_riscv64
#define helper_vfp_shtos_round_to_nearest helper_vfp_shtos_round_to_nearest_riscv64
#define helper_vfp_sltos_round_to_nearest helper_vfp_sltos_round_to_nearest_riscv64
#define helper_vfp_uhtos_round_to_nearest helper_vfp_uhtos_round_to_nearest_riscv64
#define helper_vfp_ultos_round_to_nearest helper_vfp_ultos_round_to_nearest_riscv64
#define helper_vfp_shtod_round_to_nearest helper_vfp_shtod_round_to_nearest_riscv64
#define helper_vfp_sltod_round_to_nearest helper_vfp_sltod_round_to_nearest_riscv64
#define helper_vfp_uhtod_round_to_nearest helper_vfp_uhtod_round_to_nearest_riscv64
#define helper_vfp_ultod_round_to_nearest helper_vfp_ultod_round_to_nearest_riscv64
#define helper_vfp_shtoh_round_to_nearest helper_vfp_shtoh_round_to_nearest_riscv64
#define helper_vfp_uhtoh_round_to_nearest helper_vfp_uhtoh_round_to_nearest_riscv64
#define helper_vfp_sltoh_round_to_nearest helper_vfp_sltoh_round_to_nearest_riscv64
#define helper_vfp_ultoh_round_to_nearest helper_vfp_ultoh_round_to_nearest_riscv64
#define helper_wfe helper_wfe_riscv64
#define helper_wfi helper_wfi_riscv64
#define helper_yield helper_yield_riscv64

View file

@ -2079,6 +2079,18 @@
#define helper_vfp_uqtod helper_vfp_uqtod_sparc
#define helper_vfp_uqtoh helper_vfp_uqtoh_sparc
#define helper_vfp_uqtos helper_vfp_uqtos_sparc
#define helper_vfp_shtos_round_to_nearest helper_vfp_shtos_round_to_nearest_sparc
#define helper_vfp_sltos_round_to_nearest helper_vfp_sltos_round_to_nearest_sparc
#define helper_vfp_uhtos_round_to_nearest helper_vfp_uhtos_round_to_nearest_sparc
#define helper_vfp_ultos_round_to_nearest helper_vfp_ultos_round_to_nearest_sparc
#define helper_vfp_shtod_round_to_nearest helper_vfp_shtod_round_to_nearest_sparc
#define helper_vfp_sltod_round_to_nearest helper_vfp_sltod_round_to_nearest_sparc
#define helper_vfp_uhtod_round_to_nearest helper_vfp_uhtod_round_to_nearest_sparc
#define helper_vfp_ultod_round_to_nearest helper_vfp_ultod_round_to_nearest_sparc
#define helper_vfp_shtoh_round_to_nearest helper_vfp_shtoh_round_to_nearest_sparc
#define helper_vfp_uhtoh_round_to_nearest helper_vfp_uhtoh_round_to_nearest_sparc
#define helper_vfp_sltoh_round_to_nearest helper_vfp_sltoh_round_to_nearest_sparc
#define helper_vfp_ultoh_round_to_nearest helper_vfp_ultoh_round_to_nearest_sparc
#define helper_wfe helper_wfe_sparc
#define helper_wfi helper_wfi_sparc
#define helper_yield helper_yield_sparc

View file

@ -2079,6 +2079,18 @@
#define helper_vfp_uqtod helper_vfp_uqtod_sparc64
#define helper_vfp_uqtoh helper_vfp_uqtoh_sparc64
#define helper_vfp_uqtos helper_vfp_uqtos_sparc64
#define helper_vfp_shtos_round_to_nearest helper_vfp_shtos_round_to_nearest_sparc64
#define helper_vfp_sltos_round_to_nearest helper_vfp_sltos_round_to_nearest_sparc64
#define helper_vfp_uhtos_round_to_nearest helper_vfp_uhtos_round_to_nearest_sparc64
#define helper_vfp_ultos_round_to_nearest helper_vfp_ultos_round_to_nearest_sparc64
#define helper_vfp_shtod_round_to_nearest helper_vfp_shtod_round_to_nearest_sparc64
#define helper_vfp_sltod_round_to_nearest helper_vfp_sltod_round_to_nearest_sparc64
#define helper_vfp_uhtod_round_to_nearest helper_vfp_uhtod_round_to_nearest_sparc64
#define helper_vfp_ultod_round_to_nearest helper_vfp_ultod_round_to_nearest_sparc64
#define helper_vfp_shtoh_round_to_nearest helper_vfp_shtoh_round_to_nearest_sparc64
#define helper_vfp_uhtoh_round_to_nearest helper_vfp_uhtoh_round_to_nearest_sparc64
#define helper_vfp_sltoh_round_to_nearest helper_vfp_sltoh_round_to_nearest_sparc64
#define helper_vfp_ultoh_round_to_nearest helper_vfp_ultoh_round_to_nearest_sparc64
#define helper_wfe helper_wfe_sparc64
#define helper_wfi helper_wfi_sparc64
#define helper_yield helper_yield_sparc64

View file

@ -211,6 +211,19 @@ DEF_HELPER_3(vfp_ultoh, f16, i32, i32, ptr)
DEF_HELPER_3(vfp_sqtoh, f16, i64, i32, ptr)
DEF_HELPER_3(vfp_uqtoh, f16, i64, i32, ptr)
DEF_HELPER_3(vfp_shtos_round_to_nearest, f32, i32, i32, ptr)
DEF_HELPER_3(vfp_sltos_round_to_nearest, f32, i32, i32, ptr)
DEF_HELPER_3(vfp_uhtos_round_to_nearest, f32, i32, i32, ptr)
DEF_HELPER_3(vfp_ultos_round_to_nearest, f32, i32, i32, ptr)
DEF_HELPER_3(vfp_shtod_round_to_nearest, f64, i64, i32, ptr)
DEF_HELPER_3(vfp_sltod_round_to_nearest, f64, i64, i32, ptr)
DEF_HELPER_3(vfp_uhtod_round_to_nearest, f64, i64, i32, ptr)
DEF_HELPER_3(vfp_ultod_round_to_nearest, f64, i64, i32, ptr)
DEF_HELPER_3(vfp_shtoh_round_to_nearest, f16, i32, i32, ptr)
DEF_HELPER_3(vfp_uhtoh_round_to_nearest, f16, i32, i32, ptr)
DEF_HELPER_3(vfp_sltoh_round_to_nearest, f16, i32, i32, ptr)
DEF_HELPER_3(vfp_ultoh_round_to_nearest, f16, i32, i32, ptr)
DEF_HELPER_FLAGS_2(set_rmode, TCG_CALL_NO_RWG, i32, i32, ptr)
DEF_HELPER_FLAGS_3(vfp_fcvt_f16_to_f32, TCG_CALL_NO_RWG, f32, f16, ptr, i32)

View file

@ -3197,16 +3197,16 @@ static bool trans_VCVT_fix_hp(DisasContext *s, arg_VCVT_fix_sp *a)
/* Switch on op:U:sx bits */
switch (a->opc) {
case 0:
gen_helper_vfp_shtoh(tcg_ctx, vd, vd, shift, fpst);
gen_helper_vfp_shtoh_round_to_nearest(tcg_ctx, vd, vd, shift, fpst);
break;
case 1:
gen_helper_vfp_sltoh(tcg_ctx, vd, vd, shift, fpst);
gen_helper_vfp_sltoh_round_to_nearest(tcg_ctx, vd, vd, shift, fpst);
break;
case 2:
gen_helper_vfp_uhtoh(tcg_ctx, vd, vd, shift, fpst);
gen_helper_vfp_uhtoh_round_to_nearest(tcg_ctx, vd, vd, shift, fpst);
break;
case 3:
gen_helper_vfp_ultoh(tcg_ctx, vd, vd, shift, fpst);
gen_helper_vfp_ultoh_round_to_nearest(tcg_ctx, vd, vd, shift, fpst);
break;
case 4:
gen_helper_vfp_toshh_round_to_zero(tcg_ctx, vd, vd, shift, fpst);
@ -3257,16 +3257,16 @@ static bool trans_VCVT_fix_sp(DisasContext *s, arg_VCVT_fix_sp *a)
/* Switch on op:U:sx bits */
switch (a->opc) {
case 0:
gen_helper_vfp_shtos(tcg_ctx, vd, vd, shift, fpst);
gen_helper_vfp_shtos_round_to_nearest(tcg_ctx, vd, vd, shift, fpst);
break;
case 1:
gen_helper_vfp_sltos(tcg_ctx, vd, vd, shift, fpst);
gen_helper_vfp_sltos_round_to_nearest(tcg_ctx, vd, vd, shift, fpst);
break;
case 2:
gen_helper_vfp_uhtos(tcg_ctx, vd, vd, shift, fpst);
gen_helper_vfp_uhtos_round_to_nearest(tcg_ctx, vd, vd, shift, fpst);
break;
case 3:
gen_helper_vfp_ultos(tcg_ctx, vd, vd, shift, fpst);
gen_helper_vfp_ultos_round_to_nearest(tcg_ctx, vd, vd, shift, fpst);
break;
case 4:
gen_helper_vfp_toshs_round_to_zero(tcg_ctx, vd, vd, shift, fpst);
@ -3323,16 +3323,16 @@ static bool trans_VCVT_fix_dp(DisasContext *s, arg_VCVT_fix_dp *a)
/* Switch on op:U:sx bits */
switch (a->opc) {
case 0:
gen_helper_vfp_shtod(tcg_ctx, vd, vd, shift, fpst);
gen_helper_vfp_shtod_round_to_nearest(tcg_ctx, vd, vd, shift, fpst);
break;
case 1:
gen_helper_vfp_sltod(tcg_ctx, vd, vd, shift, fpst);
gen_helper_vfp_sltod_round_to_nearest(tcg_ctx, vd, vd, shift, fpst);
break;
case 2:
gen_helper_vfp_uhtod(tcg_ctx, vd, vd, shift, fpst);
gen_helper_vfp_uhtod_round_to_nearest(tcg_ctx, vd, vd, shift, fpst);
break;
case 3:
gen_helper_vfp_ultod(tcg_ctx, vd, vd, shift, fpst);
gen_helper_vfp_ultod_round_to_nearest(tcg_ctx, vd, vd, shift, fpst);
break;
case 4:
gen_helper_vfp_toshd_round_to_zero(tcg_ctx, vd, vd, shift, fpst);

View file

@ -396,12 +396,32 @@ float32 VFP_HELPER(fcvts, d)(float64 x, CPUARMState *env)
return float64_to_float32(x, &env->vfp.fp_status);
}
/* VFP3 fixed point conversion. */
/*
* VFP3 fixed point conversion. The AArch32 versions of fix-to-float
* must always round-to-nearest; the AArch64 ones honour the FPSCR
* rounding mode. (For AArch32 Neon the standard-FPSCR is set to
* round-to-nearest so either helper will work.) AArch32 float-to-fix
* must round-to-zero.
*/
#define VFP_CONV_FIX_FLOAT(name, p, fsz, ftype, isz, itype) \
ftype HELPER(vfp_##name##to##p)(uint##isz##_t x, uint32_t shift, \
void *fpstp) \
{ return itype##_to_##float##fsz##_scalbn(x, -shift, fpstp); }
#define VFP_CONV_FIX_FLOAT_ROUND(name, p, fsz, ftype, isz, itype) \
ftype HELPER(vfp_##name##to##p##_round_to_nearest)(uint##isz##_t x, \
uint32_t shift, \
void *fpstp) \
{ \
ftype ret; \
float_status *fpst = fpstp; \
FloatRoundMode oldmode = fpst->float_rounding_mode; \
fpst->float_rounding_mode = float_round_nearest_even; \
ret = itype##_to_##float##fsz##_scalbn(x, -shift, fpstp); \
fpst->float_rounding_mode = oldmode; \
return ret; \
}
#define VFP_CONV_FLOAT_FIX_ROUND(name, p, fsz, ftype, isz, itype, ROUND, suff) \
uint##isz##_t HELPER(vfp_to##name##p##suff)(ftype x, uint32_t shift, \
void *fpst) \
@ -415,6 +435,7 @@ uint##isz##_t HELPER(vfp_to##name##p##suff)(ftype x, uint32_t shift, \
#define VFP_CONV_FIX(name, p, fsz, ftype, isz, itype) \
VFP_CONV_FIX_FLOAT(name, p, fsz, ftype, isz, itype) \
VFP_CONV_FIX_FLOAT_ROUND(name, p, fsz, ftype, isz, itype) \
VFP_CONV_FLOAT_FIX_ROUND(name, p, fsz, ftype, isz, itype, \
float_round_to_zero, _round_to_zero) \
VFP_CONV_FLOAT_FIX_ROUND(name, p, fsz, ftype, isz, itype, \

View file

@ -2079,6 +2079,18 @@
#define helper_vfp_uqtod helper_vfp_uqtod_x86_64
#define helper_vfp_uqtoh helper_vfp_uqtoh_x86_64
#define helper_vfp_uqtos helper_vfp_uqtos_x86_64
#define helper_vfp_shtos_round_to_nearest helper_vfp_shtos_round_to_nearest_x86_64
#define helper_vfp_sltos_round_to_nearest helper_vfp_sltos_round_to_nearest_x86_64
#define helper_vfp_uhtos_round_to_nearest helper_vfp_uhtos_round_to_nearest_x86_64
#define helper_vfp_ultos_round_to_nearest helper_vfp_ultos_round_to_nearest_x86_64
#define helper_vfp_shtod_round_to_nearest helper_vfp_shtod_round_to_nearest_x86_64
#define helper_vfp_sltod_round_to_nearest helper_vfp_sltod_round_to_nearest_x86_64
#define helper_vfp_uhtod_round_to_nearest helper_vfp_uhtod_round_to_nearest_x86_64
#define helper_vfp_ultod_round_to_nearest helper_vfp_ultod_round_to_nearest_x86_64
#define helper_vfp_shtoh_round_to_nearest helper_vfp_shtoh_round_to_nearest_x86_64
#define helper_vfp_uhtoh_round_to_nearest helper_vfp_uhtoh_round_to_nearest_x86_64
#define helper_vfp_sltoh_round_to_nearest helper_vfp_sltoh_round_to_nearest_x86_64
#define helper_vfp_ultoh_round_to_nearest helper_vfp_ultoh_round_to_nearest_x86_64
#define helper_wfe helper_wfe_x86_64
#define helper_wfi helper_wfi_x86_64
#define helper_yield helper_yield_x86_64