target/xtensa: implement double precision FPU
cover target/xtensa: implement double precision FPU
Hello,
this series implements double precision floating point unit option for target/xtensa, updates FPU tests and adds two new CPU cores, one with FPU2000 option and one with DFPU option.
Max Filippov (21):
softfloat: make NO_SIGNALING_NANS runtime property
softfloat: pass float_status pointer to pickNaN
softfloat: add xtensa specialization for pickNaNMulAdd target/xtensa: add geometry to xtensa_get_regfile_by_name target/xtensa: support copying registers up to 64 bits wide target/xtensa: rename FPU2000 translators and helpers target/xtensa: move FSR/FCR register accessors target/xtensa: don't access BR regfile directly target/xtensa: add DFP option, registers and opcodes target/xtensa: implement FPU division and square root tests/tcg/xtensa: fix test execution on ISS tests/tcg/xtensa: update test_fp0_arith for DFPU tests/tcg/xtensa: expand madd tests tests/tcg/xtensa: update test_fp0_conv for DFPU tests/tcg/xtensa: update test_fp1 for DFPU tests/tcg/xtensa: update test_lsc for DFPU tests/tcg/xtensa: add fp0 div and sqrt tests tests/tcg/xtensa: test double precision load/store tests/tcg/xtensa: add DFP0 arith tests target/xtensa: import DE_233L_FPU core target/xtensa: import DSP3400 core
fpu/softfloat-specialize.inc.c | 276 +- fpu/softfloat.c | 2 +- include/fpu/softfloat-helpers.h | 10 + include/fpu/softfloat-types.h | 2 + target/xtensa/Makefile.objs | 2 + target/xtensa/core-DE_233L_FPU.c | 31 + target/xtensa/core-DE_233L_FPU/core-isa.h | 727 + target/xtensa/core-DE_233L_FPU/core-matmap.h | 717 + .../xtensa/core-DE_233L_FPU/gdb-config.inc.c | 277 + .../core-DE_233L_FPU/xtensa-modules.inc.c | 20758 ++ target/xtensa/core-dsp3400.c | 31 + target/xtensa/core-dsp3400/core-isa.h | 452 + target/xtensa/core-dsp3400/core-matmap.h | 312 + target/xtensa/core-dsp3400/gdb-config.inc.c | 400 + .../xtensa/core-dsp3400/xtensa-modules.inc.c | 171906 +++++++++++++++ target/xtensa/cpu.c | 4 + target/xtensa/cpu.h | 7 +- target/xtensa/fpu_helper.c | 314 +- target/xtensa/helper.c | 4 +- target/xtensa/helper.h | 53 +- target/xtensa/overlay_tool.h | 6 + target/xtensa/translate.c | 1345 +- tests/tcg/xtensa/fpu.h | 142 + tests/tcg/xtensa/macros.inc | 10 +- tests/tcg/xtensa/test_dfp0_arith.S | 153 + tests/tcg/xtensa/test_fp0_arith.S | 266 +- tests/tcg/xtensa/test_fp0_conv.S | 299 +- tests/tcg/xtensa/test_fp0_div.S | 82 + tests/tcg/xtensa/test_fp0_sqrt.S | 76 + tests/tcg/xtensa/test_fp1.S | 62 +- tests/tcg/xtensa/test_lsc.S | 170 +- 31 files changed, 198354 insertions(+), 542 deletions(-) create mode 100644 target/xtensa/core-DE_233L_FPU.c create mode 100644 target/xtensa/core-DE_233L_FPU/core-isa.h create mode 100644 target/xtensa/core-DE_233L_FPU/core-matmap.h create mode 100644 target/xtensa/core-DE_233L_FPU/gdb-config.inc.c create mode 100644 target/xtensa/core-DE_233L_FPU/xtensa-modules.inc.c create mode 100644 target/xtensa/core-dsp3400.c create mode 100644 target/xtensa/core-dsp3400/core-isa.h create mode 100644 target/xtensa/core-dsp3400/core-matmap.h create mode 100644 target/xtensa/core-dsp3400/gdb-config.inc.c create mode 100644 target/xtensa/core-dsp3400/xtensa-modules.inc.c create mode 100644 tests/tcg/xtensa/fpu.h create mode 100644 tests/tcg/xtensa/test_dfp0_arith.S create mode 100644 tests/tcg/xtensa/test_fp0_div.S create mode 100644 tests/tcg/xtensa/test_fp0_sqrt.S
Signature · 1 line
2.20.1
PATCH 1/21 softfloat: make NO_SIGNALING_NANS runtime property
target/xtensa, the only user of NO_SIGNALING_NANS macro has FPU implementations with and without the corresponding property. With NO_SIGNALING_NANS being a macro they cannot be a part of the same QEMU executable.
Replace macro with new property in float_status to allow cores with different FPU implementations coexist.
--- fpu/softfloat-specialize.inc.c | 228 ++++++++++++++++---------------- include/fpu/softfloat-helpers.h | 5 + include/fpu/softfloat-types.h | 1 + 3 files changed, 117 insertions(+), 117 deletions(-)
fpu/softfloat-specialize.inc.c +111 -117
@@ -79,13 +79,6 @@ this code that are retained.* version 2 or later. See the COPYING file in the top-level directory. */ -/* Define for architectures which deviate from IEEE in not supporting -* signaling NaNs (so all NaNs are treated as quiet). -*/ -#if defined(TARGET_XTENSA ) -#define NO_SIGNALING_NANS 1 -#endif -/* Define how the architecture discriminates signaling NaNs. * This done with the most significant bit of the fraction. * In IEEE 754-1985 this was implementation defined, but in IEEE 754-2008
@@ -111,12 +104,12 @@ static inline bool snan_bit_is_one(float_status *status)static bool parts_is_snan_frac (uint64_t frac,float_status *status) { -#ifdef NO_SIGNALING_NANS -return false; -#else -bool msb =extract64 (frac,DECOMPOSED_BINARY_POINT -1 ,1 ); -return msb ==snan_bit_is_one (status); -#endif +if (status->no_signaling_nans) { +return false; + }else { +bool msb =extract64 (frac,DECOMPOSED_BINARY_POINT -1 ,1 ); +return msb ==snan_bit_is_one (status); + } }/*----------------------------------------------------------------------------
@@ -170,9 +163,10 @@ static FloatParts parts_default_nan(float_status *status)static FloatParts parts_silence_nan (FloatParts a,float_status *status) { -#ifdef NO_SIGNALING_NANS -g_assert_not_reached (); -#elif defined(TARGET_HPPA ) +if (status->no_signaling_nans) { +g_assert_not_reached (); + } +#if defined(TARGET_HPPA ) a.frac &= ~(1ULL << (DECOMPOSED_BINARY_POINT -1 )); a.frac |=1ULL << (DECOMPOSED_BINARY_POINT -2 );#else
@@ -247,16 +241,16 @@ typedef struct {bool float16_is_quiet_nan (float16 a_,float_status *status) { -#ifdef NO_SIGNALING_NANS -return float16_is_any_nan (a_); -#else -uint16_t a =float16_val (a_); -if (snan_bit_is_one (status)) { -return (((a >>9 ) &0x3F ) ==0x3E ) && (a &0x1FF ); +if (status->no_signaling_nans) { +return float16_is_any_nan (a_); }else { -return ((a & ~0x8000 ) >=0x7C80 ); +uint16_t a =float16_val (a_); +if (snan_bit_is_one (status)) { +return (((a >>9 ) &0x3F ) ==0x3E ) && (a &0x1FF ); + }else { +return ((a & ~0x8000 ) >=0x7C80 ); + } } -#endif }/*----------------------------------------------------------------------------
@@ -266,16 +260,16 @@ bool float16_is_quiet_nan(float16 a_, float_status *status)bool float16_is_signaling_nan (float16 a_,float_status *status) { -#ifdef NO_SIGNALING_NANS -return 0 ; -#else -uint16_t a =float16_val (a_); -if (snan_bit_is_one (status)) { -return ((a & ~0x8000 ) >=0x7C80 ); +if (status->no_signaling_nans) { +return 0 ; }else { -return (((a >>9 ) &0x3F ) ==0x3E ) && (a &0x1FF ); +uint16_t a =float16_val (a_); +if (snan_bit_is_one (status)) { +return ((a & ~0x8000 ) >=0x7C80 ); + }else { +return (((a >>9 ) &0x3F ) ==0x3E ) && (a &0x1FF ); + } } -#endif }/*----------------------------------------------------------------------------
@@ -285,16 +279,16 @@ bool float16_is_signaling_nan(float16 a_, float_status *status)bool float32_is_quiet_nan (float32 a_,float_status *status) { -#ifdef NO_SIGNALING_NANS -return float32_is_any_nan (a_); -#else -uint32_t a =float32_val (a_); -if (snan_bit_is_one (status)) { -return (((a >>22 ) &0x1FF ) ==0x1FE ) && (a &0x003FFFFF ); +if (status->no_signaling_nans) { +return float32_is_any_nan (a_); }else { -return ((uint32_t )(a <<1 ) >=0xFF800000 ); +uint32_t a =float32_val (a_); +if (snan_bit_is_one (status)) { +return (((a >>22 ) &0x1FF ) ==0x1FE ) && (a &0x003FFFFF ); + }else { +return ((uint32_t )(a <<1 ) >=0xFF800000 ); + } } -#endif }/*----------------------------------------------------------------------------
@@ -304,16 +298,16 @@ bool float32_is_quiet_nan(float32 a_, float_status *status)bool float32_is_signaling_nan (float32 a_,float_status *status) { -#ifdef NO_SIGNALING_NANS -return 0 ; -#else -uint32_t a =float32_val (a_); -if (snan_bit_is_one (status)) { -return ((uint32_t )(a <<1 ) >=0xFF800000 ); +if (status->no_signaling_nans) { +return 0 ; }else { -return (((a >>22 ) &0x1FF ) ==0x1FE ) && (a &0x003FFFFF ); +uint32_t a =float32_val (a_); +if (snan_bit_is_one (status)) { +return ((uint32_t )(a <<1 ) >=0xFF800000 ); + }else { +return (((a >>22 ) &0x1FF ) ==0x1FE ) && (a &0x003FFFFF ); + } } -#endif }/*----------------------------------------------------------------------------
@@ -639,17 +633,17 @@ static float32 propagateFloat32NaN(float32 a, float32 b, float_status *status)bool float64_is_quiet_nan (float64 a_,float_status *status) { -#ifdef NO_SIGNALING_NANS -return float64_is_any_nan (a_); -#else -uint64_t a =float64_val (a_); -if (snan_bit_is_one (status)) { -return (((a >>51 ) &0xFFF ) ==0xFFE ) - && (a &0x0007FFFFFFFFFFFFULL ); +if (status->no_signaling_nans) { +return float64_is_any_nan (a_); }else { -return ((a <<1 ) >=0xFFF0000000000000ULL ); +uint64_t a =float64_val (a_); +if (snan_bit_is_one (status)) { +return (((a >>51 ) &0xFFF ) ==0xFFE ) + && (a &0x0007FFFFFFFFFFFFULL ); + }else { +return ((a <<1 ) >=0xFFF0000000000000ULL ); + } } -#endif }/*----------------------------------------------------------------------------
@@ -659,17 +653,17 @@ bool float64_is_quiet_nan(float64 a_, float_status *status)bool float64_is_signaling_nan (float64 a_,float_status *status) { -#ifdef NO_SIGNALING_NANS -return 0 ; -#else -uint64_t a =float64_val (a_); -if (snan_bit_is_one (status)) { -return ((a <<1 ) >=0xFFF0000000000000ULL ); +if (status->no_signaling_nans) { +return 0 ; }else { -return (((a >>51 ) &0xFFF ) ==0xFFE ) - && (a &UINT64_C (0x0007FFFFFFFFFFFF )); +uint64_t a =float64_val (a_); +if (snan_bit_is_one (status)) { +return ((a <<1 ) >=0xFFF0000000000000ULL ); + }else { +return (((a >>51 ) &0xFFF ) ==0xFFE ) + && (a &UINT64_C (0x0007FFFFFFFFFFFF )); + } } -#endif }/*----------------------------------------------------------------------------
@@ -778,21 +772,21 @@ static float64 propagateFloat64NaN(float64 a, float64 b, float_status *status)int floatx80_is_quiet_nan (floatx80 a,float_status *status) { -#ifdef NO_SIGNALING_NANS -return floatx80_is_any_nan (a); -#else -if (snan_bit_is_one (status)) { -uint64_t aLow; - - aLow = a.low & ~0x4000000000000000ULL ; -return ((a.high &0x7FFF ) ==0x7FFF ) - && (aLow <<1 ) - && (a.low == aLow); +if (status->no_signaling_nans) { +return floatx80_is_any_nan (a); }else { -return ((a.high &0x7FFF ) ==0x7FFF ) - && (UINT64_C (0x8000000000000000 ) <= ((uint64_t )(a.low <<1 ))); +if (snan_bit_is_one (status)) { +uint64_t aLow; + + aLow = a.low & ~0x4000000000000000ULL ; +return ((a.high &0x7FFF ) ==0x7FFF ) + && (aLow <<1 ) + && (a.low == aLow); + }else { +return ((a.high &0x7FFF ) ==0x7FFF ) + && (UINT64_C (0x8000000000000000 ) <= ((uint64_t )(a.low <<1 ))); + } } -#endif }/*----------------------------------------------------------------------------
@@ -803,21 +797,21 @@ int floatx80_is_quiet_nan(floatx80 a, float_status *status)int floatx80_is_signaling_nan (floatx80 a,float_status *status) { -#ifdef NO_SIGNALING_NANS -return 0 ; -#else -if (snan_bit_is_one (status)) { -return ((a.high &0x7FFF ) ==0x7FFF ) - && ((a.low <<1 ) >=0x8000000000000000ULL ); +if (status->no_signaling_nans) { +return 0 ; }else { -uint64_t aLow; +if (snan_bit_is_one (status)) { +return ((a.high &0x7FFF ) ==0x7FFF ) + && ((a.low <<1 ) >=0x8000000000000000ULL ); + }else { +uint64_t aLow; - aLow = a.low & ~UINT64_C (0x4000000000000000 ); -return ((a.high &0x7FFF ) ==0x7FFF ) - && (uint64_t )(aLow <<1 ) - && (a.low == aLow); + aLow = a.low & ~UINT64_C (0x4000000000000000 ); +return ((a.high &0x7FFF ) ==0x7FFF ) + && (uint64_t )(aLow <<1 ) + && (a.low == aLow); + } } -#endif }/*----------------------------------------------------------------------------
@@ -941,17 +935,17 @@ floatx80 propagateFloatx80NaN(floatx80 a, floatx80 b, float_status *status)bool float128_is_quiet_nan (float128 a,float_status *status) { -#ifdef NO_SIGNALING_NANS -return float128_is_any_nan (a); -#else -if (snan_bit_is_one (status)) { -return (((a.high >>47 ) &0xFFFF ) ==0xFFFE ) - && (a.low || (a.high &0x00007FFFFFFFFFFFULL )); +if (status->no_signaling_nans) { +return float128_is_any_nan (a); }else { -return ((a.high <<1 ) >=0xFFFF000000000000ULL ) - && (a.low || (a.high &0x0000FFFFFFFFFFFFULL )); +if (snan_bit_is_one (status)) { +return (((a.high >>47 ) &0xFFFF ) ==0xFFFE ) + && (a.low || (a.high &0x00007FFFFFFFFFFFULL )); + }else { +return ((a.high <<1 ) >=0xFFFF000000000000ULL ) + && (a.low || (a.high &0x0000FFFFFFFFFFFFULL )); + } } -#endif }/*----------------------------------------------------------------------------
@@ -961,17 +955,17 @@ bool float128_is_quiet_nan(float128 a, float_status *status)bool float128_is_signaling_nan (float128 a,float_status *status) { -#ifdef NO_SIGNALING_NANS -return 0 ; -#else -if (snan_bit_is_one (status)) { -return ((a.high <<1 ) >=0xFFFF000000000000ULL ) - && (a.low || (a.high &0x0000FFFFFFFFFFFFULL )); +if (status->no_signaling_nans) { +return 0 ; }else { -return (((a.high >>47 ) &0xFFFF ) ==0xFFFE ) - && (a.low || (a.high &UINT64_C (0x00007FFFFFFFFFFF ))); +if (snan_bit_is_one (status)) { +return ((a.high <<1 ) >=0xFFFF000000000000ULL ) + && (a.low || (a.high &0x0000FFFFFFFFFFFFULL )); + }else { +return (((a.high >>47 ) &0xFFFF ) ==0xFFFE ) + && (a.low || (a.high &UINT64_C (0x00007FFFFFFFFFFF ))); + } } -#endif }/*----------------------------------------------------------------------------
@@ -981,16 +975,16 @@ bool float128_is_signaling_nan(float128 a, float_status *status)float128 float128_silence_nan (float128 a,float_status *status) { -#ifdef NO_SIGNALING_NANS -g_assert_not_reached (); -#else -if (snan_bit_is_one (status)) { -return float128_default_nan (status); +if (status->no_signaling_nans) { +g_assert_not_reached (); }else { - a.high |=UINT64_C (0x0000800000000000 ); -return a; +if (snan_bit_is_one (status)) { +return float128_default_nan (status); + }else { + a.high |=UINT64_C (0x0000800000000000 ); +return a; + } } -#endif }/*----------------------------------------------------------------------------
include/fpu/softfloat-helpers.h +5 -0
@@ -95,6 +95,11 @@ static inline void set_snan_bit_is_one(bool val, float_status *status) status->snan_bit_is_one = val; } +static inline void set_no_signaling_nans (bool val,float_status *status) +{ + status->no_signaling_nans = val; +} +static inline bool get_float_detect_tininess (float_status *status) {return status->tininess_before_rounding;
include/fpu/softfloat-types.h +1 -0
@@ -167,6 +167,7 @@ typedef struct float_status {bool default_nan_mode;/* not always used -- see snan_bit_is_one() in softfloat-specialize.h */ bool snan_bit_is_one; + bool no_signaling_nans; } float_status;#endif /* SOFTFLOAT_TYPES_H */
Signature · 1 line
2.20.1
Re: [PATCH 01/21] softfloat: make NO_SIGNALING_NANS runtime property
Quoted 36 lines · Max Filippov
target/xtensa, the only user of
NO_SIGNALING_NANSmacro has FPU implementations with and without the corresponding property. WithNO_SIGNALING_NANSbeing a macro they cannot be a part of the same QEMU executable.
Replace macro with new property infloat_statusto allow cores with different FPU implementations coexist.Cc Peter Maydell <[email protected]>Cc "Alex Bennée" <[email protected]>Signed-off-by Max Filippov <[email protected]>--- fpu/softfloat-specialize.inc.c | 228 ++++++++++++++++---------------- include/fpu/softfloat-helpers.h | 5 + include/fpu/softfloat-types.h | 1 + 3 files changed, 117 insertions(+), 117 deletions(-)fpu/softfloat-specialize.inc.c +0
-7@@ -79,13 +79,6 @@ this code that are retained.* version 2 or later. See the COPYING file in the top-level directory. */ -/* Define for architectures which deviate from IEEE in not supporting -* signaling NaNs (so all NaNs are treated as quiet). -*/ -#if defined(TARGET_XTENSA ) -#define NO_SIGNALING_NANS 1 -#endif -/* Define how the architecture discriminates signaling NaNs. * This done with the most significant bit of the fraction. * In IEEE 754-1985 this was implementation defined, but in IEEE 754-2008 @@ -111,12 +104,12 @@ static inline bool snan_bit_is_one(float_status *status)
fpu/softfloat-specialize.inc.c static inline bool snan_bit_is_one(float_status *status) · line 108
Quoted 10 lines
fpu/softfloat-specialize.inc.c +2
-6static bool parts_is_snan_frac (uint64_t frac,float_status *status) { -#ifdef NO_SIGNALING_NANS -return false; -#else -bool msb =extract64 (frac,DECOMPOSED_BINARY_POINT -1 ,1 ); -return msb ==snan_bit_is_one (status); -#endif +if (status->no_signaling_nans) { +return false;
I have no objection in principle but seeing as we go to the trouble of allowing snan_bit_is_one() to constant fold away I think it would be worth doing the same with a no_signalling_nans(status). We can then avoid an admittedly well predicted test for the non XTENSA case.
fpu/softfloat-specialize.inc.c static FloatParts parts_default_nan(float_status *status) · line 174
Quoted 13 lines
fpu/softfloat-specialize.inc.c +4
-2+ }else { +bool msb =extract64 (frac,DECOMPOSED_BINARY_POINT -1 ,1 ); +return msb ==snan_bit_is_one (status); + } }/*---------------------------------------------------------------------------- @@ -170,9 +163,10 @@ static FloatParts parts_default_nan(float_status *status)static FloatParts parts_silence_nan (FloatParts a,float_status *status) { -#ifdef NO_SIGNALING_NANS -g_assert_not_reached ();
We could then keep the assert:
g_assert(!no_signaling_nan(status))
<snip>
include/fpu/softfloat-types.h typedef struct float_status { · line 169
Quoted 9 lines
fpu/softfloat-specialize.inc.c +0
-0return status->tininess_before_rounding;include/fpu/softfloat-types.h +0
-0@@ -167,6 +167,7 @@ typedef struct float_status {bool default_nan_mode;/* not always used -- see snan_bit_is_one() in softfloat-specialize.h */
and then expand this comment:
/* the flags bellow are not used on all specializations and may
* constant fold away (see snan_bit_is_one()/no_signalling_nans() in
* softfloat-specialize.h)
*/
Quoted 5 lines
include/fpu/softfloat-types.h +1
-0bool snan_bit_is_one; +bool no_signaling_nans; } float_status;#endif /*
SOFTFLOAT_TYPES_H*/
Signature · 1 line
Alex Bennée
Re: [PATCH 01/21] softfloat: make NO_SIGNALING_NANS runtime property
In reply to Max FilippovQuoted 7 lines · Max Filippov
target/xtensa, the only user of
NO_SIGNALING_NANSmacro has FPU implementations with and without the corresponding property. WithNO_SIGNALING_NANSbeing a macro they cannot be a part of the same QEMU executable.
Replace macro with new property infloat_statusto allow cores with different FPU implementations coexist.
Quoted 8 lines
Cc Peter Maydell <[email protected]>Cc "Alex Bennée" <[email protected]>Signed-off-by Max Filippov <[email protected]>--- fpu/softfloat-specialize.inc.c | 228 ++++++++++++++++---------------- include/fpu/softfloat-helpers.h | 5 + include/fpu/softfloat-types.h | 1 + 3 files changed, 117 insertions(+), 117 deletions(-)
PATCH 2/21 softfloat: pass float_status pointer to pickNaN
In reply to Max FilippovPass float_status structure pointer to the pickNaN so that machine-specific settings are available to NaN selection code. Add use_first_nan property to float_status and use it in Xtensa-specific pickNaN.
--- fpu/softfloat-specialize.inc.c | 30 ++++++++++++++++++++++++------ fpu/softfloat.c | 2 +- include/fpu/softfloat-helpers.h | 5 +++++ include/fpu/softfloat-types.h | 1 + 4 files changed, 31 insertions(+), 7 deletions(-)
fpu/softfloat-specialize.inc.c +24 -6
@@ -368,7 +368,7 @@ static float32 commonNaNToFloat32(commonNaNT a, float_status *status)*----------------------------------------------------------------------------*/ static int pickNaN (FloatClass a_cls,FloatClass b_cls, -bool aIsLargerSignificand) +bool aIsLargerSignificand,float_status *status) {#if defined(TARGET_ARM ) || defined(TARGET_MIPS ) || defined(TARGET_HPPA )/* ARM mandated NaN propagation rules (see FPProcessNaNs()), take
@@ -401,7 +401,7 @@ static int pickNaN(FloatClass a_cls, FloatClass b_cls, } else {return 1 ; } -#elif defined(TARGET_PPC) || defined(TARGET_XTENSA) || defined(TARGET_M68K) +#elif defined(TARGET_PPC) || defined(TARGET_M68K)/* PowerPC propagation rules: * 1. A if it sNaN or qNaN * 2. B if it sNaN or qNaN
@@ -426,6 +426,24 @@ static int pickNaN(FloatClass a_cls, FloatClass b_cls, } else {return 1 ; } +#elif defined(TARGET_XTENSA) +/* +* Xtensa has two NaN propagation modes. +* Which one is active is controlled by float_status::use_first_nan. +*/ +if (status->use_first_nan) { +if (is_nan (a_cls)) { +return 0 ; + }else { +return 1 ; + } + }else { +if (is_nan (b_cls)) { +return 1 ; + }else { +return 0 ; + } + }#else /* This implements x87 NaN propagation rules: * SNaN + QNaN => return the QNaN
@@ -613,7 +631,7 @@ static float32 propagateFloat32NaN(float32 a, float32 b, float_status *status) aIsLargerSignificand = (av < bv) ?1 :0 ; } -if (pickNaN (a_cls, b_cls, aIsLargerSignificand)) { +if (pickNaN (a_cls, b_cls, aIsLargerSignificand, status)) {if (is_snan (b_cls)) {return float32_silence_nan (b, status); }
@@ -751,7 +769,7 @@ static float64 propagateFloat64NaN(float64 a, float64 b, float_status *status) aIsLargerSignificand = (av < bv) ?1 :0 ; } -if (pickNaN (a_cls, b_cls, aIsLargerSignificand)) { +if (pickNaN (a_cls, b_cls, aIsLargerSignificand, status)) {if (is_snan (b_cls)) {return float64_silence_nan (b, status); }
@@ -915,7 +933,7 @@ floatx80 propagateFloatx80NaN(floatx80 a, floatx80 b, float_status *status) aIsLargerSignificand = (a.high < b.high) ?1 :0 ; } -if (pickNaN (a_cls, b_cls, aIsLargerSignificand)) { +if (pickNaN (a_cls, b_cls, aIsLargerSignificand, status)) {if (is_snan (b_cls)) {return floatx80_silence_nan (b, status); }
@@ -1063,7 +1081,7 @@ static float128 propagateFloat128NaN(float128 a, float128 b, aIsLargerSignificand = (a.high < b.high) ?1 :0 ; } -if (pickNaN (a_cls, b_cls, aIsLargerSignificand)) { +if (pickNaN (a_cls, b_cls, aIsLargerSignificand, status)) {if (is_snan (b_cls)) {return float128_silence_nan (b, status); }
fpu/softfloat.c +1 -1
@@ -881,7 +881,7 @@ static FloatParts pick_nan(FloatParts a, FloatParts b, float_status *s) }else {if (pickNaN (a.cls, b.cls, a.frac > b.frac || - (a.frac == b.frac && a.sign < b.sign))) { + (a.frac == b.frac && a.sign < b.sign), s)) { a = b; }if (is_snan (a.cls)) {
include/fpu/softfloat-helpers.h +5 -0
@@ -95,6 +95,11 @@ static inline void set_snan_bit_is_one(bool val, float_status *status) status->snan_bit_is_one = val; } +static inline void set_use_first_nan (bool val,float_status *status) +{ + status->use_first_nan = val; +} +static inline void set_no_signaling_nans (bool val,float_status *status) { status->no_signaling_nans = val;
include/fpu/softfloat-types.h +1 -0
@@ -167,6 +167,7 @@ typedef struct float_status {bool default_nan_mode;/* not always used -- see snan_bit_is_one() in softfloat-specialize.h */ bool snan_bit_is_one; +bool use_first_nan;bool no_signaling_nans; } float_status;
Signature · 1 line
2.20.1
Re: [PATCH 02/21] softfloat: pass float_status pointer to pickNaN
Quoted 8 lines · Max Filippov
Pass
float_statusstructure pointer to the pickNaN so that machine-specific settings are available to NaN selection code. Adduse_first_nanproperty tofloat_statusand use it in Xtensa-specific pickNaN.Cc Peter Maydell <[email protected]>Cc "Alex Bennée" <[email protected]>Signed-off-by Max Filippov <[email protected]>
Signature · 1 line
Alex Bennée
PATCH 3/21 softfloat: add xtensa specialization for pickNaNMulAdd
In reply to Max FilippovpickNaNMulAdd logic on Xtensa is the same as pickNaN when applied to the expression (a * b) + c. So with two pickNaN variants there must be two pickNaNMulAdd variants.
--- fpu/softfloat-specialize.inc.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+)
fpu/softfloat-specialize.inc.c +18 -0
@@ -574,6 +574,24 @@ static int pickNaNMulAdd(FloatClass a_cls, FloatClass b_cls, FloatClass c_cls, } else {return 1 ; } +#elif defined(TARGET_XTENSA) +if (status->use_first_nan) { +if (is_nan (a_cls)) { +return 0 ; + }else if (is_nan (b_cls)) { +return 1 ; + }else { +return 2 ; + } + }else { +if (is_nan (c_cls)) { +return 2 ; + }else if (is_nan (b_cls)) { +return 1 ; + }else { +return 0 ; + } + }#else /* A default implementation: prefer a to b to c. * This is unlikely to actually match any real implementation.
Signature · 1 line
2.20.1
Re: [PATCH 03/21] softfloat: add xtensa specialization for pickNaNMulAdd
Quoted 7 lines · Max Filippov
pickNaNMulAdd logic on Xtensa is the same as pickNaN when applied to the expression (a * b) + c. So with two pickNaN variants there must be two pickNaNMulAdd variants.
Cc Peter Maydell <[email protected]>Cc "Alex Bennée" <[email protected]>Signed-off-by Max Filippov <[email protected]>
Signature · 1 line
Alex Bennée
Re: [PATCH 03/21] softfloat: add xtensa specialization for pickNaNMulAdd
In reply to Max FilippovQuoted 3 lines · Max Filippov
pickNaNMulAdd logic on Xtensa is the same as pickNaN when applied to the expression (a * b) + c. So with two pickNaN variants there must be two pickNaNMulAdd variants.
"Is the same as"?
I question the non-use of the infzero parameter.
When infzero, (a * b) = (Inf * 0), which will produce a default QNaN. Your sentence above would suggest that pickNaN is applied twice, so that if use_first_nan, the default nan is chosen above any nan within c.
In addition, is the invalid flag raised for (Inf * 0) + NaN? Does that happen regardless of the use_first_nan setting, or does the whole operation short-circuit?
r~
Re: [PATCH 03/21] softfloat: add xtensa specialization for pickNaNMulAdd
Quoted 6 lines · Richard Henderson
Quoted 3 lines · Max Filippov
pickNaNMulAdd logic on Xtensa is the same as pickNaN when applied to the expression (a * b) + c. So with two pickNaN variants there must be two pickNaNMulAdd variants.
Quoted 7 lines
"Is the same as"?
I question the non-use of the infzero parameter.
When infzero, (a * b) = (Inf * 0), which will produce a default QNaN. Your sentence above would suggest that pickNaN is applied twice, so that if
use_first_nan, the default nan is chosen above any nan within c.
Apparently the description it's wrong: only NaNs in arguments are considered, default NaN produced as a result of (a * b) is never chosen when c is NaN.
Quoted 2 lines
In addition, is the invalid flag raised for (Inf * 0) + NaN? Does that happen regardless of the
use_first_nansetting, or does the whole operation short-circuit?
Flag setting happens regardless of which NaN is chosen. I'll post v3 with a fix for this and additional tests.
Signature · 2 lines
Thanks. -- Max
PATCH 4/21 target/xtensa: add geometry to xtensa_get_regfile_by_name
In reply to Max FilippovRegister file name may not uniquely identify a register file in the set of configurations. E.g. floating point registers may have different size in different configurations. Use register file geometry as additional identifier.
--- target/xtensa/cpu.h | 2 +- target/xtensa/helper.c | 4 +++- target/xtensa/translate.c | 35 +++++++++++++++++++++++++++-------- 3 files changed, 31 insertions(+), 10 deletions(-)
target/xtensa/cpu.h +1 -1
@@ -598,7 +598,7 @@ void xtensa_cpu_do_unaligned_access(CPUState *cpu, vaddr addr,void xtensa_collect_sr_names (const XtensaConfig *config);void xtensa_translate_init (void ); -void **xtensa_get_regfile_by_name (const char *name); +void **xtensa_get_regfile_by_name (const char *name,int entries,int bits);void xtensa_breakpoint_handler (CPUState *cs);void xtensa_register_core (XtensaConfigList *node);void xtensa_sim_open_console (Chardev *chr);
target/xtensa/helper.c +3 -1
@@ -133,8 +133,10 @@ static void init_libisa(XtensaConfig *config) config->regfile = g_new(void **, regfiles); for (i = 0; i < regfiles; ++i) { const char *name = xtensa_regfile_name(config->isa, i); + int entries = xtensa_regfile_num_entries(config->isa, i); + int bits = xtensa_regfile_num_bits(config->isa, i); - config->regfile[i] = xtensa_get_regfile_by_name(name); + config->regfile[i] = xtensa_get_regfile_by_name(name, entries, bits); #ifdef DEBUG if (config->regfile[i] == NULL) { fprintf(stderr, "regfile '%s' not found for %s\n",
target/xtensa/translate.c +27 -8
@@ -227,24 +227,43 @@ void xtensa_translate_init(void) "exclusive_val"); } -void **xtensa_get_regfile_by_name (const char *name) +void **xtensa_get_regfile_by_name (const char *name,int entries,int bits) { +char *geometry_name; +void **res; +if (xtensa_regfile_table ==NULL ) { xtensa_regfile_table =g_hash_table_new (g_str_hash, g_str_equal); +/* +* AR is special. Xtensa translator uses it as a current register +* window, but configuration overlays represent it as a complete +* physical register file. +*/ g_hash_table_insert (xtensa_regfile_table, - (void *)"AR" , (void *)cpu_R); + (void *)"AR 16x32" , (void *)cpu_R);g_hash_table_insert (xtensa_regfile_table, - (void *)"MR" , (void *)cpu_MR); + (void *)"AR 32x32" , (void *)cpu_R);g_hash_table_insert (xtensa_regfile_table, - (void *)"FR" , (void *)cpu_FR); + (void *)"AR 64x32" , (void *)cpu_R); +g_hash_table_insert (xtensa_regfile_table, - (void *)"BR" , (void *)cpu_BR); + (void *)"MR 4x32" , (void *)cpu_MR); +g_hash_table_insert (xtensa_regfile_table, - (void *)"BR4" , (void *)cpu_BR4); + (void *)"FR 16x32" , (void *)cpu_FR); +g_hash_table_insert (xtensa_regfile_table, - (void *)"BR8" , (void *)cpu_BR8); + (void *)"BR 16x1" , (void *)cpu_BR); +g_hash_table_insert (xtensa_regfile_table, + (void *)"BR4 4x4" , (void *)cpu_BR4); +g_hash_table_insert (xtensa_regfile_table, + (void *)"BR8 2x8" , (void *)cpu_BR8); } -return (void **)g_hash_table_lookup (xtensa_regfile_table, (void *)name); + + geometry_name =g_strdup_printf ("%s %dx%d" , name, entries, bits); + res = (void **)g_hash_table_lookup (xtensa_regfile_table, geometry_name); +g_free (geometry_name); +return res; }static inline bool option_enabled (DisasContext *dc,int opt)
Signature · 1 line
2.20.1
PATCH 5/21 target/xtensa: support copying registers up to 64 bits wide
In reply to Max FilippovFLIX dependency breaking code assumes that all registers are 32 bit wide. This may not always be correct.
Extract actual register width from the associated register file and use it to create temporaries of correct width and generate correct data movement instructions.
--- target/xtensa/cpu.h | 1 + target/xtensa/translate.c | 26 +++++++++++++++++++++----- 2 files changed, 22 insertions(+), 5 deletions(-)
target/xtensa/cpu.h +1 -0
@@ -359,6 +359,7 @@ typedef struct opcode_arg {uint32_t raw_imm;void *in;void *out; +uint32_t num_bits; } OpcodeArg;typedef struct DisasContext DisasContext ;
target/xtensa/translate.c +21 -5
@@ -943,10 +943,10 @@ static void disas_xtensa_insn(CPUXtensaState *env, DisasContext *dc)for (opnd = vopnd =0 ; opnd < opnds; ++opnd) {void **register_file =NULL ; +xtensa_regfile rf;if (xtensa_operand_is_register (isa, opc, opnd)) { -xtensa_regfile rf =xtensa_operand_regfile (isa, opc, opnd); - + rf =xtensa_operand_regfile (isa, opc, opnd); register_file = dc->config->regfile[rf];if (rf == dc->config->a_regfile) {
@@ -972,6 +972,9 @@ static void disas_xtensa_insn(CPUXtensaState *env, DisasContext *dc)if (register_file) { arg[vopnd].in = register_file[v]; arg[vopnd].out = register_file[v]; + arg[vopnd].num_bits =xtensa_regfile_num_bits (isa, rf); + }else { + arg[vopnd].num_bits =32 ; } ++vopnd; }
@@ -1111,8 +1114,15 @@ static void disas_xtensa_insn(CPUXtensaState *env, DisasContext *dc)for (i = j =0 ; i < n_arg_copy; ++i) {if (i ==0 || arg_copy[i].resource != resource) { resource = arg_copy[i].resource; - temp =tcg_temp_local_new (); -tcg_gen_mov_i32 (temp, arg_copy[i].arg->in); +if (arg_copy[i].arg->num_bits <=32 ) { + temp =tcg_temp_local_new_i32 (); +tcg_gen_mov_i32 (temp, arg_copy[i].arg->in); + }else if (arg_copy[i].arg->num_bits <=64 ) { + temp =tcg_temp_local_new_i64 (); +tcg_gen_mov_i64 (temp, arg_copy[i].arg->in); + }else { +g_assert_not_reached (); + } arg_copy[i].temp = temp;if (i != j) {
@@ -1143,7 +1153,13 @@ static void disas_xtensa_insn(CPUXtensaState *env, DisasContext *dc) }for (i =0 ; i < n_arg_copy; ++i) { -tcg_temp_free (arg_copy[i].temp); +if (arg_copy[i].arg->num_bits <=32 ) { +tcg_temp_free_i32 (arg_copy[i].temp); + }else if (arg_copy[i].arg->num_bits <=64 ) { +tcg_temp_free_i64 (arg_copy[i].temp); + }else { +g_assert_not_reached (); + } }if (dc->base.is_jmp ==DISAS_NEXT ) {
Signature · 1 line
2.20.1
Re: [PATCH 05/21] target/xtensa: support copying registers up to 64 bits wide
target/xtensa/translate.c static void disas_xtensa_insn(CPUXtensaState *env, DisasContext *dc) · line 1122
Quoted 6 lines · Max Filippov
target/xtensa/translate.c +6
-0+if (arg_copy[i].arg->num_bits <=32 ) { + temp =tcg_temp_local_new_i32 (); +tcg_gen_mov_i32 (temp, arg_copy[i].arg->in); + }else if (arg_copy[i].arg->num_bits <=64 ) { + temp =tcg_temp_local_new_i64 (); +tcg_gen_mov_i64 (temp, arg_copy[i].arg->in);
This shouldn't compile.
You can't assign both TCGv_i32 and TCGv_i64 to the same variable.
What's going on here?
r~
Re: [PATCH 05/21] target/xtensa: support copying registers up to 64 bits wide
Quoted 9 lines · Richard Henderson
target/xtensa/translate.c static void disas_xtensa_insn(CPUXtensaState *env, DisasContext *dc) · line 1122
Quoted 6 lines · Max Filippov
target/xtensa/translate.c +6
-0+if (arg_copy[i].arg->num_bits <=32 ) { + temp =tcg_temp_local_new_i32 (); +tcg_gen_mov_i32 (temp, arg_copy[i].arg->in); + }else if (arg_copy[i].arg->num_bits <=64 ) { + temp =tcg_temp_local_new_i64 (); +tcg_gen_mov_i64 (temp, arg_copy[i].arg->in);
Quoted 5 lines
This shouldn't compile.
You can't assign both
TCGv_i32andTCGv_i64to the same variable.What's going on here?
temp is a void pointer, as well as OpcodeArg::in and OpcodeArg::out.
Signature · 2 lines
Thanks. -- Max
PATCH 6/21 target/xtensa: rename FPU2000 translators and helpers
In reply to Max FilippovAdd _s suffix to all FPU2000 opcode translators and helpers that also have double-precision variant to unify naming and allow adding DFPU implementations. Add _fpu2k_ to the name of wur_fcr helper to make space for the DFPU wur_fcr helper.
--- target/xtensa/fpu_helper.c | 10 +++++----- target/xtensa/helper.h | 10 +++++----- target/xtensa/translate.c | 20 ++++++++++---------- 3 files changed, 20 insertions(+), 20 deletions(-)
target/xtensa/fpu_helper.c +5 -5
@@ -33,7 +33,7 @@#include "exec/exec-all.h" #include "fpu/softfloat.h" -void HELPER (wur_fcr )(CPUXtensaState *env,uint32_t v) +void HELPER (wur_fpu2k_fcr )(CPUXtensaState *env,uint32_t v) {static const int rounding_mode[] = { float_round_nearest_even,
@@ -82,7 +82,7 @@ float32 HELPER(msub_s)(CPUXtensaState *env, float32 a, float32 b, float32 c) &env->fp_status); } -uint32_t HELPER (ftoi )(float32 v,uint32_t rounding_mode,uint32_t scale) +uint32_t HELPER (ftoi_s )(float32 v,uint32_t rounding_mode,uint32_t scale) {float_status fp_status = {0 };
@@ -90,7 +90,7 @@ uint32_t HELPER(ftoi)(float32 v, uint32_t rounding_mode, uint32_t scale)return float32_to_int32 (float32_scalbn (v, scale, &fp_status), &fp_status); } -uint32_t HELPER (ftoui )(float32 v,uint32_t rounding_mode,uint32_t scale) +uint32_t HELPER (ftoui_s )(float32 v,uint32_t rounding_mode,uint32_t scale) {float_status fp_status = {0 };float32 res;
@@ -106,13 +106,13 @@ uint32_t HELPER(ftoui)(float32 v, uint32_t rounding_mode, uint32_t scale) } } -float32 HELPER (itof )(CPUXtensaState *env,uint32_t v,uint32_t scale) +float32 HELPER (itof_s )(CPUXtensaState *env,uint32_t v,uint32_t scale) {return float32_scalbn (int32_to_float32 (v, &env->fp_status), (int32_t )scale, &env->fp_status); } -float32 HELPER (uitof )(CPUXtensaState *env,uint32_t v,uint32_t scale) +float32 HELPER (uitof_s )(CPUXtensaState *env,uint32_t v,uint32_t scale) {return float32_scalbn (uint32_to_float32 (v, &env->fp_status), (int32_t )scale, &env->fp_status);
target/xtensa/helper.h +5 -5
@@ -46,7 +46,7 @@ DEF_HELPER_3(wsr_dbreaka, void, env, i32, i32) DEF_HELPER_3(wsr_dbreakc, void, env, i32, i32)#endif -DEF_HELPER_2(wur_fcr, void, env, i32) +DEF_HELPER_2(wur_fpu2k_fcr, void, env, i32) DEF_HELPER_FLAGS_1(abs_s, TCG_CALL_NO_RWG_SE, f32, f32) DEF_HELPER_FLAGS_1(neg_s, TCG_CALL_NO_RWG_SE, f32, f32)DEF_HELPER_3 (add_s, f32, env, f32, f32)
@@ -54,10 +54,10 @@ DEF_HELPER_3(sub_s, f32, env, f32, f32) DEF_HELPER_3(mul_s, f32, env, f32, f32) DEF_HELPER_4(madd_s, f32, env, f32, f32, f32) DEF_HELPER_4(msub_s, f32, env, f32, f32, f32) -DEF_HELPER_FLAGS_3(ftoi, TCG_CALL_NO_RWG_SE, i32, f32, i32, i32) -DEF_HELPER_FLAGS_3(ftoui, TCG_CALL_NO_RWG_SE, i32, f32, i32, i32) -DEF_HELPER_3(itof, f32, env, i32, i32) -DEF_HELPER_3(uitof, f32, env, i32, i32) +DEF_HELPER_FLAGS_3(ftoi_s, TCG_CALL_NO_RWG_SE, i32, f32, i32, i32) +DEF_HELPER_FLAGS_3(ftoui_s, TCG_CALL_NO_RWG_SE, i32, f32, i32, i32) +DEF_HELPER_3(itof_s, f32, env, i32, i32) +DEF_HELPER_3(uitof_s, f32, env, i32, i32) DEF_HELPER_4(un_s, void, env, i32, f32, f32)DEF_HELPER_4 (oeq_s, void, env, i32, f32, f32)
target/xtensa/translate.c +10 -10
@@ -2813,10 +2813,10 @@ static void translate_wur(DisasContext *dc, const OpcodeArg arg[],tcg_gen_mov_i32 (cpu_UR[par[0 ]], arg[0 ].in); } -static void translate_wur_fcr (DisasContext *dc,const OpcodeArg arg[], -const uint32_t par[]) +static void translate_wur_fpu2k_fcr (DisasContext *dc,const OpcodeArg arg[], +const uint32_t par[]) { -gen_helper_wur_fcr (cpu_env, arg[0 ].in); +gen_helper_wur_fpu2k_fcr (cpu_env, arg[0 ].in); } static void translate_wur_fsr(DisasContext *dc, const OpcodeArg arg[],
@@ -5583,7 +5583,7 @@ static const XtensaOpcodeOps core_ops[] = { .par = (const uint32_t[]){EXPSTATE}, }, { .name = "wur.fcr", - .translate = translate_wur_fcr, + .translate = translate_wur_fpu2k_fcr, .par = (const uint32_t[]){FCR}, .coprocessor = 0x1, }, {
@@ -6373,9 +6373,9 @@ static void translate_float_s(DisasContext *dc, const OpcodeArg arg[],TCGv_i32 scale =tcg_const_i32 (-arg[2 ].imm);if (par[0 ]) { -gen_helper_uitof (arg[0 ].out, cpu_env, arg[1 ].in, scale); +gen_helper_uitof_s (arg[0 ].out, cpu_env, arg[1 ].in, scale); }else { -gen_helper_itof (arg[0 ].out, cpu_env, arg[1 ].in, scale); +gen_helper_itof_s (arg[0 ].out, cpu_env, arg[1 ].in, scale); }tcg_temp_free (scale); }
@@ -6387,11 +6387,11 @@ static void translate_ftoi_s(DisasContext *dc, const OpcodeArg arg[],TCGv_i32 scale =tcg_const_i32 (arg[2 ].imm);if (par[1 ]) { -gen_helper_ftoui (arg[0 ].out, arg[1 ].in, - rounding_mode, scale); +gen_helper_ftoui_s (arg[0 ].out, arg[1 ].in, + rounding_mode, scale); }else { -gen_helper_ftoi (arg[0 ].out, arg[1 ].in, - rounding_mode, scale); +gen_helper_ftoi_s (arg[0 ].out, arg[1 ].in, + rounding_mode, scale); }tcg_temp_free (rounding_mode);tcg_temp_free (scale);
Signature · 1 line
2.20.1
Re: [PATCH 06/21] target/xtensa: rename FPU2000 translators and helpers
Quoted 11 lines · Max Filippov
Add _s suffix to all FPU2000 opcode translators and helpers that also have double-precision variant to unify naming and allow adding DFPU implementations. Add _fpu2k_ to the name of
wur_fcrhelper to make space for the DFPUwur_fcrhelper.Signed-off-by Max Filippov <[email protected]>--- target/xtensa/fpu_helper.c | 10 +++++----- target/xtensa/helper.h | 10 +++++----- target/xtensa/translate.c | 20 ++++++++++---------- 3 files changed, 20 insertions(+), 20 deletions(-)
r~
PATCH 7/21 target/xtensa: move FSR/FCR register accessors
In reply to Max FilippovMove FSR/FCR register accessors from core opcodes to FPU2000 opcodes as they are FPU2000-specific.
--- target/xtensa/translate.c | 64 +++++++++++++++++++-------------------- 1 file changed, 32 insertions(+), 32 deletions(-)
target/xtensa/translate.c +32 -32
@@ -2813,18 +2813,6 @@ static void translate_wur(DisasContext *dc, const OpcodeArg arg[],tcg_gen_mov_i32 (cpu_UR[par[0 ]], arg[0 ].in); } -static void translate_wur_fpu2k_fcr (DisasContext *dc,const OpcodeArg arg[], -const uint32_t par[]) -{ -gen_helper_wur_fpu2k_fcr (cpu_env, arg[0 ].in); -} - -static void translate_wur_fsr (DisasContext *dc,const OpcodeArg arg[], -const uint32_t par[]) -{ -tcg_gen_andi_i32 (cpu_UR[par[0 ]], arg[0 ].in,0xffffff80 ); -} -static void translate_xor (DisasContext *dc,const OpcodeArg arg[],const uint32_t par[]) {
@@ -4665,16 +4653,6 @@ static const XtensaOpcodeOps core_ops[] = { .name = "rur.expstate", .translate = translate_rur, .par = (const uint32_t[]){EXPSTATE}, - }, { - .name = "rur.fcr", - .translate = translate_rur, - .par = (const uint32_t[]){FCR}, - .coprocessor = 0x1, - }, { - .name = "rur.fsr", - .translate = translate_rur, - .par = (const uint32_t[]){FSR}, - .coprocessor = 0x1, }, { .name = "rur.threadptr", .translate = translate_rur,
@@ -5581,16 +5559,6 @@ static const XtensaOpcodeOps core_ops[] = { .name = "wur.expstate", .translate = translate_wur, .par = (const uint32_t[]){EXPSTATE}, - }, { - .name = "wur.fcr", - .translate = translate_wur_fpu2k_fcr, - .par = (const uint32_t[]){FCR}, - .coprocessor = 0x1, - }, { - .name = "wur.fsr", - .translate = translate_wur_fsr, - .par = (const uint32_t[]){FSR}, - .coprocessor = 0x1, }, { .name = "wur.threadptr", .translate = translate_wur,
@@ -6510,6 +6478,18 @@ static void translate_wfr_s(DisasContext *dc, const OpcodeArg arg[],tcg_gen_mov_i32 (arg[0 ].out, arg[1 ].in); } +static void translate_wur_fpu2k_fcr (DisasContext *dc,const OpcodeArg arg[], +const uint32_t par[]) +{ +gen_helper_wur_fpu2k_fcr (cpu_env, arg[0 ].in); +} + +static void translate_wur_fpu2k_fsr (DisasContext *dc,const OpcodeArg arg[], +const uint32_t par[]) +{ +tcg_gen_andi_i32 (cpu_UR[par[0 ]], arg[0 ].in,0xffffff80 ); +} +static const XtensaOpcodeOps fpu2000_ops[] = { { .name ="abs.s" ,
@@ -6632,6 +6612,16 @@ static const XtensaOpcodeOps fpu2000_ops[] = { .translate = translate_ftoi_s, .par = (const uint32_t[]){float_round_nearest_even, false}, .coprocessor = 0x1, + }, { + .name = "rur.fcr", + .translate = translate_rur, + .par = (const uint32_t[]){FCR}, + .coprocessor = 0x1, + }, { + .name = "rur.fsr", + .translate = translate_rur, + .par = (const uint32_t[]){FSR}, + .coprocessor = 0x1, }, { .name = "ssi", .translate = translate_ldsti,
@@ -6699,6 +6689,16 @@ static const XtensaOpcodeOps fpu2000_ops[] = { .name = "wfr", .translate = translate_wfr_s, .coprocessor = 0x1, + }, { + .name = "wur.fcr", + .translate = translate_wur_fpu2k_fcr, + .par = (const uint32_t[]){FCR}, + .coprocessor = 0x1, + }, { + .name = "wur.fsr", + .translate = translate_wur_fpu2k_fsr, + .par = (const uint32_t[]){FSR}, + .coprocessor = 0x1, }, };
Signature · 1 line
2.20.1
Re: [PATCH 07/21] target/xtensa: move FSR/FCR register accessors
Quoted 7 lines · Max Filippov
Move FSR/FCR register accessors from core opcodes to FPU2000 opcodes as they are FPU2000-specific.
Signed-off-by Max Filippov <[email protected]>--- target/xtensa/translate.c | 64 +++++++++++++++++++-------------------- 1 file changed, 32 insertions(+), 32 deletions(-)
r~
PATCH 8/21 target/xtensa: don't access BR regfile directly
In reply to Max FilippovBR registers used in FPU comparison opcodes are available as opcode arguments for translators. Use them. This simplifies comparison helpers interface and makes them usable in FLIX bundles.
--- target/xtensa/fpu_helper.c | 42 +++++++++++++++++--------------------- target/xtensa/helper.h | 14 ++++++------- target/xtensa/translate.c | 20 ++++++++++++++---- 3 files changed, 42 insertions(+), 34 deletions(-)
target/xtensa/fpu_helper.c +19 -23
@@ -118,49 +118,45 @@ float32 HELPER(uitof_s)(CPUXtensaState *env, uint32_t v, uint32_t scale) (int32_t)scale, &env->fp_status); } -static inline void set_br (CPUXtensaState *env,bool v,uint32_t br) +uint32_t HELPER (un_s )(CPUXtensaState *env,float32 a,float32 b) { -if (v) { - env->sregs[BR ] |= br; - }else { - env->sregs[BR ] &= ~br; - } -} - -void HELPER (un_s )(CPUXtensaState *env,uint32_t br,float32 a,float32 b) -{ -set_br (env,float32_unordered_quiet (a, b, &env->fp_status), br); +return float32_unordered_quiet (a, b, &env->fp_status); } -void HELPER (oeq_s )(CPUXtensaState *env,uint32_t br,float32 a,float32 b) +uint32_t HELPER (oeq_s )(CPUXtensaState *env,float32 a,float32 b) { -set_br (env,float32_eq_quiet (a, b, &env->fp_status), br); +return float32_eq_quiet (a, b, &env->fp_status); } -void HELPER (ueq_s )(CPUXtensaState *env,uint32_t br,float32 a,float32 b) +uint32_t HELPER (ueq_s )(CPUXtensaState *env,float32 a,float32 b) {FloatRelation v =float32_compare_quiet (a, b, &env->fp_status); -set_br (env, v == float_relation_equal || v == float_relation_unordered, br); + +return v == float_relation_equal || + v == float_relation_unordered; } -void HELPER (olt_s )(CPUXtensaState *env,uint32_t br,float32 a,float32 b) +uint32_t HELPER (olt_s )(CPUXtensaState *env,float32 a,float32 b) { -set_br (env,float32_lt_quiet (a, b, &env->fp_status), br); +return float32_lt_quiet (a, b, &env->fp_status); } -void HELPER (ult_s )(CPUXtensaState *env,uint32_t br,float32 a,float32 b) +uint32_t HELPER (ult_s )(CPUXtensaState *env,float32 a,float32 b) {FloatRelation v =float32_compare_quiet (a, b, &env->fp_status); -set_br (env, v == float_relation_less || v == float_relation_unordered, br); + +return v == float_relation_less || + v == float_relation_unordered; } -void HELPER (ole_s )(CPUXtensaState *env,uint32_t br,float32 a,float32 b) +uint32_t HELPER (ole_s )(CPUXtensaState *env,float32 a,float32 b) { -set_br (env,float32_le_quiet (a, b, &env->fp_status), br); +return float32_le_quiet (a, b, &env->fp_status); } -void HELPER (ule_s )(CPUXtensaState *env,uint32_t br,float32 a,float32 b) +uint32_t HELPER (ule_s )(CPUXtensaState *env,float32 a,float32 b) {FloatRelation v =float32_compare_quiet (a, b, &env->fp_status); -set_br (env, v != float_relation_greater, br); + +return v != float_relation_greater; }
target/xtensa/helper.h +7 -7
@@ -59,13 +59,13 @@ DEF_HELPER_FLAGS_3(ftoui_s, TCG_CALL_NO_RWG_SE, i32, f32, i32, i32) DEF_HELPER_3(itof_s, f32, env, i32, i32) DEF_HELPER_3(uitof_s, f32, env, i32, i32) -DEF_HELPER_4(un_s, void, env, i32, f32, f32) -DEF_HELPER_4(oeq_s, void, env, i32, f32, f32) -DEF_HELPER_4(ueq_s, void, env, i32, f32, f32) -DEF_HELPER_4(olt_s, void, env, i32, f32, f32) -DEF_HELPER_4(ult_s, void, env, i32, f32, f32) -DEF_HELPER_4(ole_s, void, env, i32, f32, f32) -DEF_HELPER_4(ule_s, void, env, i32, f32, f32) +DEF_HELPER_3(un_s, i32, env, f32, f32) +DEF_HELPER_3(oeq_s, i32, env, f32, f32) +DEF_HELPER_3(ueq_s, i32, env, f32, f32) +DEF_HELPER_3(olt_s, i32, env, f32, f32) +DEF_HELPER_3(ult_s, i32, env, f32, f32) +DEF_HELPER_3(ole_s, i32, env, f32, f32) +DEF_HELPER_3(ule_s, i32, env, f32, f32) DEF_HELPER_2(rer, i32, env, i32)DEF_HELPER_3 (wer, void, env, i32, i32)
target/xtensa/translate.c +16 -4
@@ -6319,7 +6319,7 @@ enum {static void translate_compare_s (DisasContext *dc,const OpcodeArg arg[],const uint32_t par[]) { -static void (*const helper[])(TCGv_env env,TCGv_i32 bit, +static void (*const helper[])(TCGv_i32 res,TCGv_env env,TCGv_i32 s,TCGv_i32 t) = { [COMPARE_UN ] = gen_helper_un_s, [COMPARE_OEQ ] = gen_helper_oeq_s,
@@ -6329,10 +6329,22 @@ static void translate_compare_s(DisasContext *dc, const OpcodeArg arg[], [COMPARE_OLE] = gen_helper_ole_s, [COMPARE_ULE] = gen_helper_ule_s, }; -TCGv_i32 bit =tcg_const_i32 (1 << arg[0 ].imm); +TCGv_i32 zero =tcg_const_i32 (0 ); +TCGv_i32 res =tcg_temp_new_i32 (); +TCGv_i32 set_br =tcg_temp_new_i32 (); +TCGv_i32 clr_br =tcg_temp_new_i32 (); - helper[par[0 ]](cpu_env, bit, arg[1 ].in, arg[2 ].in); -tcg_temp_free (bit); +tcg_gen_ori_i32 (set_br, arg[0 ].in,1 << arg[0 ].imm); +tcg_gen_andi_i32 (clr_br, arg[0 ].in, ~(1 << arg[0 ].imm)); + + helper[par[0 ]](res, cpu_env, arg[1 ].in, arg[2 ].in); +tcg_gen_movcond_i32 (TCG_COND_NE , + arg[0 ].out, res, zero, + set_br, clr_br); +tcg_temp_free (zero); +tcg_temp_free (res); +tcg_temp_free (set_br); +tcg_temp_free (clr_br); } static void translate_float_s(DisasContext *dc, const OpcodeArg arg[],
Signature · 1 line
2.20.1
Re: [PATCH 08/21] target/xtensa: don't access BR regfile directly
Quoted 10 lines · Max Filippov
BR registers used in FPU comparison opcodes are available as opcode arguments for translators. Use them. This simplifies comparison helpers interface and makes them usable in FLIX bundles.
Signed-off-by Max Filippov <[email protected]>--- target/xtensa/fpu_helper.c | 42 +++++++++++++++++--------------------- target/xtensa/helper.h | 14 ++++++------- target/xtensa/translate.c | 20 ++++++++++++++---- 3 files changed, 42 insertions(+), 34 deletions(-)
r~
PATCH 9/21 target/xtensa: add DFP option, registers and opcodes
In reply to Max FilippovDFPU may be configured with 32-bit or with 64-bit registers. Xtensa ISA does not specify how single-precision values are stored in 64-bit registers. Existing implementations store them in the low half of the registers.
Add value extraction and write back to single-precision opcodes. Add new double precision opcodes. Add 64-bit register file. Add 64-bit values dumping to the xtensa_cpu_dump_state.
--- target/xtensa/cpu.c | 4 + target/xtensa/cpu.h | 4 + target/xtensa/fpu_helper.c | 252 +++++++- target/xtensa/helper.h | 29 +- target/xtensa/overlay_tool.h | 6 + target/xtensa/translate.c | 1088 ++++++++++++++++++++++++++++++++-- 6 files changed, 1338 insertions(+), 45 deletions(-)
target/xtensa/cpu.c +4 -0
@@ -31,6 +31,7 @@#include "qemu/osdep.h" #include "qapi/error.h" #include "cpu.h" +#include "fpu/softfloat.h" #include "qemu/module.h" #include "migration/vmstate.h"
@@ -104,6 +105,9 @@ static void xtensa_cpu_reset(DeviceState *dev)reset_mmu (env); s->halted = env->runstall;#endif +if (!xtensa_option_enabled (env->config,XTENSA_OPTION_DFP_COPROCESSOR )) { +set_no_signaling_nans (true, &env->fp_status); + } }static ObjectClass *xtensa_cpu_class_by_name (const char *cpu_model)
target/xtensa/cpu.h +4 -0
@@ -52,6 +52,7 @@ enum {XTENSA_OPTION_COPROCESSOR ,XTENSA_OPTION_BOOLEAN ,XTENSA_OPTION_FP_COPROCESSOR , +XTENSA_OPTION_DFP_COPROCESSOR ,XTENSA_OPTION_MP_SYNCHRO ,XTENSA_OPTION_CONDITIONAL_STORE , XTENSA_OPTION_ATOMCTL,
@@ -420,6 +421,7 @@ typedef struct XtensaOpcodeTranslators {extern const XtensaOpcodeTranslators xtensa_core_opcodes;extern const XtensaOpcodeTranslators xtensa_fpu2000_opcodes; +extern const XtensaOpcodeTranslators xtensa_fpu_opcodes;struct XtensaConfig {const char *name;
@@ -482,6 +484,8 @@ struct XtensaConfig {unsigned n_mpu_fg_segments;unsigned n_mpu_bg_segments;const xtensa_mpu_entry *mpu_bg; + +bool use_first_nan; }; typedef struct XtensaConfigList {
target/xtensa/fpu_helper.c +243 -9
353 lines not on this page · raw message
target/xtensa/helper.h +27 -2
@@ -54,10 +54,11 @@ DEF_HELPER_3(sub_s, f32, env, f32, f32) DEF_HELPER_3(mul_s, f32, env, f32, f32) DEF_HELPER_4(madd_s, f32, env, f32, f32, f32) DEF_HELPER_4(msub_s, f32, env, f32, f32, f32) -DEF_HELPER_FLAGS_3(ftoi_s, TCG_CALL_NO_RWG_SE, i32, f32, i32, i32) -DEF_HELPER_FLAGS_3(ftoui_s, TCG_CALL_NO_RWG_SE, i32, f32, i32, i32) +DEF_HELPER_4(ftoi_s, i32, env, f32, i32, i32) +DEF_HELPER_4(ftoui_s, i32, env, f32, i32, i32) DEF_HELPER_3(itof_s, f32, env, i32, i32) DEF_HELPER_3(uitof_s, f32, env, i32, i32) +DEF_HELPER_2(cvtd_s, f64, env, f32) DEF_HELPER_3(un_s, i32, env, f32, f32)DEF_HELPER_3 (oeq_s, i32, env, f32, f32)
@@ -67,5 +68,29 @@ DEF_HELPER_3(ult_s, i32, env, f32, f32) DEF_HELPER_3(ole_s, i32, env, f32, f32) DEF_HELPER_3(ule_s, i32, env, f32, f32) +DEF_HELPER_2(wur_fpu_fcr, void, env, i32) +DEF_HELPER_1(rur_fpu_fsr, i32, env) +DEF_HELPER_2(wur_fpu_fsr, void, env, i32) +DEF_HELPER_FLAGS_1(abs_d, TCG_CALL_NO_RWG_SE, f64, f64) +DEF_HELPER_FLAGS_1(neg_d, TCG_CALL_NO_RWG_SE, f64, f64) +DEF_HELPER_3(add_d, f64, env, f64, f64) +DEF_HELPER_3(sub_d, f64, env, f64, f64) +DEF_HELPER_3(mul_d, f64, env, f64, f64) +DEF_HELPER_4(madd_d, f64, env, f64, f64, f64) +DEF_HELPER_4(msub_d, f64, env, f64, f64, f64) +DEF_HELPER_4(ftoi_d, i32, env, f64, i32, i32) +DEF_HELPER_4(ftoui_d, i32, env, f64, i32, i32) +DEF_HELPER_3(itof_d, f64, env, i32, i32) +DEF_HELPER_3(uitof_d, f64, env, i32, i32) +DEF_HELPER_2(cvts_d, f32, env, f64) + +DEF_HELPER_3(un_d, i32, env, f64, f64) +DEF_HELPER_3(oeq_d, i32, env, f64, f64) +DEF_HELPER_3(ueq_d, i32, env, f64, f64) +DEF_HELPER_3(olt_d, i32, env, f64, f64) +DEF_HELPER_3(ult_d, i32, env, f64, f64) +DEF_HELPER_3(ole_d, i32, env, f64, f64) +DEF_HELPER_3(ule_d, i32, env, f64, f64) + DEF_HELPER_2(rer, i32, env, i32)DEF_HELPER_3 (wer, void, env, i32, i32)
target/xtensa/overlay_tool.h +6 -0
@@ -39,6 +39,10 @@#define XCHAL_HAVE_DEPBITS 0#endif +#ifndef XCHAL_HAVE_DFP +#define XCHAL_HAVE_DFP 0 +#endif +#ifndef XCHAL_HAVE_DIV32 #define XCHAL_HAVE_DIV32 0#endif
@@ -99,6 +103,7 @@XCHAL_OPTION (XCHAL_HAVE_CP ,XTENSA_OPTION_COPROCESSOR ) | \XCHAL_OPTION (XCHAL_HAVE_BOOLEANS ,XTENSA_OPTION_BOOLEAN ) | \XCHAL_OPTION (XCHAL_HAVE_FP ,XTENSA_OPTION_FP_COPROCESSOR ) | \ +XCHAL_OPTION (XCHAL_HAVE_DFP ,XTENSA_OPTION_DFP_COPROCESSOR ) | \XCHAL_OPTION (XCHAL_HAVE_RELEASE_SYNC ,XTENSA_OPTION_MP_SYNCHRO ) | \XCHAL_OPTION (XCHAL_HAVE_S32C1I ,XTENSA_OPTION_CONDITIONAL_STORE ) | \ XCHAL_OPTION(((XCHAL_HAVE_S32C1I && XCHAL_HW_VERSION >= 230000) || \
@@ -515,6 +520,7 @@ .ndepc = (XCHAL_XEA_VERSION >= 2), \ .inst_fetch_width = XCHAL_INST_FETCH_WIDTH, \ .max_insn_size = XCHAL_MAX_INSTRUCTION_SIZE, \ + .use_first_nan = !XCHAL_HAVE_DFP , \EXCEPTIONS_SECTION , \INTERRUPTS_SECTION , \ TLB_SECTION, \
target/xtensa/translate.c +1054 -34
1,237 lines not on this page · raw message
Signature · 1 line
2.20.1
Re: [PATCH 09/21] target/xtensa: add DFP option, registers and opcodes
target/xtensa/fpu_helper.c void HELPER(wur_fpu2k_fcr)(CPUXtensaState *env, uint32_t v) · line 154
Quoted 11 lines · Max Filippov
target/xtensa/fpu_helper.c +7
-0+float64 HELPER (add_d )(CPUXtensaState *env,float64 a,float64 b) +{ +set_use_first_nan (true, &env->fp_status); +return float64_add (a, b, &env->fp_status); +} +float32 HELPER (add_s )(CPUXtensaState *env,float32 a,float32 b) { +set_use_first_nan (env->config->use_first_nan, &env->fp_status);return float32_add (a, b, &env->fp_status); }
I think you can do better than to set the use_first_nan flag before every operation.
E.g. the translator could remember the previous setting within the TB, only changing when necessary. E.g. if env->config->use_first_nan, then set it during reset and never change it again. Similarly if DFP is not enabled.
r~
Re: [PATCH 09/21] target/xtensa: add DFP option, registers and opcodes
Quoted 16 lines · Richard Henderson
target/xtensa/fpu_helper.c void HELPER(wur_fpu2k_fcr)(CPUXtensaState *env, uint32_t v) · line 154
Quoted 11 lines · Max Filippov
target/xtensa/fpu_helper.c +7
-0+float64 HELPER (add_d )(CPUXtensaState *env,float64 a,float64 b) +{ +set_use_first_nan (true, &env->fp_status); +return float64_add (a, b, &env->fp_status); +} +float32 HELPER (add_s )(CPUXtensaState *env,float32 a,float32 b) { +set_use_first_nan (env->config->use_first_nan, &env->fp_status);return float32_add (a, b, &env->fp_status); }I think you can do better than to set the
use_first_nanflag before every operation.
And it was better, until I found that the rules for float64 are a bit... peculiar.
Quoted 3 lines
E.g. the translator could remember the previous setting within the TB, only changing when necessary. E.g. if
env->config->use_first_nan, then set it during reset and never change it again. Similarly if DFP is not enabled.
This thought crossed my mind too, but then set_use_first_nan only sets one variable in the float_status and gets inlined. Is it worth the trouble?
Signature · 2 lines
Thanks. -- Max
Re: [PATCH 09/21] target/xtensa: add DFP option, registers and opcodes
Quoted 19 lines · Max Filippov
Quoted 16 lines · Richard Henderson
target/xtensa/fpu_helper.c void HELPER(wur_fpu2k_fcr)(CPUXtensaState *env, uint32_t v) · line 154
Quoted 11 lines · Max Filippov
target/xtensa/fpu_helper.c +7
-0+float64 HELPER (add_d )(CPUXtensaState *env,float64 a,float64 b) +{ +set_use_first_nan (true, &env->fp_status); +return float64_add (a, b, &env->fp_status); +} +float32 HELPER (add_s )(CPUXtensaState *env,float32 a,float32 b) { +set_use_first_nan (env->config->use_first_nan, &env->fp_status);return float32_add (a, b, &env->fp_status); }I think you can do better than to set the
use_first_nanflag before every operation.
Quoted 2 lines
And it was better, until I found that the rules for float64 are a bit... peculiar.
Do I read that right,
Quoted 9 lines
target/xtensa/overlay_tool.h +1
-0@@ -99,6 +103,7 @@XCHAL_OPTION (XCHAL_HAVE_CP ,XTENSA_OPTION_COPROCESSOR ) | \XCHAL_OPTION (XCHAL_HAVE_BOOLEANS ,XTENSA_OPTION_BOOLEAN ) | \XCHAL_OPTION (XCHAL_HAVE_FP ,XTENSA_OPTION_FP_COPROCESSOR ) | \ +XCHAL_OPTION (XCHAL_HAVE_DFP ,XTENSA_OPTION_DFP_COPROCESSOR ) | \XCHAL_OPTION (XCHAL_HAVE_RELEASE_SYNC ,XTENSA_OPTION_MP_SYNCHRO ) | \XCHAL_OPTION (XCHAL_HAVE_S32C1I ,XTENSA_OPTION_CONDITIONAL_STORE ) | \ XCHAL_OPTION(((XCHAL_HAVE_S32C1I && XCHAL_HW_VERSION >= 230000) || \
target/xtensa/overlay_tool.h line 526
Quoted 7 lines
target/xtensa/overlay_tool.h +1
-0@@ -515,6 +520,7 @@ .ndepc = (XCHAL_XEA_VERSION >= 2), \ .inst_fetch_width = XCHAL_INST_FETCH_WIDTH, \ .max_insn_size = XCHAL_MAX_INSTRUCTION_SIZE, \ + .use_first_nan = !XCHAL_HAVE_DFP , \EXCEPTIONS_SECTION , \INTERRUPTS_SECTION , \ TLB_SECTION, \
means that if DFP is present, float64 has use_first_nan, but float32 does not?!?
What in the world is going on?
Quoted 7 lines
Quoted 3 lines
E.g. the translator could remember the previous setting within the TB, only changing when necessary. E.g. if
env->config->use_first_nan, then set it during reset and never change it again. Similarly if DFP is not enabled.This thought crossed my mind too, but then
set_use_first_nanonly sets one variable in thefloat_statusand gets inlined. Is it worth the trouble?
You have a point that the operation I'm trying to avoid is trivial, and probably not worth much. But I had hoped that a given cpu would stick with one method and not change it.
r~
Re: [PATCH 09/21] target/xtensa: add DFP option, registers and opcodes
Quoted 1 line · Richard Henderson
Do I read that right,
[...]
Quoted 1 line
means that if DFP is present, float64 has
use_first_nan, but float32 does not?!?
That's correct. And float64 madd.d/msub.d again don't have it.
Quoted 1 line
What in the world is going on?
My thoughts exactly. What I've found out is that at least it wasn't meant to be like that. But also it is not specified in any official documentation, and that I guess is one of the reasons why it's like that. There are also no plans to change it.
Quoted 11 lines
Quoted 7 lines
Quoted 3 lines
E.g. the translator could remember the previous setting within the TB, only changing when necessary. E.g. if
env->config->use_first_nan, then set it during reset and never change it again. Similarly if DFP is not enabled.This thought crossed my mind too, but then
set_use_first_nanonly sets one variable in thefloat_statusand gets inlined. Is it worth the trouble?You have a point that the operation I'm trying to avoid is trivial, and probably not worth much. But I had hoped that a given cpu would stick with one method and not change it.
CPU with only a single precision FPU (either FPU2000 or DFPU) could do it, but apparently not one with a full DFPU.
We could give full DFPU its own implementations of single precision helpers and choose appropriate helper at translation time. I just felt that it would neither simplify the code nor have any performance impact.
Signature · 2 lines
Thanks. -- Max
PATCH 10/21 target/xtensa: implement FPU division and square root
In reply to Max FilippovThis does not implement all opcodes related to div/sqrt as specified in the xtensa ISA, partly because the official specification is not complete and partly because precise implementation is unnecessarily complex. Instead instructions specific to the div/sqrt sequences are implemented differently, most of them as nops, but the results of div/sqrt sequences is preserved.
--- target/xtensa/fpu_helper.c | 24 +++++++++ target/xtensa/helper.h | 4 ++ target/xtensa/translate.c | 104 +++++++++++++++++++++++++++++++++++++ 3 files changed, 132 insertions(+)
target/xtensa/fpu_helper.c +24 -0
@@ -203,6 +203,30 @@ float32 HELPER(msub_s)(CPUXtensaState *env, float32 a, float32 b, float32 c) &env->fp_status); } +float64 HELPER (mkdadj_d )(CPUXtensaState *env,float64 a,float64 b) +{ +set_use_first_nan (true, &env->fp_status); +return float64_div (b, a, &env->fp_status); +} + +float32 HELPER (mkdadj_s )(CPUXtensaState *env,float32 a,float32 b) +{ +set_use_first_nan (env->config->use_first_nan, &env->fp_status); +return float32_div (b, a, &env->fp_status); +} + +float64 HELPER (mksadj_d )(CPUXtensaState *env,float64 v) +{ +set_use_first_nan (true, &env->fp_status); +return float64_sqrt (v, &env->fp_status); +} + +float32 HELPER (mksadj_s )(CPUXtensaState *env,float32 v) +{ +set_use_first_nan (env->config->use_first_nan, &env->fp_status); +return float32_sqrt (v, &env->fp_status); +} +uint32_t HELPER (ftoi_d )(CPUXtensaState *env,float64 v,uint32_t rounding_mode,uint32_t scale) {
target/xtensa/helper.h +4 -0
@@ -54,6 +54,8 @@ DEF_HELPER_3(sub_s, f32, env, f32, f32) DEF_HELPER_3(mul_s, f32, env, f32, f32) DEF_HELPER_4(madd_s, f32, env, f32, f32, f32) DEF_HELPER_4(msub_s, f32, env, f32, f32, f32) +DEF_HELPER_3(mkdadj_s, f32, env, f32, f32) +DEF_HELPER_2(mksadj_s, f32, env, f32) DEF_HELPER_4(ftoi_s, i32, env, f32, i32, i32) DEF_HELPER_4(ftoui_s, i32, env, f32, i32, i32)DEF_HELPER_3 (itof_s, f32, env, i32, i32)
@@ -78,6 +80,8 @@ DEF_HELPER_3(sub_d, f64, env, f64, f64) DEF_HELPER_3(mul_d, f64, env, f64, f64) DEF_HELPER_4(madd_d, f64, env, f64, f64, f64) DEF_HELPER_4(msub_d, f64, env, f64, f64, f64) +DEF_HELPER_3(mkdadj_d, f64, env, f64, f64) +DEF_HELPER_2(mksadj_d, f64, env, f64) DEF_HELPER_4(ftoi_d, i32, env, f64, i32, i32) DEF_HELPER_4(ftoui_d, i32, env, f64, i32, i32)DEF_HELPER_3 (itof_d, f64, env, i32, i32)
target/xtensa/translate.c +104 -0
140 lines not on this page · raw message
Signature · 1 line
2.20.1
PATCH 11/21 tests/tcg/xtensa: fix test execution on ISS
In reply to Max FilippovSpace for test results may be allocated in IRAM which is only word-accessible. Use full 32-bit words to access test results.
--- tests/tcg/xtensa/macros.inc | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
tests/tcg/xtensa/macros.inc +5 -5
@@ -3,7 +3,7 @@ .macro test_suite name .data status: .word result -result: .space 256 +result: .space 1024 .text .global main .align 4
@@ -25,9 +25,9 @@ main: movi a3, 0 beqz a2, 2f 1: - l8ui a1, a0, 0 + l32i a1, a0, 0 or a3, a3, a1 - addi a0, a0, 1 + addi a0, a0, 4 addi a2, a2, -1 bnez a2, 1b 2:
@@ -65,7 +65,7 @@ test_\name: reset_ps movi a2, status l32i a3, a2, 0 - addi a3, a3, 1 + addi a3, a3, 4 s32i a3, a2, 0 .endm
@@ -78,7 +78,7 @@ test_\name: movi a2, status l32i a2, a2, 0 movi a3, 1 - s8i a3, a2, 0 + s32i a3, a2, 0 #ifdef DEBUG print failed #endif
Signature · 1 line
2.20.1
PATCH 12/21 tests/tcg/xtensa: update test_fp0_arith for DFPU
In reply to Max FilippovDFPU arithmetic opcodes update FSR flags. Add FSR parameters and expected FSR register values for the arithmetic tests.
--- tests/tcg/xtensa/fpu.h | 142 ++++++++++++++++++++++++ tests/tcg/xtensa/test_fp0_arith.S | 178 ++++++++++++++---------------- 2 files changed, 223 insertions(+), 97 deletions(-) create mode 100644 tests/tcg/xtensa/fpu.h
tests/tcg/xtensa/fpu.h new file +142 -0
@@ -0,0 +1,142 @@ +#if XCHAL_HAVE_DFP ||XCHAL_HAVE_FP_DIV +#define DFPU 1 +#else +#define DFPU 0 +#endif + +#define FCR_RM_NEAREST 0 +#define FCR_RM_TRUNC 1 +#define FCR_RM_CEIL 2 +#define FCR_RM_FLOOR 3 + +#define FSR__ 0x00000000 +#define FSR_I 0x00000080 +#define FSR_U 0x00000100 +#define FSR_O 0x00000200 +#define FSR_Z 0x00000400 +#define FSR_V 0x00000800 + +#define FSR_UI (FSR_U | FSR_I) +#define FSR_OI (FSR_O | FSR_I) + +#define F32_0 0x00000000 +#define F32_0_5 0x3f000000 +#define F32_1 0x3f800000 +#define F32_MAX 0x7f7fffff +#define F32_PINF 0x7f800000 +#define F32_NINF 0xff800000 + +#define F32_DNAN 0x7fc00000 +#define F32_SNAN (v) (0x7f800000 | (v)) +#define F32_QNAN (v) (0x7fc00000 | (v)) + +#define F32_MINUS 0x80000000 + +#define F64_0 0x0000000000000000 +#define F64_MIN_NORM 0x0010000000000000 +#define F64_1 0x3ff0000000000000 +#define F64_MAX_2 0x7fe0000000000000 +#define F64_MAX 0x7fefffffffffffff +#define F64_PINF 0x7ff0000000000000 +#define F64_NINF 0xfff0000000000000 + +#define F64_DNAN 0x7ff8000000000000 +#define F64_SNAN (v) (0x7ff0000000000000 | (v)) +#define F64_QNAN (v) (0x7ff8000000000000 | (v)) + +#define F64_MINUS 0x8000000000000000 + +.macro test_op1_rm op, fr0, fr1, v0, r, sr + movi a2, 0 + wur a2, fsr + movfp \fr0, \v0 + \op \fr1, \fr0 + check_res \fr1, \r, \sr +.endm + +.macro test_op2_rm op, fr0, fr1, fr2, v0, v1, r, sr + movi a2, 0 + wur a2, fsr + movfp \fr0, \v0 + movfp \fr1, \v1 + \op \fr2, \fr0, \fr1 + check_res \fr2, \r, \sr +.endm + +.macro test_op3_rm op, fr0, fr1, fr2, fr3, v0, v1, v2, r, sr + movi a2, 0 + wur a2, fsr + movfp \fr0, \v0 + movfp \fr1, \v1 + movfp \fr2, \v2 + \op \fr0, \fr1, \fr2 + check_res \fr3, \r, \sr +.endm + +.macro test_op1_ex op, fr0, fr1, v0, rm, r, sr + movi a2, \rm + wur a2, fcr + test_op1_rm \op, \fr0, \fr1, \v0, \r, \sr + movi a2, (\rm) | 0x7c + wur a2, fcr + test_op1_rm \op, \fr0, \fr1, \v0, \r, \sr +.endm + +.macro test_op2_ex op, fr0, fr1, fr2, v0, v1, rm, r, sr + movi a2, \rm + wur a2, fcr + test_op2_rm \op, \fr0, \fr1, \fr2, \v0, \v1, \r, \sr + movi a2, (\rm) | 0x7c + wur a2, fcr + test_op2_rm \op, \fr0, \fr1, \fr2, \v0, \v1, \r, \sr +.endm + +.macro test_op3_ex op, fr0, fr1, fr2, fr3, v0, v1, v2, rm, r, sr + movi a2, \rm + wur a2, fcr + test_op3_rm \op, \fr0, \fr1, \fr2, \fr3, \v0, \v1, \v2, \r, \sr + movi a2, (\rm) | 0x7c + wur a2, fcr + test_op3_rm \op, \fr0, \fr1, \fr2, \fr3, \v0, \v1, \v2, \r, \sr +.endm + +.macro test_op1 op, fr0, fr1, v0, r0, r1, r2, r3, sr0, sr1, sr2, sr3 + test_op1_ex \op, \fr0, \fr1, \v0, 0, \r0, \sr0 + test_op1_ex \op, \fr0, \fr1, \v0, 1, \r1, \sr1 + test_op1_ex \op, \fr0, \fr1, \v0, 2, \r2, \sr2 + test_op1_ex \op, \fr0, \fr1, \v0, 3, \r3, \sr3 +.endm + +.macro test_op2 op, fr0, fr1, fr2, v0, v1, r0, r1, r2, r3, sr0, sr1, sr2, sr3 + test_op2_ex \op, \fr0, \fr1, \fr2, \v0, \v1, 0, \r0, \sr0 + test_op2_ex \op, \fr0, \fr1, \fr2, \v0, \v1, 1, \r1, \sr1 + test_op2_ex \op, \fr0, \fr1, \fr2, \v0, \v1, 2, \r2, \sr2 + test_op2_ex \op, \fr0, \fr1, \fr2, \v0, \v1, 3, \r3, \sr3 +.endm + +.macro test_op3 op, fr0, fr1, fr2, fr3, v0, v1, v2, r0, r1, r2, r3, sr0, sr1, sr2, sr3 + test_op3_ex \op, \fr0, \fr1, \fr2, \fr3, \v0, \v1, \v2, 0, \r0, \sr0 + test_op3_ex \op, \fr0, \fr1, \fr2, \fr3, \v0, \v1, \v2, 1, \r1, \sr1 + test_op3_ex \op, \fr0, \fr1, \fr2, \fr3, \v0, \v1, \v2, 2, \r2, \sr2 + test_op3_ex \op, \fr0, \fr1, \fr2, \fr3, \v0, \v1, \v2, 3, \r3, \sr3 +.endm + +.macro test_op2_cpe op + set_vector kernel, 2f + movi a2, 0 + wsr a2, cpenable +1: + \op f2, f0, f1 + test_fail +2: + rsr a2, excvaddr + movi a3, 1b + assert eq, a2, a3 + rsr a2, exccause + movi a3, 32 + assert eq, a2, a3 + + set_vector kernel, 0 + movi a2, 1 + wsr a2, cpenable +.endm
tests/tcg/xtensa/test_fp0_arith.S +81 -97
247 lines not on this page · raw message
Signature · 1 line
2.20.1
PATCH 13/21 tests/tcg/xtensa: expand madd tests
In reply to Max FilippovTest that madd doesn't do rounding after multiplication. Test NaN propagation rules for FPU2000 and DFPU madd opcode.
--- tests/tcg/xtensa/test_fp0_arith.S | 88 +++++++++++++++++++++++++++++++ 1 file changed, 88 insertions(+)
tests/tcg/xtensa/test_fp0_arith.S +88 -0
@@ -146,6 +146,94 @@ test madd_s FSR_I, FSR_I, FSR_I, FSR_I test_end +test madd_s_precision + test_op3 madd.s, f0, f1, f2, f0, 0xbf800002, 0x3f800001, 0x3f800001, \ + 0x28800000, 0x28800000, 0x28800000, 0x28800000, \ + FSR__, FSR__, FSR__, FSR__ +test_end + +#if DFPU +test madd_s_nan_dfpu + /* DFPU madd/msub NaN1, NaN2, NaN3 priority: NaN1, NaN3, NaN2 */ + test_op3 madd.s, f0, f1, f2, f0, F32_QNAN(1), F32_1, F32_1, \ + F32_QNAN(1), F32_QNAN(1), F32_QNAN(1), F32_QNAN(1), \ + FSR__, FSR__, FSR__, FSR__ + test_op3 madd.s, f0, f1, f2, f0, F32_1, F32_QNAN(2), F32_1, \ + F32_QNAN(2), F32_QNAN(2), F32_QNAN(2), F32_QNAN(2), \ + FSR__, FSR__, FSR__, FSR__ + test_op3 madd.s, f0, f1, f2, f0, F32_1, F32_1, F32_QNAN(3), \ + F32_QNAN(3), F32_QNAN(3), F32_QNAN(3), F32_QNAN(3), \ + FSR__, FSR__, FSR__, FSR__ + + test_op3 madd.s, f0, f1, f2, f0, F32_QNAN(1), F32_QNAN(2), F32_1, \ + F32_QNAN(1), F32_QNAN(1), F32_QNAN(1), F32_QNAN(1), \ + FSR__, FSR__, FSR__, FSR__ + test_op3 madd.s, f0, f1, f2, f0, F32_QNAN(1), F32_1, F32_QNAN(3), \ + F32_QNAN(1), F32_QNAN(1), F32_QNAN(1), F32_QNAN(1), \ + FSR__, FSR__, FSR__, FSR__ + test_op3 madd.s, f0, f1, f2, f0, F32_1, F32_QNAN(2), F32_QNAN(3), \ + F32_QNAN(3), F32_QNAN(3), F32_QNAN(3), F32_QNAN(3), \ + FSR__, FSR__, FSR__, FSR__ + + test_op3 madd.s, f0, f1, f2, f0, F32_QNAN(1), F32_QNAN(2), F32_QNAN(3), \ + F32_QNAN(1), F32_QNAN(1), F32_QNAN(1), F32_QNAN(1), \ + FSR__, FSR__, FSR__, FSR__ + + /* inf * 0 = default NaN */ + test_op3 madd.s, f0, f1, f2, f0, F32_1, F32_PINF, F32_0, \ + F32_DNAN, F32_DNAN, F32_DNAN, F32_DNAN, \ + FSR_V, FSR_V, FSR_V, FSR_V + + /* madd/msub SNaN turns to QNaN and sets Invalid flag */ + test_op3 madd.s, f0, f1, f2, f0, F32_SNAN(1), F32_1, F32_1, \ + F32_QNAN(1), F32_QNAN(1), F32_QNAN(1), F32_QNAN(1), \ + FSR_V, FSR_V, FSR_V, FSR_V + test_op3 madd.s, f0, f1, f2, f0, F32_QNAN(1), F32_SNAN(2), F32_1, \ + F32_QNAN(1), F32_QNAN(1), F32_QNAN(1), F32_QNAN(1), \ + FSR_V, FSR_V, FSR_V, FSR_V +test_end +#else +test madd_s_nan_fpu2k + /* FPU2000 madd/msub NaN1, NaN2, NaN3 priority: NaN2, NaN3, NaN1 */ + test_op3 madd.s, f0, f1, f2, f0, F32_QNAN(1), F32_1, F32_1, \ + F32_QNAN(1), F32_QNAN(1), F32_QNAN(1), F32_QNAN(1), \ + FSR__, FSR__, FSR__, FSR__ + test_op3 madd.s, f0, f1, f2, f0, F32_1, F32_QNAN(2), F32_1, \ + F32_QNAN(2), F32_QNAN(2), F32_QNAN(2), F32_QNAN(2), \ + FSR__, FSR__, FSR__, FSR__ + test_op3 madd.s, f0, f1, f2, f0, F32_1, F32_1, F32_QNAN(3), \ + F32_QNAN(3), F32_QNAN(3), F32_QNAN(3), F32_QNAN(3), \ + FSR__, FSR__, FSR__, FSR__ + + test_op3 madd.s, f0, f1, f2, f0, F32_QNAN(1), F32_QNAN(2), F32_1, \ + F32_QNAN(2), F32_QNAN(2), F32_QNAN(2), F32_QNAN(2), \ + FSR__, FSR__, FSR__, FSR__ + test_op3 madd.s, f0, f1, f2, f0, F32_QNAN(1), F32_1, F32_QNAN(3), \ + F32_QNAN(3), F32_QNAN(3), F32_QNAN(3), F32_QNAN(3), \ + FSR__, FSR__, FSR__, FSR__ + test_op3 madd.s, f0, f1, f2, f0, F32_1, F32_QNAN(2), F32_QNAN(3), \ + F32_QNAN(2), F32_QNAN(2), F32_QNAN(2), F32_QNAN(2), \ + FSR__, FSR__, FSR__, FSR__ + + test_op3 madd.s, f0, f1, f2, f0, F32_QNAN(1), F32_QNAN(2), F32_QNAN(3), \ + F32_QNAN(2), F32_QNAN(2), F32_QNAN(2), F32_QNAN(2), \ + FSR__, FSR__, FSR__, FSR__ + + /* inf * 0 = default NaN */ + test_op3 madd.s, f0, f1, f2, f0, F32_1, F32_PINF, F32_0, \ + F32_DNAN, F32_DNAN, F32_DNAN, F32_DNAN, \ + FSR__, FSR__, FSR__, FSR__ + + /* madd/msub SNaN is preserved */ + test_op3 madd.s, f0, f1, f2, f0, F32_SNAN(1), F32_1, F32_1, \ + F32_SNAN(1), F32_SNAN(1), F32_SNAN(1), F32_SNAN(1), \ + FSR__, FSR__, FSR__, FSR__ + test_op3 madd.s, f0, f1, f2, f0, F32_QNAN(1), F32_SNAN(2), F32_1, \ + F32_SNAN(2), F32_SNAN(2), F32_SNAN(2), F32_SNAN(2), \ + FSR__, FSR__, FSR__, FSR__ +test_end +#endif + test msub_s test_op3 msub.s, f0, f1, f2, f0, 0x3f800000, 0x3f800001, 0x3f800001, \ 0xb4800000, 0xb4800000, 0xb4800000, 0xb4800001, \
Signature · 1 line
2.20.1
PATCH 14/21 tests/tcg/xtensa: update test_fp0_conv for DFPU
In reply to Max FilippovDFPU conversion opcodes update FSR flags. Add FSR parameters and expected FSR register values for the conversion tests.
--- tests/tcg/xtensa/test_fp0_conv.S | 299 ++++++++++++++++--------------- 1 file changed, 155 insertions(+), 144 deletions(-)
tests/tcg/xtensa/test_fp0_conv.S +155 -144
@@ -1,4 +1,5 @@ #include "macros.inc" +#include "fpu.h" test_suite fp0_conv
@@ -9,7 +10,7 @@ test_suite fp0_conv wfr \fr, a2 .endm -.macro test_ftoi_ex op, r0, fr0, v, c, r +.macro test_ftoi_ex op, r0, fr0, v, c, r, sr movi a2, 0 wur a2, fsr movfp \fr0, \v
@@ -18,20 +19,25 @@ test_suite fp0_conv movi a3, \r assert eq, \r0, a3 rur a2, fsr +#if DFPU + movi a3, \sr + assert eq, a2, a3 +#else assert eqi, a2, 0 +#endif .endm -.macro test_ftoi op, r0, fr0, v, c, r +.macro test_ftoi op, r0, fr0, v, c, r, sr movi a2, 0 wur a2, fcr - test_ftoi_ex \op, \r0, \fr0, \v, \c, \r + test_ftoi_ex \op, \r0, \fr0, \v, \c, \r, \sr movi a2, 0x7c wur a2, fcr - test_ftoi_ex \op, \r0, \fr0, \v, \c, \r + test_ftoi_ex \op, \r0, \fr0, \v, \c, \r, \sr .endm -.macro test_itof_ex op, fr0, ar0, v, c, r +.macro test_itof_ex op, fr0, ar0, v, c, r, sr movi a2, 0 wur a2, fsr movi \ar0, \v
@@ -42,23 +48,28 @@ test_suite fp0_conv movi a3, \r assert eq, a2, a3 rur a2, fsr +#if DFPU + movi a3, \sr + assert eq, a2, a3 +#else assert eqi, a2, 0 +#endif .endm -.macro test_itof_rm op, fr0, ar0, v, c, rm, r +.macro test_itof_rm op, fr0, ar0, v, c, rm, r, sr movi a2, \rm wur a2, fcr - test_itof_ex \op, \fr0, \ar0, \v, \c, \r + test_itof_ex \op, \fr0, \ar0, \v, \c, \r, \sr movi a2, (\rm) | 0x7c wur a2, fcr - test_itof_ex \op, \fr0, \ar0, \v, \c, \r + test_itof_ex \op, \fr0, \ar0, \v, \c, \r, \sr .endm -.macro test_itof op, fr0, ar0, v, c, r0, r1, r2, r3 - test_itof_rm \op, \fr0, \ar0, \v, \c, 0, \r0 - test_itof_rm \op, \fr0, \ar0, \v, \c, 1, \r1 - test_itof_rm \op, \fr0, \ar0, \v, \c, 2, \r2 - test_itof_rm \op, \fr0, \ar0, \v, \c, 3, \r3 +.macro test_itof op, fr0, ar0, v, c, r0, r1, r2, r3, sr + test_itof_rm \op, \fr0, \ar0, \v, \c, 0, \r0, \sr + test_itof_rm \op, \fr0, \ar0, \v, \c, 1, \r1, \sr + test_itof_rm \op, \fr0, \ar0, \v, \c, 2, \r2, \sr + test_itof_rm \op, \fr0, \ar0, \v, \c, 3, \r3, \sr .endm test round_s
@@ -66,237 +77,237 @@ test round_s wsr a2, cpenable /* NaN */ - test_ftoi round.s, a2, f0, 0xffc00001, 0, 0x7fffffff - test_ftoi round.s, a2, f0, 0xff800001, 0, 0x7fffffff + test_ftoi round.s, a2, f0, 0xffc00001, 0, 0x7fffffff, FSR_V + test_ftoi round.s, a2, f0, 0xff800001, 0, 0x7fffffff, FSR_V /* -inf */ - test_ftoi round.s, a2, f0, 0xff800000, 0, 0x80000000 + test_ftoi round.s, a2, f0, 0xff800000, 0, 0x80000000, FSR_V /* negative overflow */ - test_ftoi round.s, a2, f0, 0xceffffff, 1, 0x80000000 - test_ftoi round.s, a2, f0, 0xcf000000, 0, 0x80000000 - test_ftoi round.s, a2, f0, 0xceffffff, 0, 0x80000080 + test_ftoi round.s, a2, f0, 0xceffffff, 1, 0x80000000, FSR_V + test_ftoi round.s, a2, f0, 0xcf000000, 0, 0x80000000, FSR__ + test_ftoi round.s, a2, f0, 0xceffffff, 0, 0x80000080, FSR__ /* negative */ - test_ftoi round.s, a2, f0, 0xbfa00000, 1, -2 /* -1.25 * 2 */ - test_ftoi round.s, a2, f0, 0xbfc00000, 0, -2 /* -1.5 */ - test_ftoi round.s, a2, f0, 0xbf800000, 1, -2 /* -1 * 2 */ - test_ftoi round.s, a2, f0, 0xbf800000, 0, -1 /* -1 */ - test_ftoi round.s, a2, f0, 0xbf400000, 0, -1 /* -0.75 */ - test_ftoi round.s, a2, f0, 0xbf000000, 0, 0 /* -0.5 */ + test_ftoi round.s, a2, f0, 0xbfa00000, 1, -2, FSR_I /* -1.25 * 2 */ + test_ftoi round.s, a2, f0, 0xbfc00000, 0, -2, FSR_I /* -1.5 */ + test_ftoi round.s, a2, f0, 0xbf800000, 1, -2, FSR__ /* -1 * 2 */ + test_ftoi round.s, a2, f0, 0xbf800000, 0, -1, FSR__ /* -1 */ + test_ftoi round.s, a2, f0, 0xbf400000, 0, -1, FSR_I /* -0.75 */ + test_ftoi round.s, a2, f0, 0xbf000000, 0, 0, FSR_I /* -0.5 */ /* positive */ - test_ftoi round.s, a2, f0, 0x3f000000, 0, 0 /* 0.5 */ - test_ftoi round.s, a2, f0, 0x3f400000, 0, 1 /* 0.75 */ - test_ftoi round.s, a2, f0, 0x3f800000, 0, 1 /* 1 */ - test_ftoi round.s, a2, f0, 0x3f800000, 1, 2 /* 1 * 2 */ - test_ftoi round.s, a2, f0, 0x3fc00000, 0, 2 /* 1.5 */ - test_ftoi round.s, a2, f0, 0x3fa00000, 1, 2 /* 1.25 * 2 */ + test_ftoi round.s, a2, f0, 0x3f000000, 0, 0, FSR_I /* 0.5 */ + test_ftoi round.s, a2, f0, 0x3f400000, 0, 1, FSR_I /* 0.75 */ + test_ftoi round.s, a2, f0, 0x3f800000, 0, 1, FSR__ /* 1 */ + test_ftoi round.s, a2, f0, 0x3f800000, 1, 2, FSR__ /* 1 * 2 */ + test_ftoi round.s, a2, f0, 0x3fc00000, 0, 2, FSR_I /* 1.5 */ + test_ftoi round.s, a2, f0, 0x3fa00000, 1, 2, FSR_I /* 1.25 * 2 */ /* positive overflow */ - test_ftoi round.s, a2, f0, 0x4effffff, 0, 0x7fffff80 - test_ftoi round.s, a2, f0, 0x4f000000, 0, 0x7fffffff - test_ftoi round.s, a2, f0, 0x4effffff, 1, 0x7fffffff + test_ftoi round.s, a2, f0, 0x4effffff, 0, 0x7fffff80, FSR__ + test_ftoi round.s, a2, f0, 0x4f000000, 0, 0x7fffffff, FSR_V + test_ftoi round.s, a2, f0, 0x4effffff, 1, 0x7fffffff, FSR_V /* +inf */ - test_ftoi round.s, a2, f0, 0x7f800000, 0, 0x7fffffff + test_ftoi round.s, a2, f0, 0x7f800000, 0, 0x7fffffff, FSR_V /* NaN */ - test_ftoi round.s, a2, f0, 0x7f800001, 0, 0x7fffffff - test_ftoi round.s, a2, f0, 0x7fc00000, 0, 0x7fffffff + test_ftoi round.s, a2, f0, 0x7f800001, 0, 0x7fffffff, FSR_V + test_ftoi round.s, a2, f0, 0x7fc00000, 0, 0x7fffffff, FSR_V test_end test trunc_s /* NaN */ - test_ftoi trunc.s, a2, f0, 0xffc00001, 0, 0x7fffffff - test_ftoi trunc.s, a2, f0, 0xff800001, 0, 0x7fffffff + test_ftoi trunc.s, a2, f0, 0xffc00001, 0, 0x7fffffff, FSR_V + test_ftoi trunc.s, a2, f0, 0xff800001, 0, 0x7fffffff, FSR_V /* -inf */ - test_ftoi trunc.s, a2, f0, 0xff800000, 0, 0x80000000 + test_ftoi trunc.s, a2, f0, 0xff800000, 0, 0x80000000, FSR_V /* negative overflow */ - test_ftoi trunc.s, a2, f0, 0xceffffff, 1, 0x80000000 - test_ftoi trunc.s, a2, f0, 0xcf000000, 0, 0x80000000 - test_ftoi trunc.s, a2, f0, 0xceffffff, 0, 0x80000080 + test_ftoi trunc.s, a2, f0, 0xceffffff, 1, 0x80000000, FSR_V + test_ftoi trunc.s, a2, f0, 0xcf000000, 0, 0x80000000, FSR__ + test_ftoi trunc.s, a2, f0, 0xceffffff, 0, 0x80000080, FSR__ /* negative */ - test_ftoi trunc.s, a2, f0, 0xbfa00000, 1, -2 /* -1.25 * 2 */ - test_ftoi trunc.s, a2, f0, 0xbfc00000, 0, -1 /* -1.5 */ - test_ftoi trunc.s, a2, f0, 0xbf800000, 1, -2 /* -1 * 2 */ - test_ftoi trunc.s, a2, f0, 0xbf800000, 0, -1 /* -1 */ - test_ftoi trunc.s, a2, f0, 0xbf400000, 0, 0 /* -0.75 */ - test_ftoi trunc.s, a2, f0, 0xbf000000, 0, 0 /* -0.5 */ + test_ftoi trunc.s, a2, f0, 0xbfa00000, 1, -2, FSR_I /* -1.25 * 2 */ + test_ftoi trunc.s, a2, f0, 0xbfc00000, 0, -1, FSR_I /* -1.5 */ + test_ftoi trunc.s, a2, f0, 0xbf800000, 1, -2, FSR__ /* -1 * 2 */ + test_ftoi trunc.s, a2, f0, 0xbf800000, 0, -1, FSR__ /* -1 */ + test_ftoi trunc.s, a2, f0, 0xbf400000, 0, 0, FSR_I /* -0.75 */ + test_ftoi trunc.s, a2, f0, 0xbf000000, 0, 0, FSR_I /* -0.5 */ /* positive */ - test_ftoi trunc.s, a2, f0, 0x3f000000, 0, 0 /* 0.5 */ - test_ftoi trunc.s, a2, f0, 0x3f400000, 0, 0 /* 0.75 */ - test_ftoi trunc.s, a2, f0, 0x3f800000, 0, 1 /* 1 */ - test_ftoi trunc.s, a2, f0, 0x3f800000, 1, 2 /* 1 * 2 */ - test_ftoi trunc.s, a2, f0, 0x3fc00000, 0, 1 /* 1.5 */ - test_ftoi trunc.s, a2, f0, 0x3fa00000, 1, 2 /* 1.25 * 2 */ + test_ftoi trunc.s, a2, f0, 0x3f000000, 0, 0, FSR_I /* 0.5 */ + test_ftoi trunc.s, a2, f0, 0x3f400000, 0, 0, FSR_I /* 0.75 */ + test_ftoi trunc.s, a2, f0, 0x3f800000, 0, 1, FSR__ /* 1 */ + test_ftoi trunc.s, a2, f0, 0x3f800000, 1, 2, FSR__ /* 1 * 2 */ + test_ftoi trunc.s, a2, f0, 0x3fc00000, 0, 1, FSR_I /* 1.5 */ + test_ftoi trunc.s, a2, f0, 0x3fa00000, 1, 2, FSR_I /* 1.25 * 2 */ /* positive overflow */ - test_ftoi trunc.s, a2, f0, 0x4effffff, 0, 0x7fffff80 - test_ftoi trunc.s, a2, f0, 0x4f000000, 0, 0x7fffffff - test_ftoi trunc.s, a2, f0, 0x4effffff, 1, 0x7fffffff + test_ftoi trunc.s, a2, f0, 0x4effffff, 0, 0x7fffff80, FSR__ + test_ftoi trunc.s, a2, f0, 0x4f000000, 0, 0x7fffffff, FSR_V + test_ftoi trunc.s, a2, f0, 0x4effffff, 1, 0x7fffffff, FSR_V /* +inf */ - test_ftoi trunc.s, a2, f0, 0x7f800000, 0, 0x7fffffff + test_ftoi trunc.s, a2, f0, 0x7f800000, 0, 0x7fffffff, FSR_V /* NaN */ - test_ftoi trunc.s, a2, f0, 0x7f800001, 0, 0x7fffffff - test_ftoi trunc.s, a2, f0, 0x7fc00000, 0, 0x7fffffff + test_ftoi trunc.s, a2, f0, 0x7f800001, 0, 0x7fffffff, FSR_V + test_ftoi trunc.s, a2, f0, 0x7fc00000, 0, 0x7fffffff, FSR_V test_end test floor_s /* NaN */ - test_ftoi floor.s, a2, f0, 0xffc00001, 0, 0x7fffffff - test_ftoi floor.s, a2, f0, 0xff800001, 0, 0x7fffffff + test_ftoi floor.s, a2, f0, 0xffc00001, 0, 0x7fffffff, FSR_V + test_ftoi floor.s, a2, f0, 0xff800001, 0, 0x7fffffff, FSR_V /* -inf */ - test_ftoi floor.s, a2, f0, 0xff800000, 0, 0x80000000 + test_ftoi floor.s, a2, f0, 0xff800000, 0, 0x80000000, FSR_V /* negative overflow */ - test_ftoi floor.s, a2, f0, 0xceffffff, 1, 0x80000000 - test_ftoi floor.s, a2, f0, 0xcf000000, 0, 0x80000000 - test_ftoi floor.s, a2, f0, 0xceffffff, 0, 0x80000080 + test_ftoi floor.s, a2, f0, 0xceffffff, 1, 0x80000000, FSR_V + test_ftoi floor.s, a2, f0, 0xcf000000, 0, 0x80000000, FSR__ + test_ftoi floor.s, a2, f0, 0xceffffff, 0, 0x80000080, FSR__ /* negative */ - test_ftoi floor.s, a2, f0, 0xbfa00000, 1, -3 /* -1.25 * 2 */ - test_ftoi floor.s, a2, f0, 0xbfc00000, 0, -2 /* -1.5 */ - test_ftoi floor.s, a2, f0, 0xbf800000, 1, -2 /* -1 * 2 */ - test_ftoi floor.s, a2, f0, 0xbf800000, 0, -1 /* -1 */ - test_ftoi floor.s, a2, f0, 0xbf400000, 0, -1 /* -0.75 */ - test_ftoi floor.s, a2, f0, 0xbf000000, 0, -1 /* -0.5 */ + test_ftoi floor.s, a2, f0, 0xbfa00000, 1, -3, FSR_I /* -1.25 * 2 */ + test_ftoi floor.s, a2, f0, 0xbfc00000, 0, -2, FSR_I /* -1.5 */ + test_ftoi floor.s, a2, f0, 0xbf800000, 1, -2, FSR__ /* -1 * 2 */ + test_ftoi floor.s, a2, f0, 0xbf800000, 0, -1, FSR__ /* -1 */ + test_ftoi floor.s, a2, f0, 0xbf400000, 0, -1, FSR_I /* -0.75 */ + test_ftoi floor.s, a2, f0, 0xbf000000, 0, -1, FSR_I /* -0.5 */ /* positive */ - test_ftoi floor.s, a2, f0, 0x3f000000, 0, 0 /* 0.5 */ - test_ftoi floor.s, a2, f0, 0x3f400000, 0, 0 /* 0.75 */ - test_ftoi floor.s, a2, f0, 0x3f800000, 0, 1 /* 1 */ - test_ftoi floor.s, a2, f0, 0x3f800000, 1, 2 /* 1 * 2 */ - test_ftoi floor.s, a2, f0, 0x3fc00000, 0, 1 /* 1.5 */ - test_ftoi floor.s, a2, f0, 0x3fa00000, 1, 2 /* 1.25 * 2 */ + test_ftoi floor.s, a2, f0, 0x3f000000, 0, 0, FSR_I /* 0.5 */ + test_ftoi floor.s, a2, f0, 0x3f400000, 0, 0, FSR_I /* 0.75 */ + test_ftoi floor.s, a2, f0, 0x3f800000, 0, 1, FSR__ /* 1 */ + test_ftoi floor.s, a2, f0, 0x3f800000, 1, 2, FSR__ /* 1 * 2 */ + test_ftoi floor.s, a2, f0, 0x3fc00000, 0, 1, FSR_I /* 1.5 */ + test_ftoi floor.s, a2, f0, 0x3fa00000, 1, 2, FSR_I /* 1.25 * 2 */ /* positive overflow */ - test_ftoi floor.s, a2, f0, 0x4effffff, 0, 0x7fffff80 - test_ftoi floor.s, a2, f0, 0x4f000000, 0, 0x7fffffff - test_ftoi floor.s, a2, f0, 0x4effffff, 1, 0x7fffffff + test_ftoi floor.s, a2, f0, 0x4effffff, 0, 0x7fffff80, FSR__ + test_ftoi floor.s, a2, f0, 0x4f000000, 0, 0x7fffffff, FSR_V + test_ftoi floor.s, a2, f0, 0x4effffff, 1, 0x7fffffff, FSR_V /* +inf */ - test_ftoi floor.s, a2, f0, 0x7f800000, 0, 0x7fffffff + test_ftoi floor.s, a2, f0, 0x7f800000, 0, 0x7fffffff, FSR_V /* NaN */ - test_ftoi floor.s, a2, f0, 0x7f800001, 0, 0x7fffffff - test_ftoi floor.s, a2, f0, 0x7fc00000, 0, 0x7fffffff + test_ftoi floor.s, a2, f0, 0x7f800001, 0, 0x7fffffff, FSR_V + test_ftoi floor.s, a2, f0, 0x7fc00000, 0, 0x7fffffff, FSR_V test_end test ceil_s /* NaN */ - test_ftoi ceil.s, a2, f0, 0xffc00001, 0, 0x7fffffff - test_ftoi ceil.s, a2, f0, 0xff800001, 0, 0x7fffffff + test_ftoi ceil.s, a2, f0, 0xffc00001, 0, 0x7fffffff, FSR_V + test_ftoi ceil.s, a2, f0, 0xff800001, 0, 0x7fffffff, FSR_V /* -inf */ - test_ftoi ceil.s, a2, f0, 0xff800000, 0, 0x80000000 + test_ftoi ceil.s, a2, f0, 0xff800000, 0, 0x80000000, FSR_V /* negative overflow */ - test_ftoi ceil.s, a2, f0, 0xceffffff, 1, 0x80000000 - test_ftoi ceil.s, a2, f0, 0xcf000000, 0, 0x80000000 - test_ftoi ceil.s, a2, f0, 0xceffffff, 0, 0x80000080 + test_ftoi ceil.s, a2, f0, 0xceffffff, 1, 0x80000000, FSR_V + test_ftoi ceil.s, a2, f0, 0xcf000000, 0, 0x80000000, FSR__ + test_ftoi ceil.s, a2, f0, 0xceffffff, 0, 0x80000080, FSR__ /* negative */ - test_ftoi ceil.s, a2, f0, 0xbfa00000, 1, -2 /* -1.25 * 2 */ - test_ftoi ceil.s, a2, f0, 0xbfc00000, 0, -1 /* -1.5 */ - test_ftoi ceil.s, a2, f0, 0xbf800000, 1, -2 /* -1 * 2 */ - test_ftoi ceil.s, a2, f0, 0xbf800000, 0, -1 /* -1 */ - test_ftoi ceil.s, a2, f0, 0xbf400000, 0, 0 /* -0.75 */ - test_ftoi ceil.s, a2, f0, 0xbf000000, 0, 0 /* -0.5 */ + test_ftoi ceil.s, a2, f0, 0xbfa00000, 1, -2, FSR_I /* -1.25 * 2 */ + test_ftoi ceil.s, a2, f0, 0xbfc00000, 0, -1, FSR_I /* -1.5 */ + test_ftoi ceil.s, a2, f0, 0xbf800000, 1, -2, FSR__ /* -1 * 2 */ + test_ftoi ceil.s, a2, f0, 0xbf800000, 0, -1, FSR__ /* -1 */ + test_ftoi ceil.s, a2, f0, 0xbf400000, 0, 0, FSR_I /* -0.75 */ + test_ftoi ceil.s, a2, f0, 0xbf000000, 0, 0, FSR_I /* -0.5 */ /* positive */ - test_ftoi ceil.s, a2, f0, 0x3f000000, 0, 1 /* 0.5 */ - test_ftoi ceil.s, a2, f0, 0x3f400000, 0, 1 /* 0.75 */ - test_ftoi ceil.s, a2, f0, 0x3f800000, 0, 1 /* 1 */ - test_ftoi ceil.s, a2, f0, 0x3f800000, 1, 2 /* 1 * 2 */ - test_ftoi ceil.s, a2, f0, 0x3fc00000, 0, 2 /* 1.5 */ - test_ftoi ceil.s, a2, f0, 0x3fa00000, 1, 3 /* 1.25 * 2 */ + test_ftoi ceil.s, a2, f0, 0x3f000000, 0, 1, FSR_I /* 0.5 */ + test_ftoi ceil.s, a2, f0, 0x3f400000, 0, 1, FSR_I /* 0.75 */ + test_ftoi ceil.s, a2, f0, 0x3f800000, 0, 1, FSR__ /* 1 */ + test_ftoi ceil.s, a2, f0, 0x3f800000, 1, 2, FSR__ /* 1 * 2 */ + test_ftoi ceil.s, a2, f0, 0x3fc00000, 0, 2, FSR_I /* 1.5 */ + test_ftoi ceil.s, a2, f0, 0x3fa00000, 1, 3, FSR_I /* 1.25 * 2 */ /* positive overflow */ - test_ftoi ceil.s, a2, f0, 0x4effffff, 0, 0x7fffff80 - test_ftoi ceil.s, a2, f0, 0x4f000000, 0, 0x7fffffff - test_ftoi ceil.s, a2, f0, 0x4effffff, 1, 0x7fffffff + test_ftoi ceil.s, a2, f0, 0x4effffff, 0, 0x7fffff80, FSR__ + test_ftoi ceil.s, a2, f0, 0x4f000000, 0, 0x7fffffff, FSR_V + test_ftoi ceil.s, a2, f0, 0x4effffff, 1, 0x7fffffff, FSR_V /* +inf */ - test_ftoi ceil.s, a2, f0, 0x7f800000, 0, 0x7fffffff + test_ftoi ceil.s, a2, f0, 0x7f800000, 0, 0x7fffffff, FSR_V /* NaN */ - test_ftoi ceil.s, a2, f0, 0x7f800001, 0, 0x7fffffff - test_ftoi ceil.s, a2, f0, 0x7fc00000, 0, 0x7fffffff + test_ftoi ceil.s, a2, f0, 0x7f800001, 0, 0x7fffffff, FSR_V + test_ftoi ceil.s, a2, f0, 0x7fc00000, 0, 0x7fffffff, FSR_V test_end test utrunc_s /* NaN */ - test_ftoi utrunc.s, a2, f0, 0xffc00001, 0, 0xffffffff - test_ftoi utrunc.s, a2, f0, 0xff800001, 0, 0xffffffff + test_ftoi utrunc.s, a2, f0, 0xffc00001, 0, 0xffffffff, FSR_V + test_ftoi utrunc.s, a2, f0, 0xff800001, 0, 0xffffffff, FSR_V /* -inf */ - test_ftoi utrunc.s, a2, f0, 0xff800000, 0, 0x80000000 + test_ftoi utrunc.s, a2, f0, 0xff800000, 0, 0x80000000, FSR_V /* negative overflow */ - test_ftoi utrunc.s, a2, f0, 0xceffffff, 1, 0x80000000 - test_ftoi utrunc.s, a2, f0, 0xcf000000, 0, 0x80000000 - test_ftoi utrunc.s, a2, f0, 0xceffffff, 0, 0x80000080 + test_ftoi utrunc.s, a2, f0, 0xceffffff, 1, 0x80000000, FSR_V + test_ftoi utrunc.s, a2, f0, 0xcf000000, 0, 0x80000000, FSR_V + test_ftoi utrunc.s, a2, f0, 0xceffffff, 0, 0x80000080, FSR_V /* negative */ - test_ftoi utrunc.s, a2, f0, 0xbfa00000, 1, -2 /* -1.25 * 2 */ - test_ftoi utrunc.s, a2, f0, 0xbfc00000, 0, -1 /* -1.5 */ - test_ftoi utrunc.s, a2, f0, 0xbf800000, 1, -2 /* -1 * 2 */ - test_ftoi utrunc.s, a2, f0, 0xbf800000, 0, -1 /* -1 */ - test_ftoi utrunc.s, a2, f0, 0xbf400000, 0, 0 /* -0.75 */ - test_ftoi utrunc.s, a2, f0, 0xbf000000, 0, 0 /* -0.5 */ + test_ftoi utrunc.s, a2, f0, 0xbfa00000, 1, -2, FSR_V /* -1.25 * 2 */ + test_ftoi utrunc.s, a2, f0, 0xbfc00000, 0, -1, FSR_V /* -1.5 */ + test_ftoi utrunc.s, a2, f0, 0xbf800000, 1, -2, FSR_V /* -1 * 2 */ + test_ftoi utrunc.s, a2, f0, 0xbf800000, 0, -1, FSR_V /* -1 */ + test_ftoi utrunc.s, a2, f0, 0xbf400000, 0, 0, FSR_I /* -0.75 */ + test_ftoi utrunc.s, a2, f0, 0xbf000000, 0, 0, FSR_I /* -0.5 */ /* positive */ - test_ftoi utrunc.s, a2, f0, 0x3f000000, 0, 0 /* 0.5 */ - test_ftoi utrunc.s, a2, f0, 0x3f400000, 0, 0 /* 0.75 */ - test_ftoi utrunc.s, a2, f0, 0x3f800000, 0, 1 /* 1 */ - test_ftoi utrunc.s, a2, f0, 0x3f800000, 1, 2 /* 1 * 2 */ - test_ftoi utrunc.s, a2, f0, 0x3fc00000, 0, 1 /* 1.5 */ - test_ftoi utrunc.s, a2, f0, 0x3fa00000, 1, 2 /* 1.25 * 2 */ + test_ftoi utrunc.s, a2, f0, 0x3f000000, 0, 0, FSR_I /* 0.5 */ + test_ftoi utrunc.s, a2, f0, 0x3f400000, 0, 0, FSR_I /* 0.75 */ + test_ftoi utrunc.s, a2, f0, 0x3f800000, 0, 1, FSR__ /* 1 */ + test_ftoi utrunc.s, a2, f0, 0x3f800000, 1, 2, FSR__ /* 1 * 2 */ + test_ftoi utrunc.s, a2, f0, 0x3fc00000, 0, 1, FSR_I /* 1.5 */ + test_ftoi utrunc.s, a2, f0, 0x3fa00000, 1, 2, FSR_I /* 1.25 * 2 */ /* positive overflow */ - test_ftoi utrunc.s, a2, f0, 0x4effffff, 0, 0x7fffff80 - test_ftoi utrunc.s, a2, f0, 0x4f000000, 0, 0x80000000 - test_ftoi utrunc.s, a2, f0, 0x4effffff, 1, 0xffffff00 - test_ftoi utrunc.s, a2, f0, 0x4f800000, 1, 0xffffffff + test_ftoi utrunc.s, a2, f0, 0x4effffff, 0, 0x7fffff80, FSR__ + test_ftoi utrunc.s, a2, f0, 0x4f000000, 0, 0x80000000, FSR__ + test_ftoi utrunc.s, a2, f0, 0x4effffff, 1, 0xffffff00, FSR__ + test_ftoi utrunc.s, a2, f0, 0x4f800000, 1, 0xffffffff, FSR_V /* +inf */ - test_ftoi utrunc.s, a2, f0, 0x7f800000, 0, 0xffffffff + test_ftoi utrunc.s, a2, f0, 0x7f800000, 0, 0xffffffff, FSR_V /* NaN */ - test_ftoi utrunc.s, a2, f0, 0x7f800001, 0, 0xffffffff - test_ftoi utrunc.s, a2, f0, 0x7fc00000, 0, 0xffffffff + test_ftoi utrunc.s, a2, f0, 0x7f800001, 0, 0xffffffff, FSR_V + test_ftoi utrunc.s, a2, f0, 0x7fc00000, 0, 0xffffffff, FSR_V test_end test float_s test_itof float.s, f0, a2, -1, 0, \ - 0xbf800000, 0xbf800000, 0xbf800000, 0xbf800000 - test_itof float.s, f0, a2, 0, 0, 0, 0, 0, 0 + 0xbf800000, 0xbf800000, 0xbf800000, 0xbf800000, FSR__ + test_itof float.s, f0, a2, 0, 0, 0, 0, 0, 0, FSR__ test_itof float.s, f0, a2, 1, 1, \ - 0x3f000000, 0x3f000000, 0x3f000000, 0x3f000000 + 0x3f000000, 0x3f000000, 0x3f000000, 0x3f000000, FSR__ test_itof float.s, f0, a2, 1, 0, \ - 0x3f800000, 0x3f800000, 0x3f800000, 0x3f800000 + 0x3f800000, 0x3f800000, 0x3f800000, 0x3f800000, FSR__ test_itof float.s, f0, a2, 0x7fffffff, 0, \ - 0x4f000000, 0x4effffff, 0x4f000000, 0x4effffff + 0x4f000000, 0x4effffff, 0x4f000000, 0x4effffff, FSR_I test_end test ufloat_s - test_itof ufloat.s, f0, a2, 0, 0, 0, 0, 0, 0 + test_itof ufloat.s, f0, a2, 0, 0, 0, 0, 0, 0, FSR__ test_itof ufloat.s, f0, a2, 1, 1, \ - 0x3f000000, 0x3f000000, 0x3f000000, 0x3f000000 + 0x3f000000, 0x3f000000, 0x3f000000, 0x3f000000, FSR__ test_itof ufloat.s, f0, a2, 1, 0, \ - 0x3f800000, 0x3f800000, 0x3f800000, 0x3f800000 + 0x3f800000, 0x3f800000, 0x3f800000, 0x3f800000, FSR__ test_itof ufloat.s, f0, a2, 0x7fffffff, 0, \ - 0x4f000000, 0x4effffff, 0x4f000000, 0x4effffff + 0x4f000000, 0x4effffff, 0x4f000000, 0x4effffff, FSR_I test_itof ufloat.s, f0, a2, 0xffffffff, 0, \ - 0x4f800000, 0x4f7fffff, 0x4f800000, 0x4f7fffff + 0x4f800000, 0x4f7fffff, 0x4f800000, 0x4f7fffff, FSR_I test_end #endif
Signature · 1 line
2.20.1
PATCH 15/21 tests/tcg/xtensa: update test_fp1 for DFPU
In reply to Max FilippovDFPU sets Invalid flag in FSR when at least one argument of FP comparison opcodes is NaN, SNaN for most opcodes, any NaN for olt/ole. Add checks for FSR and expected FSR values.
--- tests/tcg/xtensa/test_fp1.S | 62 ++++++++++++++++++++----------------- 1 file changed, 34 insertions(+), 28 deletions(-)
tests/tcg/xtensa/test_fp1.S +34 -28
@@ -1,4 +1,5 @@ #include "macros.inc" +#include "fpu.h" test_suite fp1
@@ -9,7 +10,7 @@ test_suite fp1 wfr \fr, a2 .endm -.macro test_ord_ex op, br, fr0, fr1, v0, v1, r +.macro test_ord_ex op, br, fr0, fr1, v0, v1, r, sr movi a2, 0 wur a2, fsr movfp \fr0, \v0
@@ -20,65 +21,70 @@ test_suite fp1 movt a2, a3, \br assert eqi, a2, \r rur a2, fsr +#if DFPU + movi a3, \sr + assert eq, a2, a3 +#else assert eqi, a2, 0 +#endif .endm -.macro test_ord op, br, fr0, fr1, v0, v1, r +.macro test_ord op, br, fr0, fr1, v0, v1, r, sr movi a2, 0 wur a2, fcr - test_ord_ex \op, \br, \fr0, \fr1, \v0, \v1, \r + test_ord_ex \op, \br, \fr0, \fr1, \v0, \v1, \r, \sr movi a2, 0x7c wur a2, fcr - test_ord_ex \op, \br, \fr0, \fr1, \v0, \v1, \r + test_ord_ex \op, \br, \fr0, \fr1, \v0, \v1, \r, \sr .endm -.macro test_ord_all op, aa, ab, ba, aPI, PIa, aN, Na, II, IN, NI - test_ord \op b0, f0, f1, 0x3f800000, 0x3f800000, \aa - test_ord \op b1, f2, f3, 0x3f800000, 0x3fc00000, \ab - test_ord \op b2, f4, f5, 0x3fc00000, 0x3f800000, \ba - test_ord \op b3, f6, f7, 0x3f800000, 0x7f800000, \aPI - test_ord \op b4, f8, f9, 0x7f800000, 0x3f800000, \PIa - test_ord \op b5, f10, f11, 0x3f800000, 0xffc00001, \aN - test_ord \op b6, f12, f13, 0x3f800000, 0xff800001, \aN - test_ord \op b7, f14, f15, 0x3f800000, 0x7f800001, \aN - test_ord \op b8, f0, f1, 0x3f800000, 0x7fc00000, \aN - test_ord \op b9, f2, f3, 0xffc00001, 0x3f800000, \Na - test_ord \op b10, f4, f5, 0xff800001, 0x3f800000, \Na - test_ord \op b11, f6, f7, 0x7f800001, 0x3f800000, \Na - test_ord \op b12, f8, f9, 0x7fc00000, 0x3f800000, \Na - test_ord \op b13, f10, f11, 0x7f800000, 0x7f800000, \II - test_ord \op b14, f12, f13, 0x7f800000, 0x7fc00000, \IN - test_ord \op b15, f14, f15, 0x7fc00000, 0x7f800000, \NI +.macro test_ord_all op, aa, ab, ba, aPI, PIa, aN, Na, II, IN, NI, qnan_sr + test_ord \op b0, f0, f1, 0x3f800000, 0x3f800000, \aa, FSR__ /* ord == ord */ + test_ord \op b1, f2, f3, 0x3f800000, 0x3fc00000, \ab, FSR__ /* ord < ord */ + test_ord \op b2, f4, f5, 0x3fc00000, 0x3f800000, \ba, FSR__ /* ord > ord */ + test_ord \op b3, f6, f7, 0x3f800000, 0x7f800000, \aPI, FSR__ /* ord +INF */ + test_ord \op b4, f8, f9, 0x7f800000, 0x3f800000, \PIa, FSR__ /* +INF ord */ + test_ord \op b5, f10, f11, 0x3f800000, 0xffc00001, \aN, \qnan_sr /* ord -QNaN */ + test_ord \op b6, f12, f13, 0x3f800000, 0xff800001, \aN, FSR_V /* ord -SNaN */ + test_ord \op b7, f14, f15, 0x3f800000, 0x7f800001, \aN, FSR_V /* ord +SNaN */ + test_ord \op b8, f0, f1, 0x3f800000, 0x7fc00000, \aN, \qnan_sr /* ord +QNaN */ + test_ord \op b9, f2, f3, 0xffc00001, 0x3f800000, \Na, \qnan_sr /* -QNaN ord */ + test_ord \op b10, f4, f5, 0xff800001, 0x3f800000, \Na, FSR_V /* -SNaN ord */ + test_ord \op b11, f6, f7, 0x7f800001, 0x3f800000, \Na, FSR_V /* +SNaN ord */ + test_ord \op b12, f8, f9, 0x7fc00000, 0x3f800000, \Na, \qnan_sr /* +QNaN ord */ + test_ord \op b13, f10, f11, 0x7f800000, 0x7f800000, \II, FSR__ /* +INF +INF */ + test_ord \op b14, f12, f13, 0x7f800000, 0x7fc00000, \IN, \qnan_sr /* +INF +QNaN */ + test_ord \op b15, f14, f15, 0x7fc00000, 0x7f800000, \NI, \qnan_sr /* +QNaN +INF */ .endm test un_s movi a2, 1 wsr a2, cpenable - test_ord_all un.s, 0, 0, 0, 0, 0, 1, 1, 0, 1, 1 + test_ord_all un.s, 0, 0, 0, 0, 0, 1, 1, 0, 1, 1, FSR__ test_end test oeq_s - test_ord_all oeq.s, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0 + test_ord_all oeq.s, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, FSR__ test_end test ueq_s - test_ord_all ueq.s, 1, 0, 0, 0, 0, 1, 1, 1, 1, 1 + test_ord_all ueq.s, 1, 0, 0, 0, 0, 1, 1, 1, 1, 1, FSR__ test_end test olt_s - test_ord_all olt.s, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0 + test_ord_all olt.s, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, FSR_V test_end test ult_s - test_ord_all ult.s, 0, 1, 0, 1, 0, 1, 1, 0, 1, 1 + test_ord_all ult.s, 0, 1, 0, 1, 0, 1, 1, 0, 1, 1, FSR__ test_end test ole_s - test_ord_all ole.s, 1, 1, 0, 1, 0, 0, 0, 1, 0, 0 + test_ord_all ole.s, 1, 1, 0, 1, 0, 0, 0, 1, 0, 0, FSR_V test_end test ule_s - test_ord_all ule.s, 1, 1, 0, 1, 0, 1, 1, 1, 1, 1 + test_ord_all ule.s, 1, 1, 0, 1, 0, 1, 1, 1, 1, 1, FSR__ test_end .macro test_cond op, fr0, fr1, cr, v0, v1, r
Signature · 1 line
2.20.1
PATCH 16/21 tests/tcg/xtensa: update test_lsc for DFPU
In reply to Max FilippovDFPU doesn't have pre-increment FP load/store opcodes, it has post-increment opcodes instead. Test increment opcodes present in the current config.
--- tests/tcg/xtensa/test_lsc.S | 47 +++++++++++++++++++++++++++---------- 1 file changed, 34 insertions(+), 13 deletions(-)
tests/tcg/xtensa/test_lsc.S +34 -13
@@ -1,4 +1,5 @@ #include "macros.inc" +#include "fpu.h" test_suite lsc
@@ -9,9 +10,14 @@ test lsi wsr a2, cpenable movi a2, 1f - lsi f0, a2, 0 lsi f1, a2, 4 +#if DFPU + lsi f2, a2, 8 + lsip f0, a2, 8 +#else + lsi f0, a2, 0 lsiu f2, a2, 8 +#endif movi a3, 1f + 8 assert eq, a2, a3 rfr a2, f0
@@ -34,13 +40,18 @@ test ssi movi a2, 1f movi a3, 0x40800000 wfr f3, a3 - ssi f3, a2, 0 movi a3, 0x40a00000 wfr f4, a3 - ssi f4, a2, 4 movi a3, 0x40c00000 wfr f5, a3 + ssi f4, a2, 4 +#if DFPU + ssi f5, a2, 8 + ssip f3, a2, 8 +#else + ssi f3, a2, 0 ssiu f5, a2, 8 +#endif movi a3, 1f + 8 assert eq, a2, a3 l32i a4, a2, -8
@@ -62,11 +73,16 @@ test_end test lsx movi a2, 1f movi a3, 0 + movi a4, 4 + movi a5, 8 + lsx f7, a2, a4 +#if DFPU + lsx f8, a2, a5 + lsxp f6, a2, a5 +#else lsx f6, a2, a3 - movi a3, 4 - lsx f7, a2, a3 - movi a3, 8 - lsxu f8, a2, a3 + lsxu f8, a2, a5 +#endif movi a3, 1f + 8 assert eq, a2, a3 rfr a2, f6
@@ -87,18 +103,23 @@ test_end test ssx movi a2, 1f - movi a3, 0 movi a4, 0x41200000 wfr f9, a4 - ssx f9, a2, a3 - movi a3, 4 movi a4, 0x41300000 wfr f10, a4 - ssx f10, a2, a3 - movi a3, 8 movi a4, 0x41400000 wfr f11, a4 - ssxu f11, a2, a3 + movi a3, 0 + movi a4, 4 + movi a5, 8 + ssx f10, a2, a4 +#if DFPU + ssx f11, a2, a5 + ssxp f9, a2, a5 +#else + ssx f9, a2, a3 + ssxu f11, a2, a5 +#endif movi a3, 1f + 8 assert eq, a2, a3 l32i a4, a2, -8
Signature · 1 line
2.20.1
PATCH 17/21 tests/tcg/xtensa: add fp0 div and sqrt tests
In reply to Max FilippovTest exact division/sqrt DFPU sequences.
--- tests/tcg/xtensa/test_fp0_div.S | 82 ++++++++++++++++++++++++++++++++ tests/tcg/xtensa/test_fp0_sqrt.S | 76 +++++++++++++++++++++++++++++ 2 files changed, 158 insertions(+) create mode 100644 tests/tcg/xtensa/test_fp0_div.S create mode 100644 tests/tcg/xtensa/test_fp0_sqrt.S
tests/tcg/xtensa/test_fp0_div.S new file +82 -0
@@ -0,0 +1,82 @@ +#include "macros.inc" +#include "fpu.h" + +test_suite fp0_div + +#if XCHAL_HAVE_FP_DIV + +.macro divs_seq q, a, b, r, y, y0, an, bn, e, ex + div0.s \y0, \b + nexp01.s \bn, \b + const.s \e, 1 + maddn.s \e, \bn, \y0 + mov.s \y, \y0 + mov.s \ex, \b + nexp01.s \an, \a + maddn.s \y, \e, \y0 + const.s \e, 1 + const.s \q, 0 + neg.s \r, \an + maddn.s \e, \bn, \y + maddn.s \q, \r, \y0 + mkdadj.s \ex, \a + maddn.s \y, \e, \y + maddn.s \r, \bn, \q + const.s \e, 1 + maddn.s \e, \bn, \y + maddn.s \q, \r, \y + neg.s \r, \an + maddn.s \y, \e, \y + maddn.s \r, \bn, \q + addexpm.s \q, \ex + addexp.s \y, \ex + divn.s \q, \r, \y +.endm + +.macro div_s fr0, fr1, fr2 + divs_seq \fr0, \fr1, \fr2, f9, f10, f11, f12, f13, f14, f15 +.endm + +.macro movfp fr, v + movi a2, \v + wfr \fr, a2 +.endm + +.macro check_res fr, r, sr + rfr a2, \fr + dump a2 + movi a3, \r + assert eq, a2, a3 + rur a2, fsr + movi a3, \sr + assert eq, a2, a3 +.endm + +test div_s + movi a2, 1 + wsr a2, cpenable + + test_op2 div_s, f0, f1, f2, 0x40000000, 0x40400000, \ + 0x3f2aaaab, 0x3f2aaaaa, 0x3f2aaaab, 0x3f2aaaaa, \ + FSR_I, FSR_I, FSR_I, FSR_I + test_op2 div_s, f3, f4, f5, F32_1, F32_0, \ + F32_PINF, F32_PINF, F32_PINF, F32_PINF, \ + FSR_Z, FSR_Z, FSR_Z, FSR_Z + test_op2 div_s, f6, f7, f8, F32_0, F32_0, \ + F32_DNAN, F32_DNAN, F32_DNAN, F32_DNAN, \ + FSR_V, FSR_V, FSR_V, FSR_V + + /* MAX_FLOAT / 0.5 = +inf/MAX_FLOAT */ + test_op2 div_s, f0, f1, f2, F32_MAX, F32_0_5, \ + F32_PINF, F32_MAX, F32_PINF, F32_MAX, \ + FSR_OI, FSR_OI, FSR_OI, FSR_OI + + /* 0.5 / MAX_FLOAT = denorm */ + test_op2 div_s, f0, f1, f2, F32_0_5, F32_MAX, \ + 0x00100000, 0x00100000, 0x00100001, 0x00100000, \ + FSR_UI, FSR_UI, FSR_UI, FSR_UI +test_end + +#endif + +test_suite_end
tests/tcg/xtensa/test_fp0_sqrt.S new file +76 -0
76 lines not on this page · raw message
Signature · 1 line
2.20.1
PATCH 18/21 tests/tcg/xtensa: test double precision load/store
In reply to Max FilippovAdd ldi[p]/sdi[p]/ldx[p]/sdx[p] opcode tests to test_lsc.
--- tests/tcg/xtensa/test_lsc.S | 123 ++++++++++++++++++++++++++++++++++++ 1 file changed, 123 insertions(+)
tests/tcg/xtensa/test_lsc.S +123 -0
@@ -140,4 +140,127 @@ test_end #endif +#if XCHAL_HAVE_DFP + +#if XCHAL_HAVE_BE +#define F64_HIGH_OFF 0 +#else +#define F64_HIGH_OFF 4 +#endif + +.macro movdf fr, hi, lo + movi a2, \hi + movi a3, \lo + wfrd \fr, a2, a3 +.endm + +test ldi + movi a2, 1 + wsr a2, cpenable + + movi a2, 1f + ldi f1, a2, 8 + ldi f2, a2, 16 + ldip f0, a2, 16 + movi a3, 1f + 16 + assert eq, a2, a3 + rfrd a2, f0 + movi a3, 0x3ff00000 + assert eq, a2, a3 + rfrd a2, f1 + movi a3, 0x40000000 + assert eq, a2, a3 + rfrd a2, f2 + movi a3, 0x40080000 + assert eq, a2, a3 +.data + .align 8 +1: +.double 1, 2, 3 +.text +test_end + +test sdi + movdf f3, 0x40800000, 0 + movdf f4, 0x40a00000, 0 + movdf f5, 0x40c00000, 0 + movi a2, 1f + sdi f4, a2, 8 + sdi f5, a2, 16 + sdip f3, a2, 16 + movi a3, 1f + 16 + assert eq, a2, a3 + l32i a4, a2, -16 + F64_HIGH_OFF + movi a3, 0x40800000 + assert eq, a4, a3 + l32i a4, a2, -8 + F64_HIGH_OFF + movi a3, 0x40a00000 + assert eq, a4, a3 + l32i a4, a2, F64_HIGH_OFF + movi a3, 0x40c00000 + assert eq, a4, a3 +.data + .align 8 +1: +.double 0, 0, 0 +.text +test_end + +test ldx + movi a2, 1f + movi a3, 0 + movi a4, 8 + movi a5, 16 + ldx f7, a2, a4 + ldx f8, a2, a5 + ldxp f6, a2, a5 + movi a3, 1f + 16 + assert eq, a2, a3 + rfrd a2, f6 + movi a3, 0x401c0000 + assert eq, a2, a3 + rfrd a2, f7 + movi a3, 0x40200000 + assert eq, a2, a3 + rfrd a2, f8 + movi a3, 0x40220000 + assert eq, a2, a3 +.data + .align 8 +1: +.double 7, 8, 9 +.text +test_end + +test sdx + movdf f9, 0x41200000, 0 + movdf f10, 0x41300000, 0 + movdf f11, 0x41400000, 0 + movi a2, 1f + movi a3, 0 + movi a4, 8 + movi a5, 16 + sdx f10, a2, a4 + sdx f11, a2, a5 + sdxp f9, a2, a5 + movi a3, 1f + 16 + assert eq, a2, a3 + l32i a4, a2, -16 + F64_HIGH_OFF + movi a3, 0x41200000 + assert eq, a4, a3 + l32i a4, a2, -8 + F64_HIGH_OFF + movi a3, 0x41300000 + assert eq, a4, a3 + l32i a4, a2, F64_HIGH_OFF + movi a3, 0x41400000 + assert eq, a4, a3 +.data + .align 8 +1: +.double 0, 0, 0 +.text +test_end + +#endif + test_suite_end
Signature · 1 line
2.20.1
PATCH 19/21 tests/tcg/xtensa: add DFP0 arith tests
In reply to Max FilippovAdd test for basic double precision opcode properties.
--- tests/tcg/xtensa/test_dfp0_arith.S | 153 +++++++++++++++++++++++++++++ 1 file changed, 153 insertions(+) create mode 100644 tests/tcg/xtensa/test_dfp0_arith.S
tests/tcg/xtensa/test_dfp0_arith.S new file +153 -0
@@ -0,0 +1,153 @@ +#include "macros.inc" +#include "fpu.h" + +test_suite fp0_arith + +#if XCHAL_HAVE_DFP + +.macro movfp fr, v + movi a2, ((\v) >> 32) & 0xffffffff + movi a3, ((\v) & 0xffffffff) + wfrd \fr, a2, a3 +.endm + +.macro check_res fr, r, sr + rfrd a2, \fr + dump a2 + movi a3, ((\r) >> 32) & 0xffffffff + assert eq, a2, a3 + rfr a2, \fr + dump a2 + movi a3, ((\r) & 0xffffffff) + assert eq, a2, a3 + rur a2, fsr + movi a3, \sr + assert eq, a2, a3 +.endm + +test add_d + movi a2, 1 + wsr a2, cpenable + + /* MAX_FLOAT + MAX_FLOAT = +inf/MAX_FLOAT */ + test_op2 add.d, f6, f7, f8, F64_MAX, F64_MAX, \ + F64_PINF, F64_MAX, F64_PINF, F64_MAX, \ + FSR_OI, FSR_OI, FSR_OI, FSR_OI +test_end + +test add_d_inf + /* 1 + +inf = +inf */ + test_op2 add.d, f6, f7, f8, F64_1, F64_PINF, \ + F64_PINF, F64_PINF, F64_PINF, F64_PINF, \ + FSR__, FSR__, FSR__, FSR__ + + /* +inf + -inf = default NaN */ + test_op2 add.d, f0, f1, f2, F64_PINF, F64_NINF, \ + F64_DNAN, F64_DNAN, F64_DNAN, F64_DNAN, \ + FSR_V, FSR_V, FSR_V, FSR_V +test_end + +test add_d_nan_dfpu + /* 1 + QNaN = QNaN */ + test_op2 add.d, f9, f10, f11, F64_1, F64_QNAN(1), \ + F64_QNAN(1), F64_QNAN(1), F64_QNAN(1), F64_QNAN(1), \ + FSR__, FSR__, FSR__, FSR__ + /* 1 + SNaN = QNaN */ + test_op2 add.d, f12, f13, f14, F64_1, F64_SNAN(1), \ + F64_QNAN(1), F64_QNAN(1), F64_QNAN(1), F64_QNAN(1), \ + FSR_V, FSR_V, FSR_V, FSR_V + + /* SNaN1 + SNaN2 = QNaN2 */ + test_op2 add.d, f15, f0, f1, F64_SNAN(1), F64_SNAN(2), \ + F64_QNAN(1), F64_QNAN(1), F64_QNAN(1), F64_QNAN(1), \ + FSR_V, FSR_V, FSR_V, FSR_V + /* QNaN1 + SNaN2 = QNaN2 */ + test_op2 add.d, f5, f6, f7, F64_QNAN(1), F64_SNAN(2), \ + F64_QNAN(1), F64_QNAN(1), F64_QNAN(1), F64_QNAN(1), \ + FSR_V, FSR_V, FSR_V, FSR_V + /* SNaN1 + QNaN2 = QNaN2 */ + test_op2 add.d, f8, f9, f10, F64_SNAN(1), F64_QNAN(2), \ + F64_QNAN(1), F64_QNAN(1), F64_QNAN(1), F64_QNAN(1), \ + FSR_V, FSR_V, FSR_V, FSR_V +test_end + +test sub_s + /* norm - norm = denorm */ + test_op2 sub.d, f6, f7, f8, F64_MIN_NORM | 1, F64_MIN_NORM, \ + 0x00000001, 0x00000001, 0x00000001, 0x00000001, \ + FSR__, FSR__, FSR__, FSR__ +test_end + +test mul_s + test_op2 mul.d, f0, f1, f2, F64_1 | 1, F64_1 | 1, \ + F64_1 | 2, F64_1 | 2, F64_1 | 3, F64_1 | 2, \ + FSR_I, FSR_I, FSR_I, FSR_I + /* MAX_FLOAT/2 * MAX_FLOAT/2 = +inf/MAX_FLOAT */ + test_op2 mul.d, f6, f7, f8, F64_MAX_2, F64_MAX_2, \ + F64_PINF, F64_MAX, F64_PINF, F64_MAX, \ + FSR_OI, FSR_OI, FSR_OI, FSR_OI + /* min norm * min norm = 0/denorm */ + test_op2 mul.d, f6, f7, f8, F64_MIN_NORM, F64_MIN_NORM, \ + F64_0, F64_0, 0x00000001, F64_0, \ + FSR_UI, FSR_UI, FSR_UI, FSR_UI + /* inf * 0 = default NaN */ + test_op2 mul.d, f6, f7, f8, F64_PINF, F64_0, \ + F64_DNAN, F64_DNAN, F64_DNAN, F64_DNAN, \ + FSR_V, FSR_V, FSR_V, FSR_V +test_end + +test madd_d + test_op3 madd.d, f0, f1, f2, f0, F64_0, F64_1 | 1, F64_1 | 1, \ + F64_1 | 2, F64_1 | 2, F64_1 | 3, F64_1 | 2, \ + FSR_I, FSR_I, FSR_I, FSR_I +test_end + +test madd_d_precision + test_op3 madd.d, f0, f1, f2, f0, \ + F64_MINUS | F64_1 | 2, F64_1 | 1, F64_1 | 1, \ + 0x3970000000000000, 0x3970000000000000, 0x3970000000000000, 0x3970000000000000, \ + FSR__, FSR__, FSR__, FSR__ +test_end + +test madd_d_nan_dfpu + /* DFPU madd/msub NaN1, NaN2, NaN3 priority: NaN1, NaN3, NaN2 */ + test_op3 madd.d, f0, f1, f2, f0, F64_QNAN(1), F64_1, F64_1, \ + F64_QNAN(1), F64_QNAN(1), F64_QNAN(1), F64_QNAN(1), \ + FSR__, FSR__, FSR__, FSR__ + test_op3 madd.d, f0, f1, f2, f0, F64_1, F64_QNAN(2), F64_1, \ + F64_QNAN(2), F64_QNAN(2), F64_QNAN(2), F64_QNAN(2), \ + FSR__, FSR__, FSR__, FSR__ + test_op3 madd.d, f0, f1, f2, f0, F64_1, F64_1, F64_QNAN(3), \ + F64_QNAN(3), F64_QNAN(3), F64_QNAN(3), F64_QNAN(3), \ + FSR__, FSR__, FSR__, FSR__ + + test_op3 madd.d, f0, f1, f2, f0, F64_QNAN(1), F64_QNAN(2), F64_1, \ + F64_QNAN(1), F64_QNAN(1), F64_QNAN(1), F64_QNAN(1), \ + FSR__, FSR__, FSR__, FSR__ + test_op3 madd.d, f0, f1, f2, f0, F64_QNAN(1), F64_1, F64_QNAN(3), \ + F64_QNAN(1), F64_QNAN(1), F64_QNAN(1), F64_QNAN(1), \ + FSR__, FSR__, FSR__, FSR__ + test_op3 madd.d, f0, f1, f2, f0, F64_1, F64_QNAN(2), F64_QNAN(3), \ + F64_QNAN(3), F64_QNAN(3), F64_QNAN(3), F64_QNAN(3), \ + FSR__, FSR__, FSR__, FSR__ + test_op3 madd.d, f0, f1, f2, f0, F64_QNAN(1), F64_QNAN(2), F64_QNAN(3), \ + F64_QNAN(1), F64_QNAN(1), F64_QNAN(1), F64_QNAN(1), \ + FSR__, FSR__, FSR__, FSR__ + + /* inf * 0 = default NaN */ + test_op3 madd.d, f0, f1, f2, f0, F64_1, F64_PINF, F64_0, \ + F64_DNAN, F64_DNAN, F64_DNAN, F64_DNAN, \ + FSR_V, FSR_V, FSR_V, FSR_V + + /* madd/msub SNaN turns to QNaN and sets Invalid flag */ + test_op3 madd.d, f0, f1, f2, f0, F64_SNAN(1), F64_1, F64_1, \ + F64_QNAN(1), F64_QNAN(1), F64_QNAN(1), F64_QNAN(1), \ + FSR_V, FSR_V, FSR_V, FSR_V + test_op3 madd.d, f0, f1, f2, f0, F64_QNAN(1), F64_SNAN(2), F64_1, \ + F64_QNAN(1), F64_QNAN(1), F64_QNAN(1), F64_QNAN(1), \ + FSR_V, FSR_V, FSR_V, FSR_V +test_end + +#endif + +test_suite_end
Signature · 1 line
2.20.1
PATCH 20/21 target/xtensa: import DE_233L_FPU core
In reply to Max FilippovDE_233L_FPU is a variant of 233L core with double precision FPU.
--- target/xtensa/Makefile.objs | 1 + target/xtensa/core-DE_233L_FPU.c | 31 + target/xtensa/core-DE_233L_FPU/core-isa.h | 727 + target/xtensa/core-DE_233L_FPU/core-matmap.h | 717 + .../xtensa/core-DE_233L_FPU/gdb-config.inc.c | 277 + .../core-DE_233L_FPU/xtensa-modules.inc.c | 20758 ++++++++++++++++ 6 files changed, 22511 insertions(+) create mode 100644 target/xtensa/core-DE_233L_FPU.c create mode 100644 target/xtensa/core-DE_233L_FPU/core-isa.h create mode 100644 target/xtensa/core-DE_233L_FPU/core-matmap.h create mode 100644 target/xtensa/core-DE_233L_FPU/gdb-config.inc.c create mode 100644 target/xtensa/core-DE_233L_FPU/xtensa-modules.inc.c
target/xtensa/Makefile.objs +1 -0
@@ -1,3 +1,4 @@ +obj-y += core-DE_233L_FPU.o obj-y += core-dc232b.o obj-y += core-dc233c.o obj-y += core-de212.o
target/xtensa/core-DE_233L_FPU.c new file +31 -0
@@ -0,0 +1,31 @@ +#include "qemu/osdep.h" +#include "cpu.h" +#include "exec/gdbstub.h" +#include "qemu-common.h" +#include "qemu/host-utils.h" + +#include "core-DE_233L_FPU/core-isa.h" +#include "core-DE_233L_FPU/core-matmap.h" +#include "overlay_tool.h" + +#define xtensa_modules xtensa_modules_DE_233L_FPU +#include "core-DE_233L_FPU/xtensa-modules.inc.c" + +static XtensaConfig DE_233L_FPU __attribute__((unused)) = { + .name = "DE_233L_FPU", + .gdb_regmap = { + .reg = { +#include "core-DE_233L_FPU/gdb-config.inc.c" + } + }, + .isa_internal = &xtensa_modules, + .clock_freq_khz = 40000, + .opcode_translators = (const XtensaOpcodeTranslators *[]){ + &xtensa_core_opcodes, + &xtensa_fpu_opcodes, +NULL , + }, +DEFAULT_SECTIONS +}; + +REGISTER_CORE (DE_233L_FPU )
target/xtensa/core-DE_233L_FPU/core-isa.h new file +727 -0
727 lines not on this page · raw message
target/xtensa/core-DE_233L_FPU/core-matmap.h new file +717 -0
717 lines not on this page · raw message
target/xtensa/core-DE_233L_FPU/gdb-config.inc.c new file +277 -0
277 lines not on this page · raw message
target/xtensa/core-DE_233L_FPU/xtensa-modules.inc.c new file +20758 -0
1,244 lines not on this page · raw message
The rest of this diff is not shown. View the raw message.
Signature · 1 line
2.20.1
Part of the diff is not shown here. View the raw message.
PATCH 21/21 target/xtensa: import DSP3400 core
In reply to Max FilippovDSP3400 is a DSP core with FPU2000 option.
--- target/xtensa/Makefile.objs | 1 + target/xtensa/core-dsp3400.c | 31 + target/xtensa/core-dsp3400/core-isa.h | 452 + target/xtensa/core-dsp3400/core-matmap.h | 312 + target/xtensa/core-dsp3400/gdb-config.inc.c | 400 + .../xtensa/core-dsp3400/xtensa-modules.inc.c | 171906 +++++++++++++++ 6 files changed, 173102 insertions(+) create mode 100644 target/xtensa/core-dsp3400.c create mode 100644 target/xtensa/core-dsp3400/core-isa.h create mode 100644 target/xtensa/core-dsp3400/core-matmap.h create mode 100644 target/xtensa/core-dsp3400/gdb-config.inc.c create mode 100644 target/xtensa/core-dsp3400/xtensa-modules.inc.c
target/xtensa/Makefile.objs +1 -0
@@ -2,6 +2,7 @@ obj-y += core-DE_233L_FPU.o obj-y += core-dc232b.o obj-y += core-dc233c.o obj-y += core-de212.o +obj-y += core-dsp3400.o obj-y += core-fsf.o obj-y += core-sample_controller.o obj-y += core-test_kc705_be.o
target/xtensa/core-dsp3400.c new file +31 -0
@@ -0,0 +1,31 @@ +#include "qemu/osdep.h" +#include "cpu.h" +#include "exec/gdbstub.h" +#include "qemu-common.h" +#include "qemu/host-utils.h" + +#include "core-dsp3400/core-isa.h" +#include "core-dsp3400/core-matmap.h" +#include "overlay_tool.h" + +#define xtensa_modules xtensa_modules_dsp3400 +#include "core-dsp3400/xtensa-modules.inc.c" + +static XtensaConfig dsp3400 __attribute__((unused)) = { + .name = "dsp3400", + .gdb_regmap = { + .reg = { +#include "core-dsp3400/gdb-config.inc.c" + } + }, + .isa_internal = &xtensa_modules, + .clock_freq_khz = 40000, + .opcode_translators = (const XtensaOpcodeTranslators *[]){ + &xtensa_core_opcodes, + &xtensa_fpu2000_opcodes, +NULL , + }, +DEFAULT_SECTIONS +}; + +REGISTER_CORE (dsp3400)
target/xtensa/core-dsp3400/core-isa.h new file +452 -0
452 lines not on this page · raw message
target/xtensa/core-dsp3400/core-matmap.h new file +312 -0
312 lines not on this page · raw message
target/xtensa/core-dsp3400/gdb-config.inc.c new file +400 -0
400 lines not on this page · raw message
target/xtensa/core-dsp3400/xtensa-modules.inc.c new file +171906 -0
1,798 lines not on this page · raw message
The rest of this diff is not shown. View the raw message.
Signature · 1 line
2.20.1
Part of the diff is not shown here. View the raw message.
Quoted 10 lines · Max Filippov
Hello,
this series implements double precision floating point unit option for target/xtensa, updates FPU tests and adds two new CPU cores, one with FPU2000 option and one with DFPU option.
Max Filippov (21):
softfloat: makeNO_SIGNALING_NANSruntime property
softfloat: passfloat_statuspointer to pickNaN
softfloat: add xtensa specialization for pickNaNMulAdd
I've only looked at the softfloat bits as I'm not familiar with xtensa at all. However you can have a vague:
for the series - congratulations you pass your own tests ;-)
Signature · 1 line
Alex Bennée
Quoted 1 line · Alex Bennée
I've only looked at the softfloat bits as I'm not familiar with xtensa
Thanks for taking a look!
Quoted 5 lines
at all. However you can have a vague:
Tested-by Alex Bennée <[email protected]>for the series - congratulations you pass your own tests ;-)
Unless you've built toolchains for the newly added cores and run the tests on these cores it only means that new tests are properly disabled for the cores without FPU/DFPU. I'll take it as an independent build test (:
--
Thanks.
-- Max
Quoted 7 lines · Max Filippov
Quoted 1 line · Alex Bennée
I've only looked at the softfloat bits as I'm not familiar with xtensa
Thanks for taking a look!
Quoted 2 lines
at all. However you can have a vague:
Quoted 8 lines
Quoted 3 lines
Tested-by Alex Bennée <[email protected]>for the series - congratulations you pass your own tests ;-)
Unless you've built toolchains for the newly added cores and run the tests on these cores it only means that new tests are properly disabled for the cores without FPU/DFPU. I'll take it as an independent build test (:
Well it ran some xtensa tests thanks to the docker cross compiler support. Do you know what toolchains we need?
Currently we have the following:
ENV CPU_LIST csp dc232b dc233c
ENV TOOLCHAIN_RELEASE 2018.02
RUN for cpu in $CPU_LIST; do \
curl -#SL http://github.com/foss-xtensa/toolchain/releases/download/$TOOLCHAIN_RELEASE/x86_64-$TOOLCHAIN_RELEASE-xtensa-$cpu-elf.tar.gz \
| tar -xzC /opt; \
doneENV PATH $PATH:/opt/$TOOLCHAIN_RELEASE/xtensa-dc232b-elf/bin:/opt/$TOOLCHAIN_RELEASE/xtensa-dc233c-elf/bin:/opt/$TOOLCHAIN_RELEASE/xtensa-csp-elf/bin
Signature · 1 line
Alex Bennée
Quoted 10 lines · Alex Bennée
Well it ran some xtensa tests thanks to the docker cross compiler support. Do you know what toolchains we need?
Currently we have the following:
ENV
CPU_LISTcsp dc232b dc233c
ENVTOOLCHAIN_RELEASE2018.02RUN for cpu in $CPU_LIST; do \ curl -#SL http://github.com/foss-xtensa/toolchain/releases/download/$TOOLCHAIN_RELEASE/x86_64-$TOOLCHAIN_RELEASE-xtensa-$cpu-elf.tar.gz \
Oh, that's a familiar URL. Let me do the new batch of toolchains and add FPU2000/DFPU configurations there.
And this is tests/docker/dockerfiles/debian-xtensa-cross.docker, right? I can add new configurations there as well and add one more patch to this series.
Signature · 2 lines
Thanks. -- Max
Quoted 9 lines · Max Filippov
Quoted 8 lines · Alex Bennée
Well it ran some xtensa tests thanks to the docker cross compiler support. Do you know what toolchains we need?
Currently we have the following:
ENV
CPU_LISTcsp dc232b dc233c
ENVTOOLCHAIN_RELEASE2018.02
Quoted 7 lines
Quoted 2 lines
RUN for cpu in $CPU_LIST; do \ curl -#SL http://github.com/foss-xtensa/toolchain/releases/download/$TOOLCHAIN_RELEASE/x86_64-$TOOLCHAIN_RELEASE-xtensa-$cpu-elf.tar.gz \Oh, that's a familiar URL. Let me do the new batch of toolchains and add FPU2000/DFPU configurations there.
And this is tests/docker/dockerfiles/debian-xtensa-cross.docker, right?
Yep - you could also tweak tests/tcg/configure.sh if you want to handle the presence of the toolchain in your local environment. We might want to expand the configurations emitted to tests/tcg/config-xtensa-softmmu.mak to handle the multiple binaries though unless a single binary can call the relevant toolchains with tweaks to CFLAGS?
Quoted 2 lines
I can add new configurations there as well and add one more patch to this series.
Cool ;-)
Signature · 1 line
Alex Bennée