s390x/tcg: Implement Vector enhancements facility and switch to z14
v2 cover s390x/tcg: Implement Vector enhancements facility and switch to z14
This series adds support for the "Vector enhancements facility" and bumps the qemu CPU model to a stripped-down z14.
I tested most vector FP instructions by generating random instructions and vectors, comparing the result with results on actual hardware. I did not test instructions/instruction variants with (partial) undeterministic behavior and exception handling.
Linux' also seems to boot/work fine with it. Howeever, while testing this series I noticed that Linux checks for the wrong facility bit - see [1]. I tested by temporarily faking availability of the "wrong" facility bit.
[1] https://lkml.kernel.org/r/[email protected]
v1 -> v2:
- Too much changed to spell it out explicitly. Mostly addressed feedback from Richard, a couple of bugfixes found while testing, and some simplifications/cleanups.
- Rebased on top of Richard's softfloat rework
Based-on: [email protected]
David Hildenbrand (26):
s390x/tcg: Fix FP CONVERT TO (LOGICAL) FIXED NaN handling s390x/tcg: Fix instruction name for VECTOR FP LOAD
(LENGTHENED|ROUNDED)
s390x/tcg: Simplify vop64_3() handling
s390x/tcg: Simplify vop64_2() handling
s390x/tcg: Simplify vfc64() handling
s390x/tcg: Simplify vftci64() handling
s390x/tcg: Simplify vfma64() handling
s390x/tcg: Simplify vfll32() handling
s390x/tcg: Simplify vflr64() handling
s390x/tcg: Simplify wfc64() handling
s390x/tcg: Implement VECTOR BIT PERMUTE
s390x/tcg: Implement VECTOR MULTIPLY SUM LOGICAL s390x/tcg: Implement 32/128 bit for VECTOR FP
(ADD|DIVIDE|MULTIPLY|SUBTRACT)
s390x/tcg: Implement 32/128 bit for VECTOR (LOAD FP INTEGER|FP SQUARE
ROOT)
s390x/tcg: Implement 32/128 bit for VECTOR FP COMPARE * s390x/tcg: Implement 32/128 bit for VECTOR FP COMPARE (AND SIGNAL)
SCALAR
s390x/tcg: Implement 64 bit for VECTOR FP LOAD LENGTHENED s390x/tcg: Implement 128 bit for VECTOR FP LOAD ROUNDED s390x/tcg: Implement 32/128 bit for VECTOR FP PERFORM SIGN OPERATION s390x/tcg: Implement 32/128 bit for VECTOR FP TEST DATA CLASS
IMMEDIATE
s390x/tcg: Implement 32/128 bit for VECTOR FP MULTIPLY AND
(ADD|SUBTRACT)
s390x/tcg: Implement VECTOR FP NEGATIVE MULTIPLY AND (ADD|SUBTRACT)
softfloat: Implement
float128_(min|minnum|minnummag|max|maxnum|maxnummag)
s390x/tcg: Implement VECTOR FP (MAXIMUM|MINIMUM) s390x/tcg: We support Vector enhancements facility s390x/cpumodel: Bump up QEMU model to a stripped-down IBM z14 GA2
fpu/softfloat.c | 17 + hw/s390x/s390-virtio-ccw.c | 3 + include/fpu/softfloat.h | 6 + target/s390x/cpu_models.c | 4 +- target/s390x/fpu_helper.c | 41 +- target/s390x/gen-features.c | 14 +- target/s390x/helper.h | 70 +- target/s390x/insn-data.def | 16 +- target/s390x/internal.h | 9 + target/s390x/translate_vx.c.inc | 633 ++++++++++++++---- target/s390x/vec_fpu_helper.c | 1114 ++++++++++++++++++++++--------- target/s390x/vec_helper.c | 22 + 12 files changed, 1478 insertions(+), 471 deletions(-)
Signature · 1 line
2.31.1
PATCH v2 1/26 s390x/tcg: Fix FP CONVERT TO (LOGICAL) FIXED NaN handling
In case we encounter a NaN, we have to return the smallest possible number, corresponding to either 0 or the maximum negative number. This seems to differ from IEEE handling as implemented in softfloat, whereby we return the biggest possible number.
While at it, use float32_to_uint64() in the CLGEB handler.
--- target/s390x/fpu_helper.c | 41 +++++++++++++++++++++++++++++++---- target/s390x/vec_fpu_helper.c | 6 +++++ 2 files changed, 43 insertions(+), 4 deletions(-)
target/s390x/fpu_helper.c +37 -4
@@ -509,6 +509,9 @@ uint64_t HELPER(cgeb)(CPUS390XState *env, uint64_t v2, uint32_t m34)s390_restore_bfp_rounding_mode (env, old_mode);handle_exceptions (env,xxc_from_m34 (m34),GETPC ()); +if (float32_is_any_nan (v2)) { +return INT64_MIN ; + }return ret; }
@@ -520,6 +523,9 @@ uint64_t HELPER(cgdb)(CPUS390XState *env, uint64_t v2, uint32_t m34)s390_restore_bfp_rounding_mode (env, old_mode);handle_exceptions (env,xxc_from_m34 (m34),GETPC ()); +if (float64_is_any_nan (v2)) { +return INT64_MIN ; + }return ret; }
@@ -532,6 +538,9 @@ uint64_t HELPER(cgxb)(CPUS390XState *env, uint64_t h, uint64_t l, uint32_t m34)s390_restore_bfp_rounding_mode (env, old_mode);handle_exceptions (env,xxc_from_m34 (m34),GETPC ()); +if (float128_is_any_nan (v2)) { +return INT64_MIN ; + }return ret; }
@@ -543,6 +552,9 @@ uint64_t HELPER(cfeb)(CPUS390XState *env, uint64_t v2, uint32_t m34)s390_restore_bfp_rounding_mode (env, old_mode);handle_exceptions (env,xxc_from_m34 (m34),GETPC ()); +if (float32_is_any_nan (v2)) { +return INT32_MIN ; + }return ret; }
@@ -554,6 +566,9 @@ uint64_t HELPER(cfdb)(CPUS390XState *env, uint64_t v2, uint32_t m34)s390_restore_bfp_rounding_mode (env, old_mode);handle_exceptions (env,xxc_from_m34 (m34),GETPC ()); +if (float64_is_any_nan (v2)) { +return INT32_MIN ; + }return ret; }
@@ -566,6 +581,9 @@ uint64_t HELPER(cfxb)(CPUS390XState *env, uint64_t h, uint64_t l, uint32_t m34)s390_restore_bfp_rounding_mode (env, old_mode);handle_exceptions (env,xxc_from_m34 (m34),GETPC ()); +if (float128_is_any_nan (v2)) { +return INT32_MIN ; + }return ret; }
@@ -573,12 +591,12 @@ uint64_t HELPER(cfxb)(CPUS390XState *env, uint64_t h, uint64_t l, uint32_t m34)uint64_t HELPER (clgeb )(CPUS390XState *env,uint64_t v2,uint32_t m34) {int old_mode =s390_swap_bfp_rounding_mode (env,round_from_m34 (m34)); -uint64_t ret; - - v2 =float32_to_float64 (v2, &env->fpu_status); - ret =float64_to_uint64 (v2, &env->fpu_status); +uint64_t ret =float32_to_uint64 (v2, &env->fpu_status);s390_restore_bfp_rounding_mode (env, old_mode);handle_exceptions (env,xxc_from_m34 (m34),GETPC ()); +if (float32_is_any_nan (v2)) { +return 0 ; + }return ret; }
@@ -590,6 +608,9 @@ uint64_t HELPER(clgdb)(CPUS390XState *env, uint64_t v2, uint32_t m34)s390_restore_bfp_rounding_mode (env, old_mode);handle_exceptions (env,xxc_from_m34 (m34),GETPC ()); +if (float64_is_any_nan (v2)) { +return 0 ; + }return ret; }
@@ -601,6 +622,9 @@ uint64_t HELPER(clgxb)(CPUS390XState *env, uint64_t h, uint64_t l, uint32_t m34)s390_restore_bfp_rounding_mode (env, old_mode);handle_exceptions (env,xxc_from_m34 (m34),GETPC ()); +if (float128_is_any_nan (make_float128 (h, l))) { +return 0 ; + }return ret; }
@@ -612,6 +636,9 @@ uint64_t HELPER(clfeb)(CPUS390XState *env, uint64_t v2, uint32_t m34)s390_restore_bfp_rounding_mode (env, old_mode);handle_exceptions (env,xxc_from_m34 (m34),GETPC ()); +if (float32_is_any_nan (v2)) { +return 0 ; + }return ret; }
@@ -623,6 +650,9 @@ uint64_t HELPER(clfdb)(CPUS390XState *env, uint64_t v2, uint32_t m34)s390_restore_bfp_rounding_mode (env, old_mode);handle_exceptions (env,xxc_from_m34 (m34),GETPC ()); +if (float64_is_any_nan (v2)) { +return 0 ; + }return ret; }
@@ -634,6 +664,9 @@ uint64_t HELPER(clfxb)(CPUS390XState *env, uint64_t h, uint64_t l, uint32_t m34)s390_restore_bfp_rounding_mode (env, old_mode);handle_exceptions (env,xxc_from_m34 (m34),GETPC ()); +if (float128_is_any_nan (make_float128 (h, l))) { +return 0 ; + }return ret; }
target/s390x/vec_fpu_helper.c +6 -0
@@ -326,6 +326,9 @@ void HELPER(gvec_vcdlg64s)(void *v1, const void *v2, CPUS390XState *env,static uint64_t vcgd64 (uint64_t a,float_status *s) { +if (float64_is_any_nan (a)) { +return INT64_MIN ; + }return float64_to_int64 (a, s); }
@@ -349,6 +352,9 @@ void HELPER(gvec_vcgd64s)(void *v1, const void *v2, CPUS390XState *env,static uint64_t vclgd64 (uint64_t a,float_status *s) { +if (float64_is_any_nan (a)) { +return 0 ; + }return float64_to_uint64 (a, s); }
Signature · 1 line
2.31.1
Re: [PATCH v2 01/26] s390x/tcg: Fix FP CONVERT TO (LOGICAL) FIXED NaN handling
target/s390x/fpu_helper.c uint64_t HELPER(clfxb)(CPUS390XState *env, uint64_t h, uint64_t l, uint32_t m34) · line 669
Quoted 7 lines · David Hildenbrand
target/s390x/fpu_helper.c +3
-0@@ -634,6 +664,9 @@ uint64_t HELPER(clfxb)(CPUS390XState *env, uint64_t h, uint64_t l, uint32_t m34)s390_restore_bfp_rounding_mode (env, old_mode);handle_exceptions (env,xxc_from_m34 (m34),GETPC ()); +if (float128_is_any_nan (make_float128 (h, l))) { +return 0 ; + }
I wonder if handle_exceptions should return s390_exc. Then you can test
exc = handle_exceptions(...);
if (unlikely(exc & S390_IEEE_MASK_INVALID)) {
ret = 0;
}
return ret;Quoted 12 lines
target/s390x/vec_fpu_helper.c +4
-0+++ b/target/s390x/vec_fpu_helper.c@@ -326,6 +326,9 @@ void HELPER(gvec_vcdlg64s)(void *v1, const void *v2, CPUS390XState *env,static uint64_t vcgd64 (uint64_t a,float_status *s) { +if (float64_is_any_nan (a)) { +return INT64_MIN ; + }return float64_to_int64 (a, s); }
target/s390x/vec_fpu_helper.c void HELPER(gvec_vcgd64s)(void *v1, const void *v2, CPUS390XState *env, · line 359
Quoted 8 lines
target/s390x/vec_fpu_helper.c +3
-0@@ -349,6 +352,9 @@ void HELPER(gvec_vcgd64s)(void *v1, const void *v2, CPUS390XState *env,static uint64_t vclgd64 (uint64_t a,float_status *s) { +if (float64_is_any_nan (a)) { +return 0 ; + }return float64_to_uint64 (a, s); }
You do still need to raise invalid, as far as I can see.
r~
Re: [PATCH v2 01/26] s390x/tcg: Fix FP CONVERT TO (LOGICAL) FIXED NaN handling
Quoted 12 lines · Richard Henderson
target/s390x/fpu_helper.c uint64_t HELPER(clfxb)(CPUS390XState *env, uint64_t h, uint64_t l, uint32_t m34) · line 669
Quoted 7 lines · David Hildenbrand
target/s390x/fpu_helper.c +3
-0@@ -634,6 +664,9 @@ uint64_t HELPER(clfxb)(CPUS390XState *env, uint64_t h, uint64_t l, uint32_t m34)s390_restore_bfp_rounding_mode (env, old_mode);handle_exceptions (env,xxc_from_m34 (m34),GETPC ()); +if (float128_is_any_nan (make_float128 (h, l))) { +return 0 ; + }I wonder if
handle_exceptionsshould returns390_exc. Then you can test
Quoted 6 lines
exc = handle_exceptions(...);
if (unlikely(exc & S390_IEEE_MASK_INVALID)) {
ret = 0;
}
return ret;I'll give it a thought if that makes things easier.
Quoted 15 lines
Quoted 15 lines
target/s390x/vec_fpu_helper.c +4
-0+++ b/target/s390x/vec_fpu_helper.c@@ -326,6 +326,9 @@ void HELPER(gvec_vcdlg64s)(void *v1, const void *v2, CPUS390XState *env,static uint64_t vcgd64 (uint64_t a,float_status *s) { +if (float64_is_any_nan (a)) { +return INT64_MIN ; + }return float64_to_int64 (a, s); }@@ -349,6 +352,9 @@ void HELPER(gvec_vcgd64s)(void *v1, const void *v2, CPUS390XState *env,
Quoted 9 lines
target/s390x/vec_fpu_helper.c void HELPER(gvec_vcgd64s)(void *v1, const void *v2, CPUS390XState *env, · line 359
Quoted 7 lines
target/s390x/vec_fpu_helper.c +3
-0static uint64_t vclgd64 (uint64_t a,float_status *s) { +if (float64_is_any_nan (a)) { +return 0 ; + }return float64_to_uint64 (a, s); }You do still need to raise invalid, as far as I can see.
Good point, so maybe
uint64_t ret = float64_to_uint64(a, s);
/* Note: check after converting to properly raise exceptions. */
if (float64_is_any_nan(a)) {
ret = 0;
}return ret;
to minimize manual handling?
Signature · 3 lines
Thanks, David / dhildenb
Re: [PATCH v2 01/26] s390x/tcg: Fix FP CONVERT TO (LOGICAL) FIXED NaN handling
Quoted 13 lines · David Hildenbrand
Quoted 12 lines · Richard Henderson
target/s390x/fpu_helper.c uint64_t HELPER(clfxb)(CPUS390XState *env, uint64_t h, uint64_t l, uint32_t m34) · line 669
Quoted 7 lines · David Hildenbrand
target/s390x/fpu_helper.c +3
-0@@ -634,6 +664,9 @@ uint64_t HELPER(clfxb)(CPUS390XState *env, uint64_t h, uint64_t l, uint32_t m34)s390_restore_bfp_rounding_mode (env, old_mode);handle_exceptions (env,xxc_from_m34 (m34),GETPC ()); +if (float128_is_any_nan (make_float128 (h, l))) { +return 0 ; + }I wonder if
handle_exceptionsshould returns390_exc. Then you can test
Quoted 8 lines
Quoted 6 lines
exc = handle_exceptions(...); if (unlikely(exc & S390_IEEE_MASK_INVALID)) { ret = 0; } return ret;I'll give it a thought if that makes things easier.
Looking at partsN(float_to_uint), we also raise float_flag_invalid in other cases, for example with float_class_inf. So IIUC, your proposal would also set "ret = 0" in case our input is +inf, which would be wrong.
Signature · 3 lines
Thanks, David / dhildenb
PATCH v2 2/26 s390x/tcg: Fix instruction name for VECTOR FP LOAD (LENGTHENED|ROUNDED)
In reply to David HildenbrandLet's use the correct name.
--- target/s390x/insn-data.def | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
target/s390x/insn-data.def +2 -2
@@ -1245,9 +1245,9 @@ F(0xe7e5, VFD, VRR_c, V, 0, 0, 0, 0, vfa, 0, IF_VEC) /* VECTOR LOAD FP INTEGER */ F(0xe7c7, VFI, VRR_a, V, 0, 0, 0, 0, vcdg, 0, IF_VEC) -/* VECTOR LOAD LENGTHENED */ +/* VECTOR FP LOAD LENGTHENED */ F(0xe7c4, VFLL, VRR_a, V, 0, 0, 0, 0, vfll, 0, IF_VEC) -/* VECTOR LOAD ROUNDED */ +/* VECTOR FP LOAD ROUNDED */ F(0xe7c5, VFLR, VRR_a, V, 0, 0, 0, 0, vcdg, 0, IF_VEC) /* VECTOR FP MULTIPLY */ F(0xe7e7, VFM, VRR_c, V, 0, 0, 0, 0, vfa, 0, IF_VEC)
Signature · 1 line
2.31.1
Re: [PATCH v2 02/26] s390x/tcg: Fix instruction name for VECTOR FP LOAD (LENGTHENED|ROUNDED)
Quoted 6 lines · David Hildenbrand
Let's use the correct name.
Signed-off-by David Hildenbrand<[email protected]>--- target/s390x/insn-data.def | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
r~
PATCH v2 3/26 s390x/tcg: Simplify vop64_3() handling
In reply to David HildenbrandLet's simplify, reworking our handler generation, passing the whole "m5" register content and not providing specialized handlers for "se", and reading/writing proper float64 values using new helpers.
--- target/s390x/helper.h | 4 -- target/s390x/translate_vx.c.inc | 11 ++-- target/s390x/vec_fpu_helper.c | 94 +++++++++------------------------ 3 files changed, 30 insertions(+), 79 deletions(-)
target/s390x/helper.h +0 -4
@@ -247,7 +247,6 @@ DEF_HELPER_6(gvec_vstrc_cc_rt32, void, ptr, cptr, cptr, cptr, env, i32)/* === Vector Floating-Point Instructions */ DEF_HELPER_FLAGS_5(gvec_vfa64, TCG_CALL_NO_WG, void, ptr, cptr, cptr, env, i32) -DEF_HELPER_FLAGS_5(gvec_vfa64s, TCG_CALL_NO_WG, void, ptr, cptr, cptr, env, i32) DEF_HELPER_4(gvec_wfc64, void, cptr, cptr, env, i32) DEF_HELPER_4(gvec_wfk64, void, cptr, cptr, env, i32)DEF_HELPER_FLAGS_5 (gvec_vfce64,TCG_CALL_NO_WG , void, ptr, cptr, cptr, env, i32)
@@ -271,7 +270,6 @@ DEF_HELPER_FLAGS_4(gvec_vcgd64s, TCG_CALL_NO_WG, void, ptr, cptr, env, i32) DEF_HELPER_FLAGS_4(gvec_vclgd64, TCG_CALL_NO_WG, void, ptr, cptr, env, i32) DEF_HELPER_FLAGS_4(gvec_vclgd64s, TCG_CALL_NO_WG, void, ptr, cptr, env, i32) DEF_HELPER_FLAGS_5(gvec_vfd64, TCG_CALL_NO_WG, void, ptr, cptr, cptr, env, i32) -DEF_HELPER_FLAGS_5(gvec_vfd64s, TCG_CALL_NO_WG, void, ptr, cptr, cptr, env, i32) DEF_HELPER_FLAGS_4(gvec_vfi64, TCG_CALL_NO_WG, void, ptr, cptr, env, i32) DEF_HELPER_FLAGS_4(gvec_vfi64s, TCG_CALL_NO_WG, void, ptr, cptr, env, i32)DEF_HELPER_FLAGS_4 (gvec_vfll32,TCG_CALL_NO_WG , void, ptr, cptr, env, i32)
@@ -279,7 +277,6 @@ DEF_HELPER_FLAGS_4(gvec_vfll32s, TCG_CALL_NO_WG, void, ptr, cptr, env, i32) DEF_HELPER_FLAGS_4(gvec_vflr64, TCG_CALL_NO_WG, void, ptr, cptr, env, i32) DEF_HELPER_FLAGS_4(gvec_vflr64s, TCG_CALL_NO_WG, void, ptr, cptr, env, i32) DEF_HELPER_FLAGS_5(gvec_vfm64, TCG_CALL_NO_WG, void, ptr, cptr, cptr, env, i32) -DEF_HELPER_FLAGS_5(gvec_vfm64s, TCG_CALL_NO_WG, void, ptr, cptr, cptr, env, i32) DEF_HELPER_FLAGS_6(gvec_vfma64, TCG_CALL_NO_WG, void, ptr, cptr, cptr, cptr, env, i32) DEF_HELPER_FLAGS_6(gvec_vfma64s, TCG_CALL_NO_WG, void, ptr, cptr, cptr, cptr, env, i32)DEF_HELPER_FLAGS_6 (gvec_vfms64,TCG_CALL_NO_WG , void, ptr, cptr, cptr, cptr, env, i32)
@@ -287,7 +284,6 @@ DEF_HELPER_FLAGS_6(gvec_vfms64s, TCG_CALL_NO_WG, void, ptr, cptr, cptr, cptr, en DEF_HELPER_FLAGS_4(gvec_vfsq64, TCG_CALL_NO_WG, void, ptr, cptr, env, i32) DEF_HELPER_FLAGS_4(gvec_vfsq64s, TCG_CALL_NO_WG, void, ptr, cptr, env, i32) DEF_HELPER_FLAGS_5(gvec_vfs64, TCG_CALL_NO_WG, void, ptr, cptr, cptr, env, i32) -DEF_HELPER_FLAGS_5(gvec_vfs64s, TCG_CALL_NO_WG, void, ptr, cptr, cptr, env, i32) DEF_HELPER_4(gvec_vftci64, void, ptr, cptr, env, i32)DEF_HELPER_4 (gvec_vftci64s, void, ptr, cptr, env, i32)
target/s390x/translate_vx.c.inc +5 -6
@@ -2443,7 +2443,6 @@ static DisasJumpType op_vfa(DisasContext *s, DisasOps *o) { const uint8_t fpf = get_field(s, m4); const uint8_t m5 = get_field(s, m5); - const bool se = extract32(m5, 3, 1); gen_helper_gvec_3_ptr *fn; if (fpf != FPF_LONG || extract32(m5, 0, 3)) {
@@ -2453,22 +2452,22 @@ static DisasJumpType op_vfa(DisasContext *s, DisasOps *o) switch (s->fields.op2) { case 0xe3: - fn = se ? gen_helper_gvec_vfa64s : gen_helper_gvec_vfa64; + fn = gen_helper_gvec_vfa64; break; case 0xe5: - fn = se ? gen_helper_gvec_vfd64s : gen_helper_gvec_vfd64; + fn = gen_helper_gvec_vfd64; break; case 0xe7: - fn = se ? gen_helper_gvec_vfm64s : gen_helper_gvec_vfm64; + fn = gen_helper_gvec_vfm64; break; case 0xe2: - fn = se ? gen_helper_gvec_vfs64s : gen_helper_gvec_vfs64; + fn = gen_helper_gvec_vfs64; break; default: g_assert_not_reached(); } gen_gvec_3_ptr(get_field(s, v1), get_field(s, v2), - get_field(s, v3), cpu_env, 0, fn); + get_field(s, v3), cpu_env, m5, fn); return DISAS_NEXT; }
target/s390x/vec_fpu_helper.c +25 -69
139 lines not on this page · raw message
Signature · 1 line
2.31.1
Re: [PATCH v2 03/26] s390x/tcg: Simplify vop64_3() handling
Quoted 11 lines · David Hildenbrand
Let's simplify, reworking our handler generation, passing the whole "m5" register content and not providing specialized handlers for "se", and reading/writing proper float64 values using new helpers.
Suggested-by Richard Henderson<[email protected]>Signed-off-by David Hildenbrand<[email protected]>--- target/s390x/helper.h | 4 -- target/s390x/translate_vx.c.inc | 11 ++-- target/s390x/vec_fpu_helper.c | 94 +++++++++------------------------ 3 files changed, 30 insertions(+), 79 deletions(-)
r~
PATCH v2 4/26 s390x/tcg: Simplify vop64_2() handling
In reply to David HildenbrandLet's rework our macros and simplify. We still need helper functions in most cases due to the different parameters types.
Next, we'll only have 32/128bit variants for vfi and vfsq, so special case the others.
Note that for vfsq, the XxC and erm passed in the simd_data() will never be set, resulting in the same behavior.
--- target/s390x/helper.h | 6 - target/s390x/translate_vx.c.inc | 18 ++- target/s390x/vec_fpu_helper.c | 194 +++++++++----------------------- 3 files changed, 60 insertions(+), 158 deletions(-)
target/s390x/helper.h +0 -6
@@ -262,16 +262,11 @@ DEF_HELPER_FLAGS_5(gvec_vfche64s, TCG_CALL_NO_WG, void, ptr, cptr, cptr, env, i3 DEF_HELPER_5(gvec_vfche64_cc, void, ptr, cptr, cptr, env, i32) DEF_HELPER_5(gvec_vfche64s_cc, void, ptr, cptr, cptr, env, i32) DEF_HELPER_FLAGS_4(gvec_vcdg64, TCG_CALL_NO_WG, void, ptr, cptr, env, i32) -DEF_HELPER_FLAGS_4(gvec_vcdg64s, TCG_CALL_NO_WG, void, ptr, cptr, env, i32) DEF_HELPER_FLAGS_4(gvec_vcdlg64, TCG_CALL_NO_WG, void, ptr, cptr, env, i32) -DEF_HELPER_FLAGS_4(gvec_vcdlg64s, TCG_CALL_NO_WG, void, ptr, cptr, env, i32) DEF_HELPER_FLAGS_4(gvec_vcgd64, TCG_CALL_NO_WG, void, ptr, cptr, env, i32) -DEF_HELPER_FLAGS_4(gvec_vcgd64s, TCG_CALL_NO_WG, void, ptr, cptr, env, i32) DEF_HELPER_FLAGS_4(gvec_vclgd64, TCG_CALL_NO_WG, void, ptr, cptr, env, i32) -DEF_HELPER_FLAGS_4(gvec_vclgd64s, TCG_CALL_NO_WG, void, ptr, cptr, env, i32) DEF_HELPER_FLAGS_5(gvec_vfd64, TCG_CALL_NO_WG, void, ptr, cptr, cptr, env, i32) DEF_HELPER_FLAGS_4(gvec_vfi64, TCG_CALL_NO_WG, void, ptr, cptr, env, i32) -DEF_HELPER_FLAGS_4(gvec_vfi64s, TCG_CALL_NO_WG, void, ptr, cptr, env, i32) DEF_HELPER_FLAGS_4(gvec_vfll32, TCG_CALL_NO_WG, void, ptr, cptr, env, i32) DEF_HELPER_FLAGS_4(gvec_vfll32s, TCG_CALL_NO_WG, void, ptr, cptr, env, i32)DEF_HELPER_FLAGS_4 (gvec_vflr64,TCG_CALL_NO_WG , void, ptr, cptr, env, i32)
@@ -282,7 +277,6 @@ DEF_HELPER_FLAGS_6(gvec_vfma64s, TCG_CALL_NO_WG, void, ptr, cptr, cptr, cptr, en DEF_HELPER_FLAGS_6(gvec_vfms64, TCG_CALL_NO_WG, void, ptr, cptr, cptr, cptr, env, i32) DEF_HELPER_FLAGS_6(gvec_vfms64s, TCG_CALL_NO_WG, void, ptr, cptr, cptr, cptr, env, i32) DEF_HELPER_FLAGS_4(gvec_vfsq64, TCG_CALL_NO_WG, void, ptr, cptr, env, i32) -DEF_HELPER_FLAGS_4(gvec_vfsq64s, TCG_CALL_NO_WG, void, ptr, cptr, env, i32) DEF_HELPER_FLAGS_5(gvec_vfs64, TCG_CALL_NO_WG, void, ptr, cptr, cptr, env, i32) DEF_HELPER_4(gvec_vftci64, void, ptr, cptr, env, i32)DEF_HELPER_4 (gvec_vftci64s, void, ptr, cptr, env, i32)
target/s390x/translate_vx.c.inc +7 -11
@@ -2558,19 +2558,19 @@ static DisasJumpType op_vcdg(DisasContext *s, DisasOps *o) switch (s->fields.op2) { case 0xc3: - fn = se ? gen_helper_gvec_vcdg64s : gen_helper_gvec_vcdg64; + fn = gen_helper_gvec_vcdg64; break; case 0xc1: - fn = se ? gen_helper_gvec_vcdlg64s : gen_helper_gvec_vcdlg64; + fn = gen_helper_gvec_vcdlg64; break; case 0xc2: - fn = se ? gen_helper_gvec_vcgd64s : gen_helper_gvec_vcgd64; + fn = gen_helper_gvec_vcgd64; break; case 0xc0: - fn = se ? gen_helper_gvec_vclgd64s : gen_helper_gvec_vclgd64; + fn = gen_helper_gvec_vclgd64; break; case 0xc7: - fn = se ? gen_helper_gvec_vfi64s : gen_helper_gvec_vfi64; + fn = gen_helper_gvec_vfi64; break; case 0xc5: fn = se ? gen_helper_gvec_vflr64s : gen_helper_gvec_vflr64;
@@ -2681,18 +2681,14 @@ static DisasJumpType op_vfsq(DisasContext *s, DisasOps *o) { const uint8_t fpf = get_field(s, m3); const uint8_t m4 = get_field(s, m4); - gen_helper_gvec_2_ptr *fn = gen_helper_gvec_vfsq64; if (fpf != FPF_LONG || extract32(m4, 0, 3)) { gen_program_exception(s, PGM_SPECIFICATION); return DISAS_NORETURN; } - if (extract32(m4, 3, 1)) { - fn = gen_helper_gvec_vfsq64s; - } - gen_gvec_2_ptr(get_field(s, v1), get_field(s, v2), cpu_env, - 0, fn); + gen_gvec_2_ptr(get_field(s, v1), get_field(s, v2), cpu_env, m4, + gen_helper_gvec_vfsq64); return DISAS_NEXT; }
target/s390x/vec_fpu_helper.c +53 -141
225 lines not on this page · raw message
Signature · 1 line
2.31.1
Re: [PATCH v2 04/26] s390x/tcg: Simplify vop64_2() handling
target/s390x/vec_fpu_helper.c static void vop64_2(S390Vector *v1, const S390Vector *v2, CPUS390XState *env, · line 146
Quoted 6 lines · David Hildenbrand
target/s390x/vec_fpu_helper.c +6
-0+#define DEF_GVEC_VOP2_FN (NAME ,FN ,BITS ) \ +void HELPER(gvec_##NAME##BITS)(void *v1, const void *v2, CPUS390XState *env, \ + uint32_t desc) \ +{ \ + const uint8_t erm = extract32(simd_data(desc), 4, 4); \ + const uint8_t se = extract32(simd_data(desc), 3, 1); \
bool for se? The argumemt to vopN_2 is bool...
Otherwise,
r~
PATCH v2 5/26 s390x/tcg: Simplify vfc64() handling
In reply to David HildenbrandPass the m5 field via simd_data() and don't provide specialized handlers for single-element variants.
--- target/s390x/helper.h | 6 --- target/s390x/translate_vx.c.inc | 45 +++++----------- target/s390x/vec_fpu_helper.c | 94 +++++++++------------------------ 3 files changed, 38 insertions(+), 107 deletions(-)
target/s390x/helper.h +0 -6
@@ -250,17 +250,11 @@ DEF_HELPER_FLAGS_5(gvec_vfa64, TCG_CALL_NO_WG, void, ptr, cptr, cptr, env, i32) DEF_HELPER_4(gvec_wfc64, void, cptr, cptr, env, i32) DEF_HELPER_4(gvec_wfk64, void, cptr, cptr, env, i32) DEF_HELPER_FLAGS_5(gvec_vfce64, TCG_CALL_NO_WG, void, ptr, cptr, cptr, env, i32) -DEF_HELPER_FLAGS_5(gvec_vfce64s, TCG_CALL_NO_WG, void, ptr, cptr, cptr, env, i32) DEF_HELPER_5(gvec_vfce64_cc, void, ptr, cptr, cptr, env, i32) -DEF_HELPER_5(gvec_vfce64s_cc, void, ptr, cptr, cptr, env, i32) DEF_HELPER_FLAGS_5(gvec_vfch64, TCG_CALL_NO_WG, void, ptr, cptr, cptr, env, i32) -DEF_HELPER_FLAGS_5(gvec_vfch64s, TCG_CALL_NO_WG, void, ptr, cptr, cptr, env, i32) DEF_HELPER_5(gvec_vfch64_cc, void, ptr, cptr, cptr, env, i32) -DEF_HELPER_5(gvec_vfch64s_cc, void, ptr, cptr, cptr, env, i32) DEF_HELPER_FLAGS_5(gvec_vfche64, TCG_CALL_NO_WG, void, ptr, cptr, cptr, env, i32) -DEF_HELPER_FLAGS_5(gvec_vfche64s, TCG_CALL_NO_WG, void, ptr, cptr, cptr, env, i32) DEF_HELPER_5(gvec_vfche64_cc, void, ptr, cptr, cptr, env, i32) -DEF_HELPER_5(gvec_vfche64s_cc, void, ptr, cptr, cptr, env, i32) DEF_HELPER_FLAGS_4(gvec_vcdg64, TCG_CALL_NO_WG, void, ptr, cptr, env, i32) DEF_HELPER_FLAGS_4(gvec_vcdlg64, TCG_CALL_NO_WG, void, ptr, cptr, env, i32)DEF_HELPER_FLAGS_4 (gvec_vcgd64,TCG_CALL_NO_WG , void, ptr, cptr, env, i32)
target/s390x/translate_vx.c.inc +14 -31
58 lines not on this page · raw message
target/s390x/vec_fpu_helper.c +24 -70
109 lines not on this page · raw message
Signature · 1 line
2.31.1
Re: [PATCH v2 05/26] s390x/tcg: Simplify vfc64() handling
Quoted 9 lines · David Hildenbrand
Pass the m5 field via
simd_data()and don't provide specialized handlers for single-element variants.Signed-off-by David Hildenbrand<[email protected]>--- target/s390x/helper.h | 6 --- target/s390x/translate_vx.c.inc | 45 +++++----------- target/s390x/vec_fpu_helper.c | 94 +++++++++------------------------ 3 files changed, 38 insertions(+), 107 deletions(-)
r~
PATCH v2 6/26 s390x/tcg: Simplify vftci64() handling
In reply to David Hildenbrand--- target/s390x/helper.h | 1 - target/s390x/translate_vx.c.inc | 7 ++----- target/s390x/vec_fpu_helper.c | 29 +++++++++++------------------ 3 files changed, 13 insertions(+), 24 deletions(-)
target/s390x/helper.h +0 -1
@@ -273,7 +273,6 @@ DEF_HELPER_FLAGS_6(gvec_vfms64s, TCG_CALL_NO_WG, void, ptr, cptr, cptr, cptr, en DEF_HELPER_FLAGS_4(gvec_vfsq64, TCG_CALL_NO_WG, void, ptr, cptr, env, i32) DEF_HELPER_FLAGS_5(gvec_vfs64, TCG_CALL_NO_WG, void, ptr, cptr, cptr, env, i32) DEF_HELPER_4(gvec_vftci64, void, ptr, cptr, env, i32) -DEF_HELPER_4(gvec_vftci64s, void, ptr, cptr, env, i32)#ifndef CONFIG_USER_ONLY DEF_HELPER_3 (servc, i32, env, i64, i64)
target/s390x/translate_vx.c.inc +2 -5
@@ -2680,17 +2680,14 @@ static DisasJumpType op_vftci(DisasContext *s, DisasOps *o) const uint16_t i3 = get_field(s, i3); const uint8_t fpf = get_field(s, m4); const uint8_t m5 = get_field(s, m5); - gen_helper_gvec_2_ptr *fn = gen_helper_gvec_vftci64; if (fpf != FPF_LONG || extract32(m5, 0, 3)) { gen_program_exception(s, PGM_SPECIFICATION); return DISAS_NORETURN; } - if (extract32(m5, 3, 1)) { - fn = gen_helper_gvec_vftci64s; - } - gen_gvec_2_ptr(get_field(s, v1), get_field(s, v2), cpu_env, i3, fn); + gen_gvec_2_ptr(get_field(s, v1), get_field(s, v2), cpu_env, + deposit32(m5, 4, 12, i3), gen_helper_gvec_vftci64); set_cc_static(s); return DISAS_NEXT; }
target/s390x/vec_fpu_helper.c +11 -18
@@ -415,13 +415,15 @@ void HELPER(gvec_vfms64s)(void *v1, const void *v2, const void *v3,vfma64 (v1, v2, v3, v4, env, true, float_muladd_negate_c,GETPC ()); } -static int vftci64 (S390Vector *v1,const S390Vector *v2,CPUS390XState *env, -bool s,uint16_t i3) +void HELPER (gvec_vftci64 )(void *v1,const void *v2,CPUS390XState *env, +uint32_t desc) { +const uint16_t i3 =extract32 (simd_data (desc),4 ,12 ); +const bool s =extract32 (simd_data (desc),3 ,1 );int i, match =0 ;for (i =0 ; i <2 ; i++) { -float64 a =s390_vec_read_element64 (v2, i); +const float64 a =s390_vec_read_float64 (v2, i);if (float64_dcmask (env, a) & i3) { match++;
@@ -434,20 +436,11 @@ static int vftci64(S390Vector *v1, const S390Vector *v2, CPUS390XState *env, } } -if (match) { -return s || match ==2 ?0 :1 ; +if (match ==2 || (s && match)) { + env->cc_op =0 ; + }else if (match) { + env->cc_op =1 ; + }else { + env->cc_op =3 ; } -return 3 ; -} - -void HELPER (gvec_vftci64 )(void *v1,const void *v2,CPUS390XState *env, -uint32_t desc) -{ - env->cc_op =vftci64 (v1, v2, env, false,simd_data (desc)); -} - -void HELPER (gvec_vftci64s )(void *v1,const void *v2,CPUS390XState *env, -uint32_t desc) -{ - env->cc_op =vftci64 (v1, v2, env, true,simd_data (desc)); }
Signature · 1 line
2.31.1
Re: [PATCH v2 06/26] s390x/tcg: Simplify vftci64() handling
Quoted 6 lines · David Hildenbrand
Signed-off-by David Hildenbrand<[email protected]>--- target/s390x/helper.h | 1 - target/s390x/translate_vx.c.inc | 7 ++----- target/s390x/vec_fpu_helper.c | 29 +++++++++++------------------ 3 files changed, 13 insertions(+), 24 deletions(-)
r~
PATCH v2 7/26 s390x/tcg: Simplify vfma64() handling
In reply to David Hildenbrand--- target/s390x/helper.h | 2 -- target/s390x/translate_vx.c.inc | 8 +++---- target/s390x/vec_fpu_helper.c | 42 +++++++++++++-------------------- 3 files changed, 20 insertions(+), 32 deletions(-)
target/s390x/helper.h +0 -2
@@ -267,9 +267,7 @@ DEF_HELPER_FLAGS_4(gvec_vflr64, TCG_CALL_NO_WG, void, ptr, cptr, env, i32) DEF_HELPER_FLAGS_4(gvec_vflr64s, TCG_CALL_NO_WG, void, ptr, cptr, env, i32) DEF_HELPER_FLAGS_5(gvec_vfm64, TCG_CALL_NO_WG, void, ptr, cptr, cptr, env, i32) DEF_HELPER_FLAGS_6(gvec_vfma64, TCG_CALL_NO_WG, void, ptr, cptr, cptr, cptr, env, i32) -DEF_HELPER_FLAGS_6(gvec_vfma64s, TCG_CALL_NO_WG, void, ptr, cptr, cptr, cptr, env, i32) DEF_HELPER_FLAGS_6(gvec_vfms64, TCG_CALL_NO_WG, void, ptr, cptr, cptr, cptr, env, i32) -DEF_HELPER_FLAGS_6(gvec_vfms64s, TCG_CALL_NO_WG, void, ptr, cptr, cptr, cptr, env, i32) DEF_HELPER_FLAGS_4(gvec_vfsq64, TCG_CALL_NO_WG, void, ptr, cptr, env, i32) DEF_HELPER_FLAGS_5(gvec_vfs64, TCG_CALL_NO_WG, void, ptr, cptr, cptr, env, i32)DEF_HELPER_4 (gvec_vftci64, void, ptr, cptr, env, i32)
target/s390x/translate_vx.c.inc +3 -5
@@ -2589,7 +2589,6 @@ static DisasJumpType op_vfma(DisasContext *s, DisasOps *o) { const uint8_t m5 = get_field(s, m5); const uint8_t fpf = get_field(s, m6); - const bool se = extract32(m5, 3, 1); gen_helper_gvec_4_ptr *fn; if (fpf != FPF_LONG || extract32(m5, 0, 3)) {
@@ -2598,13 +2597,12 @@ static DisasJumpType op_vfma(DisasContext *s, DisasOps *o) } if (s->fields.op2 == 0x8f) { - fn = se ? gen_helper_gvec_vfma64s : gen_helper_gvec_vfma64; + fn = gen_helper_gvec_vfma64; } else { - fn = se ? gen_helper_gvec_vfms64s : gen_helper_gvec_vfms64; + fn = gen_helper_gvec_vfms64; } gen_gvec_4_ptr(get_field(s, v1), get_field(s, v2), - get_field(s, v3), get_field(s, v4), cpu_env, - 0, fn); + get_field(s, v3), get_field(s, v4), cpu_env, m5, fn); return DISAS_NEXT; }
target/s390x/vec_fpu_helper.c +17 -25
58 lines not on this page · raw message
Signature · 1 line
2.31.1
Re: [PATCH v2 07/26] s390x/tcg: Simplify vfma64() handling
Quoted 6 lines · David Hildenbrand
Signed-off-by David Hildenbrand<[email protected]>--- target/s390x/helper.h | 2 -- target/s390x/translate_vx.c.inc | 8 +++---- target/s390x/vec_fpu_helper.c | 42 +++++++++++++-------------------- 3 files changed, 20 insertions(+), 32 deletions(-)
r~
PATCH v2 8/26 s390x/tcg: Simplify vfll32() handling
In reply to David Hildenbrand--- target/s390x/helper.h | 1 - target/s390x/translate_vx.c.inc | 6 +----- target/s390x/vec_fpu_helper.c | 21 +++++---------------- 3 files changed, 6 insertions(+), 22 deletions(-)
target/s390x/helper.h +0 -1
@@ -262,7 +262,6 @@ DEF_HELPER_FLAGS_4(gvec_vclgd64, TCG_CALL_NO_WG, void, ptr, cptr, env, i32) DEF_HELPER_FLAGS_5(gvec_vfd64, TCG_CALL_NO_WG, void, ptr, cptr, cptr, env, i32) DEF_HELPER_FLAGS_4(gvec_vfi64, TCG_CALL_NO_WG, void, ptr, cptr, env, i32) DEF_HELPER_FLAGS_4(gvec_vfll32, TCG_CALL_NO_WG, void, ptr, cptr, env, i32) -DEF_HELPER_FLAGS_4(gvec_vfll32s, TCG_CALL_NO_WG, void, ptr, cptr, env, i32) DEF_HELPER_FLAGS_4(gvec_vflr64, TCG_CALL_NO_WG, void, ptr, cptr, env, i32) DEF_HELPER_FLAGS_4(gvec_vflr64s, TCG_CALL_NO_WG, void, ptr, cptr, env, i32)DEF_HELPER_FLAGS_5 (gvec_vfm64,TCG_CALL_NO_WG , void, ptr, cptr, cptr, env, i32)
target/s390x/translate_vx.c.inc +1 -5
@@ -2570,18 +2570,14 @@ static DisasJumpType op_vfll(DisasContext *s, DisasOps *o) { const uint8_t fpf = get_field(s, m3); const uint8_t m4 = get_field(s, m4); - gen_helper_gvec_2_ptr *fn = gen_helper_gvec_vfll32; if (fpf != FPF_SHORT || extract32(m4, 0, 3)) { gen_program_exception(s, PGM_SPECIFICATION); return DISAS_NORETURN; } - if (extract32(m4, 3, 1)) { - fn = gen_helper_gvec_vfll32s; - } gen_gvec_2_ptr(get_field(s, v1), get_field(s, v2), cpu_env, - 0, fn); + m4, gen_helper_gvec_vfll32); return DISAS_NEXT; }
target/s390x/vec_fpu_helper.c +5 -16
@@ -289,9 +289,10 @@ DEF_GVEC_VFC(vfce, eq) DEF_GVEC_VFC(vfch, lt) DEF_GVEC_VFC(vfche, le) -static void vfll32 (S390Vector *v1,const S390Vector *v2,CPUS390XState *env, -bool s,uintptr_t retaddr) +void HELPER (gvec_vfll32 )(void *v1,const void *v2,CPUS390XState *env, +uint32_t desc) { +const bool s =extract32 (simd_data (desc),3 ,1 );uint8_t vxc, vec_exc =0 ;S390Vector tmp = {};int i;
@@ -308,20 +309,8 @@ static void vfll32(S390Vector *v1, const S390Vector *v2, CPUS390XState *env,break ; } } -handle_ieee_exc (env, vxc, vec_exc, retaddr); - *v1 = tmp; -} - -void HELPER (gvec_vfll32 )(void *v1,const void *v2,CPUS390XState *env, -uint32_t desc) -{ -vfll32 (v1, v2, env, false,GETPC ()); -} - -void HELPER (gvec_vfll32s )(void *v1,const void *v2,CPUS390XState *env, -uint32_t desc) -{ -vfll32 (v1, v2, env, true,GETPC ()); +handle_ieee_exc (env, vxc, vec_exc,GETPC ()); + *(S390Vector *)v1 = tmp; } static void vflr64(S390Vector *v1, const S390Vector *v2, CPUS390XState *env,
Signature · 1 line
2.31.1
Re: [PATCH v2 08/26] s390x/tcg: Simplify vfll32() handling
Quoted 6 lines · David Hildenbrand
Signed-off-by David Hildenbrand<[email protected]>--- target/s390x/helper.h | 1 - target/s390x/translate_vx.c.inc | 6 +----- target/s390x/vec_fpu_helper.c | 21 +++++---------------- 3 files changed, 6 insertions(+), 22 deletions(-)
r~
PATCH v2 9/26 s390x/tcg: Simplify vflr64() handling
In reply to David Hildenbrand--- target/s390x/helper.h | 1 - target/s390x/translate_vx.c.inc | 3 +-- target/s390x/vec_fpu_helper.c | 29 +++++++---------------------- 3 files changed, 8 insertions(+), 25 deletions(-)
target/s390x/helper.h +0 -1
@@ -263,7 +263,6 @@ DEF_HELPER_FLAGS_5(gvec_vfd64, TCG_CALL_NO_WG, void, ptr, cptr, cptr, env, i32) DEF_HELPER_FLAGS_4(gvec_vfi64, TCG_CALL_NO_WG, void, ptr, cptr, env, i32) DEF_HELPER_FLAGS_4(gvec_vfll32, TCG_CALL_NO_WG, void, ptr, cptr, env, i32) DEF_HELPER_FLAGS_4(gvec_vflr64, TCG_CALL_NO_WG, void, ptr, cptr, env, i32) -DEF_HELPER_FLAGS_4(gvec_vflr64s, TCG_CALL_NO_WG, void, ptr, cptr, env, i32) DEF_HELPER_FLAGS_5(gvec_vfm64, TCG_CALL_NO_WG, void, ptr, cptr, cptr, env, i32) DEF_HELPER_FLAGS_6(gvec_vfma64, TCG_CALL_NO_WG, void, ptr, cptr, cptr, cptr, env, i32)DEF_HELPER_FLAGS_6 (gvec_vfms64,TCG_CALL_NO_WG , void, ptr, cptr, cptr, cptr, env, i32)
target/s390x/translate_vx.c.inc +1 -2
@@ -2531,7 +2531,6 @@ static DisasJumpType op_vcdg(DisasContext *s, DisasOps *o) const uint8_t fpf = get_field(s, m3); const uint8_t m4 = get_field(s, m4); const uint8_t erm = get_field(s, m5); - const bool se = extract32(m4, 3, 1); gen_helper_gvec_2_ptr *fn; if (fpf != FPF_LONG || extract32(m4, 0, 2) || erm > 7 || erm == 2) {
@@ -2556,7 +2555,7 @@ static DisasJumpType op_vcdg(DisasContext *s, DisasOps *o) fn = gen_helper_gvec_vfi64; break; case 0xc5: - fn = se ? gen_helper_gvec_vflr64s : gen_helper_gvec_vflr64; + fn = gen_helper_gvec_vflr64; break; default: g_assert_not_reached();
target/s390x/vec_fpu_helper.c +7 -22
@@ -313,9 +313,12 @@ void HELPER(gvec_vfll32)(void *v1, const void *v2, CPUS390XState *env, *(S390Vector *)v1 = tmp; } -static void vflr64 (S390Vector *v1,const S390Vector *v2,CPUS390XState *env, -bool s,bool XxC,uint8_t erm,uintptr_t retaddr) +void HELPER (gvec_vflr64 )(void *v1,const void *v2,CPUS390XState *env, +uint32_t desc) { +const uint8_t erm =extract32 (simd_data (desc),4 ,4 ); +const bool s =extract32 (simd_data (desc),3 ,1 ); +const bool XxC =extract32 (simd_data (desc),2 ,1 );uint8_t vxc, vec_exc =0 ;S390Vector tmp = {};int i, old_mode;
@@ -334,26 +337,8 @@ static void vflr64(S390Vector *v1, const S390Vector *v2, CPUS390XState *env, } }s390_restore_bfp_rounding_mode (env, old_mode); -handle_ieee_exc (env, vxc, vec_exc, retaddr); - *v1 = tmp; -} - -void HELPER (gvec_vflr64 )(void *v1,const void *v2,CPUS390XState *env, -uint32_t desc) -{ -const uint8_t erm =extract32 (simd_data (desc),4 ,4 ); -const bool XxC =extract32 (simd_data (desc),2 ,1 ); - -vflr64 (v1, v2, env, false, XxC, erm,GETPC ()); -} - -void HELPER (gvec_vflr64s )(void *v1,const void *v2,CPUS390XState *env, -uint32_t desc) -{ -const uint8_t erm =extract32 (simd_data (desc),4 ,4 ); -const bool XxC =extract32 (simd_data (desc),2 ,1 ); - -vflr64 (v1, v2, env, true, XxC, erm,GETPC ()); +handle_ieee_exc (env, vxc, vec_exc,GETPC ()); + *(S390Vector *)v1 = tmp; } static void vfma64(S390Vector *v1, const S390Vector *v2, const S390Vector *v3,
Signature · 1 line
2.31.1
Re: [PATCH v2 09/26] s390x/tcg: Simplify vflr64() handling
Quoted 6 lines · David Hildenbrand
Signed-off-by David Hildenbrand<[email protected]>--- target/s390x/helper.h | 1 - target/s390x/translate_vx.c.inc | 3 +-- target/s390x/vec_fpu_helper.c | 29 +++++++---------------------- 3 files changed, 8 insertions(+), 25 deletions(-)
r~
PATCH v2 10/26 s390x/tcg: Simplify wfc64() handling
In reply to David Hildenbrand... and prepare for 32/128 bit support.
--- target/s390x/vec_fpu_helper.c | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-)
target/s390x/vec_fpu_helper.c +12 -11
@@ -203,8 +203,8 @@ static int wfc64(const S390Vector *v1, const S390Vector *v2, CPUS390XState *env, bool signal, uintptr_t retaddr) { /* only the zero-indexed elements are compared */ - const float64 a = s390_vec_read_element64(v1, 0); -const float64 b =s390_vec_read_element64 (v2,0 ); + const float64 a = s390_vec_read_float64(v1, 0); +const float64 b =s390_vec_read_float64 (v2,0 );uint8_t vxc, vec_exc =0 ;int cmp;
@@ -219,17 +219,18 @@ static int wfc64(const S390Vector *v1, const S390Vector *v2,return float_comp_to_cc (env, cmp); } -void HELPER (gvec_wfc64 )(const void *v1,const void *v2,CPUS390XState *env, -uint32_t desc) -{ - env->cc_op =wfc64 (v1, v2, env, false,GETPC ()); +#define DEF_GVEC_WFC_B (NAME ,SIGNAL ,BITS ) \ +void HELPER(gvec_##NAME##BITS)(const void *v1, const void *v2, \ + CPUS390XState *env, uint32_t desc) \ +{ \ + env->cc_op = wfc##BITS(v1, v2, env, SIGNAL, GETPC()); \ } -void HELPER (gvec_wfk64 )(const void *v1,const void *v2,CPUS390XState *env, -uint32_t desc) -{ - env->cc_op =wfc64 (v1, v2, env, true,GETPC ()); -} +#define DEF_GVEC_WFC (NAME ,SIGNAL ) \ + DEF_GVEC_WFC_B(NAME, SIGNAL, 64) + +DEF_GVEC_WFC(wfc, false) +DEF_GVEC_WFC(wfk, true)typedef bool (*vfc64_fn )(float64 a,float64 b,float_status *status); static int vfc64(S390Vector *v1, const S390Vector *v2, const S390Vector *v3,
Signature · 1 line
2.31.1
Re: [PATCH v2 10/26] s390x/tcg: Simplify wfc64() handling
Quoted 6 lines · David Hildenbrand
... and prepare for 32/128 bit support.
Signed-off-by David Hildenbrand<[email protected]>--- target/s390x/vec_fpu_helper.c | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-)
r~
PATCH v2 11/26 s390x/tcg: Implement VECTOR BIT PERMUTE
In reply to David Hildenbrand--- target/s390x/helper.h | 1 + target/s390x/insn-data.def | 2 ++ target/s390x/translate_vx.c.inc | 8 ++++++++ target/s390x/vec_helper.c | 22 ++++++++++++++++++++++ 4 files changed, 33 insertions(+)
target/s390x/helper.h +1 -0
@@ -126,6 +126,7 @@ DEF_HELPER_FLAGS_1(stck, TCG_CALL_NO_RWG_SE, i64, env)DEF_HELPER_FLAGS_3 (probe_write_access,TCG_CALL_NO_WG , void, env, i64, i64) /* === Vector Support Instructions === */ +DEF_HELPER_FLAGS_4(gvec_vbperm, TCG_CALL_NO_RWG, void, ptr, cptr, cptr, i32) DEF_HELPER_FLAGS_4(vll, TCG_CALL_NO_WG, void, env, ptr, i64, i64) DEF_HELPER_FLAGS_4(gvec_vpk16, TCG_CALL_NO_RWG, void, ptr, cptr, cptr, i32)DEF_HELPER_FLAGS_4 (gvec_vpk32,TCG_CALL_NO_RWG , void, ptr, cptr, cptr, i32)
target/s390x/insn-data.def +2 -0
@@ -989,6 +989,8 @@ /* === Vector Support Instructions === */ +/* VECTOR BIT PERMUTE */ + E(0xe785, VBPERM, VRR_c, VE, 0, 0, 0, 0, vbperm, 0, 0, IF_VEC) /* VECTOR GATHER ELEMENT */ E(0xe713, VGEF, VRV, V, la2, 0, 0, 0, vge, 0, ES_32, IF_VEC) E(0xe712, VGEG, VRV, V, la2, 0, 0, 0, vge, 0, ES_64, IF_VEC)
target/s390x/translate_vx.c.inc +8 -0
@@ -327,6 +327,14 @@ static void gen_addi2_i64(TCGv_i64 dl, TCGv_i64 dh, TCGv_i64 al, TCGv_i64 ah, tcg_temp_free_i64(bh); } +static DisasJumpType op_vbperm(DisasContext *s, DisasOps *o) +{ + gen_gvec_3_ool(get_field(s, v1), get_field(s, v2), get_field(s, v3), 0, + gen_helper_gvec_vbperm); + + return DISAS_NEXT; +} + static DisasJumpType op_vge(DisasContext *s, DisasOps *o) { const uint8_t es = s->insn->data;
target/s390x/vec_helper.c +22 -0
@@ -19,6 +19,28 @@#include "exec/cpu_ldst.h" #include "exec/exec-all.h" +void HELPER (gvec_vbperm )(void *v1,const void *v2,const void *v3, +uint32_t desc) +{ +S390Vector tmp = {}; +uint16_t result =0 ; +int i; + +for (i =0 ; i <16 ; i++) { +const uint8_t bit_nr =s390_vec_read_element8 (v3, i); +uint16_t bit; + +if (bit_nr >=128 ) { +continue ; + } + bit = (s390_vec_read_element8 (v2, bit_nr /8 ) + >> (7 - (bit_nr %8 ))) &1 ; + result |= (bit << (15 - i)); + } +s390_vec_write_element16 (&tmp,3 , result); + *(S390Vector *)v1 = tmp; +} +void HELPER (vll )(CPUS390XState *env,void *v1,uint64_t addr,uint64_t bytes) {if (likely (bytes >=16 )) {
Signature · 1 line
2.31.1
PATCH v2 12/26 s390x/tcg: Implement VECTOR MULTIPLY SUM LOGICAL
In reply to David HildenbrandFortunately, we only need the Doubleword implementation.
--- target/s390x/insn-data.def | 2 ++ target/s390x/translate_vx.c.inc | 50 +++++++++++++++++++++++++++++++++ 2 files changed, 52 insertions(+)
target/s390x/insn-data.def +2 -0
@@ -1151,6 +1151,8 @@ F(0xe7a7, VMO, VRR_c, V, 0, 0, 0, 0, vm, 0, IF_VEC) /* VECTOR MULTIPLY LOGICAL ODD */ F(0xe7a5, VMLO, VRR_c, V, 0, 0, 0, 0, vm, 0, IF_VEC) +/* VECTOR MULTIPLY SUM LOGICAL */ + F(0xe7b8, VMSL, VRR_d, VE, 0, 0, 0, 0, vmsl, 0, IF_VEC) /* VECTOR NAND */ F(0xe76e, VNN, VRR_c, VE, 0, 0, 0, 0, vnn, 0, IF_VEC) /* VECTOR NOR */
target/s390x/translate_vx.c.inc +50 -0
56 lines not on this page · raw message
Signature · 1 line
2.31.1
PATCH v2 13/26 s390x/tcg: Implement 32/128 bit for VECTOR FP (ADD|DIVIDE|MULTIPLY|SUBTRACT)
In reply to David HildenbrandIn case of 128bit, we always have a single element. Add new helpers for reading/writing 32/128 bit floats.
--- target/s390x/helper.h | 8 ++++ target/s390x/translate_vx.c.inc | 85 +++++++++++++++++++++++++++++---- target/s390x/vec_fpu_helper.c | 74 ++++++++++++++++++++++++++-- 3 files changed, 153 insertions(+), 14 deletions(-)
target/s390x/helper.h +8 -0
@@ -247,7 +247,9 @@ DEF_HELPER_6(gvec_vstrc_cc_rt16, void, ptr, cptr, cptr, cptr, env, i32)DEF_HELPER_6 (gvec_vstrc_cc_rt32, void, ptr, cptr, cptr, cptr, env, i32) /* === Vector Floating-Point Instructions */ +DEF_HELPER_FLAGS_5(gvec_vfa32, TCG_CALL_NO_WG, void, ptr, cptr, cptr, env, i32) DEF_HELPER_FLAGS_5(gvec_vfa64, TCG_CALL_NO_WG, void, ptr, cptr, cptr, env, i32) +DEF_HELPER_FLAGS_5(gvec_vfa128, TCG_CALL_NO_WG, void, ptr, cptr, cptr, env, i32) DEF_HELPER_4(gvec_wfc64, void, cptr, cptr, env, i32) DEF_HELPER_4(gvec_wfk64, void, cptr, cptr, env, i32)DEF_HELPER_FLAGS_5 (gvec_vfce64,TCG_CALL_NO_WG , void, ptr, cptr, cptr, env, i32)
@@ -260,15 +262,21 @@ DEF_HELPER_FLAGS_4(gvec_vcdg64, TCG_CALL_NO_WG, void, ptr, cptr, env, i32) DEF_HELPER_FLAGS_4(gvec_vcdlg64, TCG_CALL_NO_WG, void, ptr, cptr, env, i32) DEF_HELPER_FLAGS_4(gvec_vcgd64, TCG_CALL_NO_WG, void, ptr, cptr, env, i32) DEF_HELPER_FLAGS_4(gvec_vclgd64, TCG_CALL_NO_WG, void, ptr, cptr, env, i32) +DEF_HELPER_FLAGS_5(gvec_vfd32, TCG_CALL_NO_WG, void, ptr, cptr, cptr, env, i32) DEF_HELPER_FLAGS_5(gvec_vfd64, TCG_CALL_NO_WG, void, ptr, cptr, cptr, env, i32) +DEF_HELPER_FLAGS_5(gvec_vfd128, TCG_CALL_NO_WG, void, ptr, cptr, cptr, env, i32) DEF_HELPER_FLAGS_4(gvec_vfi64, TCG_CALL_NO_WG, void, ptr, cptr, env, i32) DEF_HELPER_FLAGS_4(gvec_vfll32, TCG_CALL_NO_WG, void, ptr, cptr, env, i32) DEF_HELPER_FLAGS_4(gvec_vflr64, TCG_CALL_NO_WG, void, ptr, cptr, env, i32) +DEF_HELPER_FLAGS_5(gvec_vfm32, TCG_CALL_NO_WG, void, ptr, cptr, cptr, env, i32) DEF_HELPER_FLAGS_5(gvec_vfm64, TCG_CALL_NO_WG, void, ptr, cptr, cptr, env, i32) +DEF_HELPER_FLAGS_5(gvec_vfm128, TCG_CALL_NO_WG, void, ptr, cptr, cptr, env, i32) DEF_HELPER_FLAGS_6(gvec_vfma64, TCG_CALL_NO_WG, void, ptr, cptr, cptr, cptr, env, i32) DEF_HELPER_FLAGS_6(gvec_vfms64, TCG_CALL_NO_WG, void, ptr, cptr, cptr, cptr, env, i32) DEF_HELPER_FLAGS_4(gvec_vfsq64, TCG_CALL_NO_WG, void, ptr, cptr, env, i32) +DEF_HELPER_FLAGS_5(gvec_vfs32, TCG_CALL_NO_WG, void, ptr, cptr, cptr, env, i32) DEF_HELPER_FLAGS_5(gvec_vfs64, TCG_CALL_NO_WG, void, ptr, cptr, cptr, env, i32) +DEF_HELPER_FLAGS_5(gvec_vfs128, TCG_CALL_NO_WG, void, ptr, cptr, cptr, env, i32) DEF_HELPER_4(gvec_vftci64, void, ptr, cptr, env, i32)#ifndef CONFIG_USER_ONLY
target/s390x/translate_vx.c.inc +75 -10
104 lines not on this page · raw message
target/s390x/vec_fpu_helper.c +70 -4
107 lines not on this page · raw message
Signature · 1 line
2.31.1
Re: [PATCH v2 13/26] s390x/tcg: Implement 32/128 bit for VECTOR FP (ADD|DIVIDE|MULTIPLY|SUBTRACT)
Quoted 9 lines · David Hildenbrand
In case of 128bit, we always have a single element. Add new helpers for reading/writing 32/128 bit floats.
Signed-off-by David Hildenbrand<[email protected]>--- target/s390x/helper.h | 8 ++++ target/s390x/translate_vx.c.inc | 85 +++++++++++++++++++++++++++++---- target/s390x/vec_fpu_helper.c | 74 ++++++++++++++++++++++++++-- 3 files changed, 153 insertions(+), 14 deletions(-)
r~
PATCH v2 14/26 s390x/tcg: Implement 32/128 bit for VECTOR (LOAD FP INTEGER|FP SQUARE ROOT)
In reply to David Hildenbrand--- target/s390x/helper.h | 4 ++ target/s390x/translate_vx.c.inc | 74 ++++++++++++++++++++++++++------- target/s390x/vec_fpu_helper.c | 46 +++++++++++++++++++- 3 files changed, 109 insertions(+), 15 deletions(-)
target/s390x/helper.h +4 -0
@@ -265,7 +265,9 @@ DEF_HELPER_FLAGS_4(gvec_vclgd64, TCG_CALL_NO_WG, void, ptr, cptr, env, i32) DEF_HELPER_FLAGS_5(gvec_vfd32, TCG_CALL_NO_WG, void, ptr, cptr, cptr, env, i32) DEF_HELPER_FLAGS_5(gvec_vfd64, TCG_CALL_NO_WG, void, ptr, cptr, cptr, env, i32) DEF_HELPER_FLAGS_5(gvec_vfd128, TCG_CALL_NO_WG, void, ptr, cptr, cptr, env, i32) +DEF_HELPER_FLAGS_4(gvec_vfi32, TCG_CALL_NO_WG, void, ptr, cptr, env, i32) DEF_HELPER_FLAGS_4(gvec_vfi64, TCG_CALL_NO_WG, void, ptr, cptr, env, i32) +DEF_HELPER_FLAGS_4(gvec_vfi128, TCG_CALL_NO_WG, void, ptr, cptr, env, i32) DEF_HELPER_FLAGS_4(gvec_vfll32, TCG_CALL_NO_WG, void, ptr, cptr, env, i32) DEF_HELPER_FLAGS_4(gvec_vflr64, TCG_CALL_NO_WG, void, ptr, cptr, env, i32)DEF_HELPER_FLAGS_5 (gvec_vfm32,TCG_CALL_NO_WG , void, ptr, cptr, cptr, env, i32)
@@ -273,7 +275,9 @@ DEF_HELPER_FLAGS_5(gvec_vfm64, TCG_CALL_NO_WG, void, ptr, cptr, cptr, env, i32) DEF_HELPER_FLAGS_5(gvec_vfm128, TCG_CALL_NO_WG, void, ptr, cptr, cptr, env, i32) DEF_HELPER_FLAGS_6(gvec_vfma64, TCG_CALL_NO_WG, void, ptr, cptr, cptr, cptr, env, i32) DEF_HELPER_FLAGS_6(gvec_vfms64, TCG_CALL_NO_WG, void, ptr, cptr, cptr, cptr, env, i32) +DEF_HELPER_FLAGS_4(gvec_vfsq32, TCG_CALL_NO_WG, void, ptr, cptr, env, i32) DEF_HELPER_FLAGS_4(gvec_vfsq64, TCG_CALL_NO_WG, void, ptr, cptr, env, i32) +DEF_HELPER_FLAGS_4(gvec_vfsq128, TCG_CALL_NO_WG, void, ptr, cptr, env, i32) DEF_HELPER_FLAGS_5(gvec_vfs32, TCG_CALL_NO_WG, void, ptr, cptr, cptr, env, i32) DEF_HELPER_FLAGS_5(gvec_vfs64, TCG_CALL_NO_WG, void, ptr, cptr, cptr, env, i32)DEF_HELPER_FLAGS_5 (gvec_vfs128,TCG_CALL_NO_WG , void, ptr, cptr, cptr, env, i32)
target/s390x/translate_vx.c.inc +60 -14
109 lines not on this page · raw message
target/s390x/vec_fpu_helper.c +45 -1
64 lines not on this page · raw message
Signature · 1 line
2.31.1
Re: [PATCH v2 14/26] s390x/tcg: Implement 32/128 bit for VECTOR (LOAD FP INTEGER|FP SQUARE ROOT)
Quoted 6 lines · David Hildenbrand
Signed-off-by David Hildenbrand<[email protected]>--- target/s390x/helper.h | 4 ++ target/s390x/translate_vx.c.inc | 74 ++++++++++++++++++++++++++------- target/s390x/vec_fpu_helper.c | 46 +++++++++++++++++++- 3 files changed, 109 insertions(+), 15 deletions(-)
r~
PATCH v2 15/26 s390x/tcg: Implement 32/128 bit for VECTOR FP COMPARE *
In reply to David HildenbrandIn addition to 32/128bit variants, we also have to support the "Signal-on-QNaN (SQ)" bit.
--- target/s390x/helper.h | 12 +++++++ target/s390x/translate_vx.c.inc | 57 ++++++++++++++++++++++++----- target/s390x/vec_fpu_helper.c | 64 +++++++++++++++++++++++++++++++-- 3 files changed, 121 insertions(+), 12 deletions(-)
target/s390x/helper.h +12 -0
@@ -252,12 +252,24 @@ DEF_HELPER_FLAGS_5(gvec_vfa64, TCG_CALL_NO_WG, void, ptr, cptr, cptr, env, i32) DEF_HELPER_FLAGS_5(gvec_vfa128, TCG_CALL_NO_WG, void, ptr, cptr, cptr, env, i32) DEF_HELPER_4(gvec_wfc64, void, cptr, cptr, env, i32) DEF_HELPER_4(gvec_wfk64, void, cptr, cptr, env, i32) +DEF_HELPER_FLAGS_5(gvec_vfce32, TCG_CALL_NO_WG, void, ptr, cptr, cptr, env, i32) +DEF_HELPER_5(gvec_vfce32_cc, void, ptr, cptr, cptr, env, i32) DEF_HELPER_FLAGS_5(gvec_vfce64, TCG_CALL_NO_WG, void, ptr, cptr, cptr, env, i32) DEF_HELPER_5(gvec_vfce64_cc, void, ptr, cptr, cptr, env, i32) +DEF_HELPER_FLAGS_5(gvec_vfce128, TCG_CALL_NO_WG, void, ptr, cptr, cptr, env, i32) +DEF_HELPER_5(gvec_vfce128_cc, void, ptr, cptr, cptr, env, i32) +DEF_HELPER_FLAGS_5(gvec_vfch32, TCG_CALL_NO_WG, void, ptr, cptr, cptr, env, i32) +DEF_HELPER_5(gvec_vfch32_cc, void, ptr, cptr, cptr, env, i32) DEF_HELPER_FLAGS_5(gvec_vfch64, TCG_CALL_NO_WG, void, ptr, cptr, cptr, env, i32) DEF_HELPER_5(gvec_vfch64_cc, void, ptr, cptr, cptr, env, i32) +DEF_HELPER_FLAGS_5(gvec_vfch128, TCG_CALL_NO_WG, void, ptr, cptr, cptr, env, i32) +DEF_HELPER_5(gvec_vfch128_cc, void, ptr, cptr, cptr, env, i32) +DEF_HELPER_FLAGS_5(gvec_vfche32, TCG_CALL_NO_WG, void, ptr, cptr, cptr, env, i32) +DEF_HELPER_5(gvec_vfche32_cc, void, ptr, cptr, cptr, env, i32) DEF_HELPER_FLAGS_5(gvec_vfche64, TCG_CALL_NO_WG, void, ptr, cptr, cptr, env, i32) DEF_HELPER_5(gvec_vfche64_cc, void, ptr, cptr, cptr, env, i32) +DEF_HELPER_FLAGS_5(gvec_vfche128, TCG_CALL_NO_WG, void, ptr, cptr, cptr, env, i32) +DEF_HELPER_5(gvec_vfche128_cc, void, ptr, cptr, cptr, env, i32) DEF_HELPER_FLAGS_4(gvec_vcdg64, TCG_CALL_NO_WG, void, ptr, cptr, env, i32) DEF_HELPER_FLAGS_4(gvec_vcdlg64, TCG_CALL_NO_WG, void, ptr, cptr, env, i32)DEF_HELPER_FLAGS_4 (gvec_vcgd64,TCG_CALL_NO_WG , void, ptr, cptr, env, i32)
target/s390x/translate_vx.c.inc +48 -9
74 lines not on this page · raw message
target/s390x/vec_fpu_helper.c +61 -3
92 lines not on this page · raw message
Signature · 1 line
2.31.1
Re: [PATCH v2 15/26] s390x/tcg: Implement 32/128 bit for VECTOR FP COMPARE *
Quoted 9 lines · David Hildenbrand
In addition to 32/128bit variants, we also have to support the "Signal-on-QNaN (SQ)" bit.
Signed-off-by David Hildenbrand<[email protected]>--- target/s390x/helper.h | 12 +++++++ target/s390x/translate_vx.c.inc | 57 ++++++++++++++++++++++++----- target/s390x/vec_fpu_helper.c | 64 +++++++++++++++++++++++++++++++-- 3 files changed, 121 insertions(+), 12 deletions(-)
r~
PATCH v2 16/26 s390x/tcg: Implement 32/128 bit for VECTOR FP COMPARE (AND SIGNAL) SCALAR
In reply to David Hildenbrand--- target/s390x/helper.h | 4 +++ target/s390x/translate_vx.c.inc | 38 ++++++++++++++++++++++------ target/s390x/vec_fpu_helper.c | 44 ++++++++++++++++++++++++++++++++- 3 files changed, 77 insertions(+), 9 deletions(-)
target/s390x/helper.h +4 -0
@@ -250,8 +250,12 @@ DEF_HELPER_6(gvec_vstrc_cc_rt32, void, ptr, cptr, cptr, cptr, env, i32) DEF_HELPER_FLAGS_5(gvec_vfa32, TCG_CALL_NO_WG, void, ptr, cptr, cptr, env, i32) DEF_HELPER_FLAGS_5(gvec_vfa64, TCG_CALL_NO_WG, void, ptr, cptr, cptr, env, i32) DEF_HELPER_FLAGS_5(gvec_vfa128, TCG_CALL_NO_WG, void, ptr, cptr, cptr, env, i32) +DEF_HELPER_4(gvec_wfc32, void, cptr, cptr, env, i32) +DEF_HELPER_4(gvec_wfk32, void, cptr, cptr, env, i32) DEF_HELPER_4(gvec_wfc64, void, cptr, cptr, env, i32) DEF_HELPER_4(gvec_wfk64, void, cptr, cptr, env, i32) +DEF_HELPER_4(gvec_wfc128, void, cptr, cptr, env, i32) +DEF_HELPER_4(gvec_wfk128, void, cptr, cptr, env, i32) DEF_HELPER_FLAGS_5(gvec_vfce32, TCG_CALL_NO_WG, void, ptr, cptr, cptr, env, i32) DEF_HELPER_5(gvec_vfce32_cc, void, ptr, cptr, cptr, env, i32)DEF_HELPER_FLAGS_5 (gvec_vfce64,TCG_CALL_NO_WG , void, ptr, cptr, cptr, env, i32)
target/s390x/translate_vx.c.inc +30 -8
@@ -2598,19 +2598,41 @@ static DisasJumpType op_wfc(DisasContext *s, DisasOps *o) { const uint8_t fpf = get_field(s, m3); const uint8_t m4 = get_field(s, m4); + gen_helper_gvec_2_ptr *fn = NULL; - if (fpf != FPF_LONG || m4) { + switch (fpf) { + case FPF_SHORT: + if (s390_has_feat(S390_FEAT_VECTOR_ENH)) { + fn = gen_helper_gvec_wfk32; + if (s->fields.op2 == 0xcb) { + fn = gen_helper_gvec_wfc32; + } + } + break; + case FPF_LONG: + fn = gen_helper_gvec_wfk64; + if (s->fields.op2 == 0xcb) { + fn = gen_helper_gvec_wfc64; + } + break; + case FPF_EXT: + if (s390_has_feat(S390_FEAT_VECTOR_ENH)) { + fn = gen_helper_gvec_wfk128; + if (s->fields.op2 == 0xcb) { + fn = gen_helper_gvec_wfc128; + } + } + break; + default: + break; + }; + + if (!fn || m4) { gen_program_exception(s, PGM_SPECIFICATION); return DISAS_NORETURN; } - if (s->fields.op2 == 0xcb) { - gen_gvec_2_ptr(get_field(s, v1), get_field(s, v2), - cpu_env, 0, gen_helper_gvec_wfc64); - } else { - gen_gvec_2_ptr(get_field(s, v1), get_field(s, v2), - cpu_env, 0, gen_helper_gvec_wfk64); - } + gen_gvec_2_ptr(get_field(s, v1), get_field(s, v2), cpu_env, 0, fn); set_cc_static(s); return DISAS_NEXT; }
target/s390x/vec_fpu_helper.c +43 -1
62 lines not on this page · raw message
Signature · 1 line
2.31.1
Re: [PATCH v2 16/26] s390x/tcg: Implement 32/128 bit for VECTOR FP COMPARE (AND SIGNAL) SCALAR
Quoted 6 lines · David Hildenbrand
Signed-off-by David Hildenbrand<[email protected]>--- target/s390x/helper.h | 4 +++ target/s390x/translate_vx.c.inc | 38 ++++++++++++++++++++++------ target/s390x/vec_fpu_helper.c | 44 ++++++++++++++++++++++++++++++++- 3 files changed, 77 insertions(+), 9 deletions(-)
r~
PATCH v2 17/26 s390x/tcg: Implement 64 bit for VECTOR FP LOAD LENGTHENED
In reply to David Hildenbrand64 bit -> 128 bit, there is only a single final element.
--- target/s390x/helper.h | 1 + target/s390x/translate_vx.c.inc | 19 ++++++++++++++++--- target/s390x/vec_fpu_helper.c | 13 +++++++++++++ 3 files changed, 30 insertions(+), 3 deletions(-)
target/s390x/helper.h +1 -0
@@ -285,6 +285,7 @@ DEF_HELPER_FLAGS_4(gvec_vfi32, TCG_CALL_NO_WG, void, ptr, cptr, env, i32) DEF_HELPER_FLAGS_4(gvec_vfi64, TCG_CALL_NO_WG, void, ptr, cptr, env, i32) DEF_HELPER_FLAGS_4(gvec_vfi128, TCG_CALL_NO_WG, void, ptr, cptr, env, i32) DEF_HELPER_FLAGS_4(gvec_vfll32, TCG_CALL_NO_WG, void, ptr, cptr, env, i32) +DEF_HELPER_FLAGS_4(gvec_vfll64, TCG_CALL_NO_WG, void, ptr, cptr, env, i32) DEF_HELPER_FLAGS_4(gvec_vflr64, TCG_CALL_NO_WG, void, ptr, cptr, env, i32) DEF_HELPER_FLAGS_5(gvec_vfm32, TCG_CALL_NO_WG, void, ptr, cptr, cptr, env, i32)DEF_HELPER_FLAGS_5 (gvec_vfm64,TCG_CALL_NO_WG , void, ptr, cptr, cptr, env, i32)
target/s390x/translate_vx.c.inc +16 -3
@@ -2781,14 +2781,27 @@ static DisasJumpType op_vfll(DisasContext *s, DisasOps *o) { const uint8_t fpf = get_field(s, m3); const uint8_t m4 = get_field(s, m4); + gen_helper_gvec_2_ptr *fn = NULL; - if (fpf != FPF_SHORT || extract32(m4, 0, 3)) { + switch (fpf) { + case FPF_SHORT: + fn = gen_helper_gvec_vfll32; + break; + case FPF_LONG: + if (s390_has_feat(S390_FEAT_VECTOR_ENH)) { + fn = gen_helper_gvec_vfll64; + } + break; + default: + break; + } + + if (!fn || extract32(m4, 0, 3)) { gen_program_exception(s, PGM_SPECIFICATION); return DISAS_NORETURN; } - gen_gvec_2_ptr(get_field(s, v1), get_field(s, v2), cpu_env, - m4, gen_helper_gvec_vfll32); + gen_gvec_2_ptr(get_field(s, v1), get_field(s, v2), cpu_env, m4, fn); return DISAS_NEXT; }
target/s390x/vec_fpu_helper.c +13 -0
@@ -524,6 +524,19 @@ void HELPER(gvec_vfll32)(void *v1, const void *v2, CPUS390XState *env, *(S390Vector *)v1 = tmp; } +void HELPER (gvec_vfll64 )(void *v1,const void *v2,CPUS390XState *env, +uint32_t desc) +{ +/* load from even element */ +const float128 ret =float64_to_float128 (s390_vec_read_float64 (v2,0 ), + &env->fpu_status); +uint8_t vxc, vec_exc =0 ; + + vxc =check_ieee_exc (env,0 , false, &vec_exc); +handle_ieee_exc (env, vxc, vec_exc,GETPC ()); +s390_vec_write_float128 (v1, ret); +} +void HELPER (gvec_vflr64 )(void *v1,const void *v2,CPUS390XState *env,uint32_t desc) {
Signature · 1 line
2.31.1
PATCH v2 18/26 s390x/tcg: Implement 128 bit for VECTOR FP LOAD ROUNDED
In reply to David Hildenbrand128 bit -> 64 bit, there is only a single element to process.
--- target/s390x/helper.h | 1 + target/s390x/translate_vx.c.inc | 11 ++++++++++- target/s390x/vec_fpu_helper.c | 19 +++++++++++++++++++ 3 files changed, 30 insertions(+), 1 deletion(-)
target/s390x/helper.h +1 -0
@@ -287,6 +287,7 @@ DEF_HELPER_FLAGS_4(gvec_vfi128, TCG_CALL_NO_WG, void, ptr, cptr, env, i32) DEF_HELPER_FLAGS_4(gvec_vfll32, TCG_CALL_NO_WG, void, ptr, cptr, env, i32) DEF_HELPER_FLAGS_4(gvec_vfll64, TCG_CALL_NO_WG, void, ptr, cptr, env, i32) DEF_HELPER_FLAGS_4(gvec_vflr64, TCG_CALL_NO_WG, void, ptr, cptr, env, i32) +DEF_HELPER_FLAGS_4(gvec_vflr128, TCG_CALL_NO_WG, void, ptr, cptr, env, i32) DEF_HELPER_FLAGS_5(gvec_vfm32, TCG_CALL_NO_WG, void, ptr, cptr, cptr, env, i32) DEF_HELPER_FLAGS_5(gvec_vfm64, TCG_CALL_NO_WG, void, ptr, cptr, cptr, env, i32)DEF_HELPER_FLAGS_5 (gvec_vfm128,TCG_CALL_NO_WG , void, ptr, cptr, cptr, env, i32)
target/s390x/translate_vx.c.inc +10 -1
@@ -2759,8 +2759,17 @@ static DisasJumpType op_vcdg(DisasContext *s, DisasOps *o) } break; case 0xc5: - if (fpf == FPF_LONG) { + switch (fpf) { + case FPF_LONG: fn = gen_helper_gvec_vflr64; + break; + case FPF_EXT: + if (s390_has_feat(S390_FEAT_VECTOR_ENH)) { + fn = gen_helper_gvec_vflr128; + } + break; + default: + break; } break; default:
target/s390x/vec_fpu_helper.c +19 -0
@@ -565,6 +565,25 @@ void HELPER(gvec_vflr64)(void *v1, const void *v2, CPUS390XState *env, *(S390Vector *)v1 = tmp; } +void HELPER (gvec_vflr128 )(void *v1,const void *v2,CPUS390XState *env, +uint32_t desc) +{ +const uint8_t erm =extract32 (simd_data (desc),4 ,4 ); +const bool XxC =extract32 (simd_data (desc),2 ,1 ); +uint8_t vxc, vec_exc =0 ; +int old_mode; +float64 ret; + + old_mode =s390_swap_bfp_rounding_mode (env, erm); + ret =float128_to_float64 (s390_vec_read_float128 (v2), &env->fpu_status); + vxc =check_ieee_exc (env,0 , XxC, &vec_exc); +s390_restore_bfp_rounding_mode (env, old_mode); +handle_ieee_exc (env, vxc, vec_exc,GETPC ()); + +/* place at even element, odd element is unpredictable */ +s390_vec_write_float64 (v1,0 , ret); +} +static void vfma64 (S390Vector *v1,const S390Vector *v2,const S390Vector *v3,const S390Vector *v4,CPUS390XState *env,bool s,int flags,uintptr_t retaddr)
Signature · 1 line
2.31.1
PATCH v2 19/26 s390x/tcg: Implement 32/128 bit for VECTOR FP PERFORM SIGN OPERATION
In reply to David Hildenbrand--- target/s390x/translate_vx.c.inc | 106 ++++++++++++++++++++++---------- 1 file changed, 73 insertions(+), 33 deletions(-)
target/s390x/translate_vx.c.inc +73 -33
@@ -2842,48 +2842,88 @@ static DisasJumpType op_vfpso(DisasContext *s, DisasOps *o) const uint8_t fpf = get_field(s, m3); const uint8_t m4 = get_field(s, m4); const uint8_t m5 = get_field(s, m5); + const bool se = extract32(m4, 3, 1); TCGv_i64 tmp; - if (fpf != FPF_LONG || extract32(m4, 0, 3) || m5 > 2) { + if ((fpf != FPF_LONG && !s390_has_feat(S390_FEAT_VECTOR_ENH)) || + extract32(m4, 0, 3) || m5 > 2) { gen_program_exception(s, PGM_SPECIFICATION); return DISAS_NORETURN; } - if (extract32(m4, 3, 1)) { - tmp = tcg_temp_new_i64(); - read_vec_element_i64(tmp, v2, 0, ES_64); - switch (m5) { - case 0: - /* sign bit is inverted (complement) */ - tcg_gen_xori_i64(tmp, tmp, 1ull << 63); - break; - case 1: - /* sign bit is set to one (negative) */ - tcg_gen_ori_i64(tmp, tmp, 1ull << 63); - break; - case 2: - /* sign bit is set to zero (positive) */ - tcg_gen_andi_i64(tmp, tmp, (1ull << 63) - 1); - break; + switch (fpf) { + case FPF_SHORT: + if (!se) { + switch (m5) { + case 0: + /* sign bit is inverted (complement) */ + gen_gvec_fn_2i(xori, ES_32, v1, v2, 1ull << 31); + break; + case 1: + /* sign bit is set to one (negative) */ + gen_gvec_fn_2i(ori, ES_32, v1, v2, 1ull << 31); + break; + case 2: + /* sign bit is set to zero (positive) */ + gen_gvec_fn_2i(andi, ES_32, v1, v2, (1ull << 31) - 1); + break; + } + return DISAS_NEXT; } - write_vec_element_i64(tmp, v1, 0, ES_64); - tcg_temp_free_i64(tmp); - } else { - switch (m5) { - case 0: - /* sign bit is inverted (complement) */ - gen_gvec_fn_2i(xori, ES_64, v1, v2, 1ull << 63); - break; - case 1: - /* sign bit is set to one (negative) */ - gen_gvec_fn_2i(ori, ES_64, v1, v2, 1ull << 63); - break; - case 2: - /* sign bit is set to zero (positive) */ - gen_gvec_fn_2i(andi, ES_64, v1, v2, (1ull << 63) - 1); - break; + break; + case FPF_LONG: + if (!se) { + switch (m5) { + case 0: + /* sign bit is inverted (complement) */ + gen_gvec_fn_2i(xori, ES_64, v1, v2, 1ull << 63); + break; + case 1: + /* sign bit is set to one (negative) */ + gen_gvec_fn_2i(ori, ES_64, v1, v2, 1ull << 63); + break; + case 2: + /* sign bit is set to zero (positive) */ + gen_gvec_fn_2i(andi, ES_64, v1, v2, (1ull << 63) - 1); + break; + } + return DISAS_NEXT; } + break; + case FPF_EXT: + /* Only a single element. */ + break; + default: + gen_program_exception(s, PGM_SPECIFICATION); + return DISAS_NORETURN; } + + /* With a single element, we are only interested in bit 0. */ + tmp = tcg_temp_new_i64(); + read_vec_element_i64(tmp, v2, 0, ES_64); + switch (m5) { + case 0: + /* sign bit is inverted (complement) */ + tcg_gen_xori_i64(tmp, tmp, 1ull << 63); + break; + case 1: + /* sign bit is set to one (negative) */ + tcg_gen_ori_i64(tmp, tmp, 1ull << 63); + break; + case 2: + /* sign bit is set to zero (positive) */ + tcg_gen_andi_i64(tmp, tmp, (1ull << 63) - 1); + break; + } + write_vec_element_i64(tmp, v1, 0, ES_64); + + if (fpf == FPF_EXT) { + read_vec_element_i64(tmp, v2, 1, ES_64); + write_vec_element_i64(tmp, v1, 1, ES_64); + } + + tcg_temp_free_i64(tmp); + return DISAS_NEXT; }
Signature · 1 line
2.31.1
PATCH v2 20/26 s390x/tcg: Implement 32/128 bit for VECTOR FP TEST DATA CLASS IMMEDIATE
In reply to David Hildenbrand--- target/s390x/helper.h | 2 ++ target/s390x/translate_vx.c.inc | 23 ++++++++++++++-- target/s390x/vec_fpu_helper.c | 47 +++++++++++++++++++++++++++++++++ 3 files changed, 70 insertions(+), 2 deletions(-)
target/s390x/helper.h +2 -0
@@ -299,7 +299,9 @@ DEF_HELPER_FLAGS_4(gvec_vfsq128, TCG_CALL_NO_WG, void, ptr, cptr, env, i32) DEF_HELPER_FLAGS_5(gvec_vfs32, TCG_CALL_NO_WG, void, ptr, cptr, cptr, env, i32) DEF_HELPER_FLAGS_5(gvec_vfs64, TCG_CALL_NO_WG, void, ptr, cptr, cptr, env, i32) DEF_HELPER_FLAGS_5(gvec_vfs128, TCG_CALL_NO_WG, void, ptr, cptr, cptr, env, i32) +DEF_HELPER_4(gvec_vftci32, void, ptr, cptr, env, i32) DEF_HELPER_4(gvec_vftci64, void, ptr, cptr, env, i32) +DEF_HELPER_4(gvec_vftci128, void, ptr, cptr, env, i32)#ifndef CONFIG_USER_ONLY DEF_HELPER_3 (servc, i32, env, i64, i64)
target/s390x/translate_vx.c.inc +21 -2
@@ -2965,14 +2965,33 @@ static DisasJumpType op_vftci(DisasContext *s, DisasOps *o) const uint16_t i3 = get_field(s, i3); const uint8_t fpf = get_field(s, m4); const uint8_t m5 = get_field(s, m5); + gen_helper_gvec_2_ptr *fn = NULL; - if (fpf != FPF_LONG || extract32(m5, 0, 3)) { + switch (fpf) { + case FPF_SHORT: + if (s390_has_feat(S390_FEAT_VECTOR_ENH)) { + fn = gen_helper_gvec_vftci32; + } + break; + case FPF_LONG: + fn = gen_helper_gvec_vftci64; + break; + case FPF_EXT: + if (s390_has_feat(S390_FEAT_VECTOR_ENH)) { + fn = gen_helper_gvec_vftci128; + } + break; + default: + break; + } + + if (!fn || extract32(m5, 0, 3)) { gen_program_exception(s, PGM_SPECIFICATION); return DISAS_NORETURN; } gen_gvec_2_ptr(get_field(s, v1), get_field(s, v2), cpu_env, - deposit32(m5, 4, 12, i3), gen_helper_gvec_vftci64); + deposit32(m5, 4, 12, i3), fn); set_cc_static(s); return DISAS_NEXT; }
target/s390x/vec_fpu_helper.c +47 -0
56 lines not on this page · raw message
Signature · 1 line
2.31.1
Re: [PATCH v2 20/26] s390x/tcg: Implement 32/128 bit for VECTOR FP TEST DATA CLASS IMMEDIATE
Quoted 6 lines · David Hildenbrand
Signed-off-by David Hildenbrand<[email protected]>--- target/s390x/helper.h | 2 ++ target/s390x/translate_vx.c.inc | 23 ++++++++++++++-- target/s390x/vec_fpu_helper.c | 47 +++++++++++++++++++++++++++++++++ 3 files changed, 70 insertions(+), 2 deletions(-)
r~
PATCH v2 21/26 s390x/tcg: Implement 32/128 bit for VECTOR FP MULTIPLY AND (ADD|SUBTRACT)
In reply to David Hildenbrand--- target/s390x/helper.h | 4 +++ target/s390x/translate_vx.c.inc | 47 ++++++++++++++++++++++++++++----- target/s390x/vec_fpu_helper.c | 44 +++++++++++++++++++++++++++++- 3 files changed, 87 insertions(+), 8 deletions(-)
target/s390x/helper.h +4 -0
@@ -291,8 +291,12 @@ DEF_HELPER_FLAGS_4(gvec_vflr128, TCG_CALL_NO_WG, void, ptr, cptr, env, i32) DEF_HELPER_FLAGS_5(gvec_vfm32, TCG_CALL_NO_WG, void, ptr, cptr, cptr, env, i32) DEF_HELPER_FLAGS_5(gvec_vfm64, TCG_CALL_NO_WG, void, ptr, cptr, cptr, env, i32) DEF_HELPER_FLAGS_5(gvec_vfm128, TCG_CALL_NO_WG, void, ptr, cptr, cptr, env, i32) +DEF_HELPER_FLAGS_6(gvec_vfma32, TCG_CALL_NO_WG, void, ptr, cptr, cptr, cptr, env, i32) DEF_HELPER_FLAGS_6(gvec_vfma64, TCG_CALL_NO_WG, void, ptr, cptr, cptr, cptr, env, i32) +DEF_HELPER_FLAGS_6(gvec_vfma128, TCG_CALL_NO_WG, void, ptr, cptr, cptr, cptr, env, i32) +DEF_HELPER_FLAGS_6(gvec_vfms32, TCG_CALL_NO_WG, void, ptr, cptr, cptr, cptr, env, i32) DEF_HELPER_FLAGS_6(gvec_vfms64, TCG_CALL_NO_WG, void, ptr, cptr, cptr, cptr, env, i32) +DEF_HELPER_FLAGS_6(gvec_vfms128, TCG_CALL_NO_WG, void, ptr, cptr, cptr, cptr, env, i32) DEF_HELPER_FLAGS_4(gvec_vfsq32, TCG_CALL_NO_WG, void, ptr, cptr, env, i32) DEF_HELPER_FLAGS_4(gvec_vfsq64, TCG_CALL_NO_WG, void, ptr, cptr, env, i32)DEF_HELPER_FLAGS_4 (gvec_vfsq128,TCG_CALL_NO_WG , void, ptr, cptr, env, i32)
target/s390x/translate_vx.c.inc +40 -7
58 lines not on this page · raw message
target/s390x/vec_fpu_helper.c +43 -1
62 lines not on this page · raw message
Signature · 1 line
2.31.1
Re: [PATCH v2 21/26] s390x/tcg: Implement 32/128 bit for VECTOR FP MULTIPLY AND (ADD|SUBTRACT)
Quoted 6 lines · David Hildenbrand
Signed-off-by David Hildenbrand<[email protected]>--- target/s390x/helper.h | 4 +++ target/s390x/translate_vx.c.inc | 47 ++++++++++++++++++++++++++++----- target/s390x/vec_fpu_helper.c | 44 +++++++++++++++++++++++++++++- 3 files changed, 87 insertions(+), 8 deletions(-)
r~
PATCH v2 22/26 s390x/tcg: Implement VECTOR FP NEGATIVE MULTIPLY AND (ADD|SUBTRACT)
In reply to David Hildenbrand--- target/s390x/helper.h | 6 +++++ target/s390x/insn-data.def | 4 ++++ target/s390x/translate_vx.c.inc | 39 +++++++++++++++++++++++++++++++-- target/s390x/vec_fpu_helper.c | 2 ++ 4 files changed, 49 insertions(+), 2 deletions(-)
target/s390x/helper.h +6 -0
@@ -297,6 +297,12 @@ DEF_HELPER_FLAGS_6(gvec_vfma128, TCG_CALL_NO_WG, void, ptr, cptr, cptr, cptr, en DEF_HELPER_FLAGS_6(gvec_vfms32, TCG_CALL_NO_WG, void, ptr, cptr, cptr, cptr, env, i32) DEF_HELPER_FLAGS_6(gvec_vfms64, TCG_CALL_NO_WG, void, ptr, cptr, cptr, cptr, env, i32) DEF_HELPER_FLAGS_6(gvec_vfms128, TCG_CALL_NO_WG, void, ptr, cptr, cptr, cptr, env, i32) +DEF_HELPER_FLAGS_6(gvec_vfnma32, TCG_CALL_NO_WG, void, ptr, cptr, cptr, cptr, env, i32) +DEF_HELPER_FLAGS_6(gvec_vfnma64, TCG_CALL_NO_WG, void, ptr, cptr, cptr, cptr, env, i32) +DEF_HELPER_FLAGS_6(gvec_vfnma128, TCG_CALL_NO_WG, void, ptr, cptr, cptr, cptr, env, i32) +DEF_HELPER_FLAGS_6(gvec_vfnms32, TCG_CALL_NO_WG, void, ptr, cptr, cptr, cptr, env, i32) +DEF_HELPER_FLAGS_6(gvec_vfnms64, TCG_CALL_NO_WG, void, ptr, cptr, cptr, cptr, env, i32) +DEF_HELPER_FLAGS_6(gvec_vfnms128, TCG_CALL_NO_WG, void, ptr, cptr, cptr, cptr, env, i32) DEF_HELPER_FLAGS_4(gvec_vfsq32, TCG_CALL_NO_WG, void, ptr, cptr, env, i32) DEF_HELPER_FLAGS_4(gvec_vfsq64, TCG_CALL_NO_WG, void, ptr, cptr, env, i32)DEF_HELPER_FLAGS_4 (gvec_vfsq128,TCG_CALL_NO_WG , void, ptr, cptr, env, i32)
target/s390x/insn-data.def +4 -0
@@ -1259,6 +1259,10 @@ F(0xe78f, VFMA, VRR_e, V, 0, 0, 0, 0, vfma, 0, IF_VEC) /* VECTOR FP MULTIPLY AND SUBTRACT */ F(0xe78e, VFMS, VRR_e, V, 0, 0, 0, 0, vfma, 0, IF_VEC) +/* VECTOR FP NEGATIVE MULTIPLY AND ADD */ + F(0xe79f, VFNMA, VRR_e, VE, 0, 0, 0, 0, vfma, 0, IF_VEC) +/* VECTOR FP NEGATIVE MULTIPLY AND SUBTRACT */ + F(0xe79e, VFNMS, VRR_e, VE, 0, 0, 0, 0, vfma, 0, IF_VEC) /* VECTOR FP PERFORM SIGN OPERATION */ F(0xe7cc, VFPSO, VRR_a, V, 0, 0, 0, 0, vfpso, 0, IF_VEC) /* VECTOR FP SQUARE ROOT */
target/s390x/translate_vx.c.inc +37 -2
@@ -2820,7 +2820,8 @@ static DisasJumpType op_vfma(DisasContext *s, DisasOps *o) const uint8_t fpf = get_field(s, m6); gen_helper_gvec_4_ptr *fn = NULL; - if (s->fields.op2 == 0x8f) { + switch (s->fields.op2) { + case 0x8f: switch (fpf) { case FPF_SHORT: if (s390_has_feat(S390_FEAT_VECTOR_ENH)) {
@@ -2838,7 +2839,8 @@ static DisasJumpType op_vfma(DisasContext *s, DisasOps *o) default: break; } - } else { + break; + case 0x8e: switch (fpf) { case FPF_SHORT: if (s390_has_feat(S390_FEAT_VECTOR_ENH)) {
@@ -2856,6 +2858,39 @@ static DisasJumpType op_vfma(DisasContext *s, DisasOps *o) default: break; } + break; + case 0x9f: + switch (fpf) { + case FPF_SHORT: + fn = gen_helper_gvec_vfnma32; + break; + case FPF_LONG: + fn = gen_helper_gvec_vfnma64; + break; + case FPF_EXT: + fn = gen_helper_gvec_vfnma128; + break; + default: + break; + } + break; + case 0x9e: + switch (fpf) { + case FPF_SHORT: + fn = gen_helper_gvec_vfnms32; + break; + case FPF_LONG: + fn = gen_helper_gvec_vfnms64; + break; + case FPF_EXT: + fn = gen_helper_gvec_vfnms128; + break; + default: + break; + } + break; + default: + g_assert_not_reached(); } if (!fn || extract32(m5, 0, 3)) {
target/s390x/vec_fpu_helper.c +2 -0
@@ -665,6 +665,8 @@ void HELPER(gvec_##NAME##BITS)(void *v1, const void *v2, const void *v3, \ DEF_GVEC_VFMA(vfma, 0) DEF_GVEC_VFMA(vfms, float_muladd_negate_c) +DEF_GVEC_VFMA(vfnma, float_muladd_negate_result) +DEF_GVEC_VFMA(vfnms, float_muladd_negate_c | float_muladd_negate_result)void HELPER (gvec_vftci32 )(void *v1,const void *v2,CPUS390XState *env,uint32_t desc)
Signature · 1 line
2.31.1
Re: [PATCH v2 22/26] s390x/tcg: Implement VECTOR FP NEGATIVE MULTIPLY AND (ADD|SUBTRACT)
Quoted 7 lines · David Hildenbrand
Signed-off-by David Hildenbrand<[email protected]>--- target/s390x/helper.h | 6 +++++ target/s390x/insn-data.def | 4 ++++ target/s390x/translate_vx.c.inc | 39 +++++++++++++++++++++++++++++++-- target/s390x/vec_fpu_helper.c | 2 ++ 4 files changed, 49 insertions(+), 2 deletions(-)
r~
PATCH v2 23/26 softfloat: Implement float128_(min|minnum|minnummag|max|maxnum|maxnummag)
In reply to David HildenbrandWith Richard's softfloat rework, the float128 implementation is straight-forward. Unfortuantely, we don't have any tests we can simply adjust/unlock.
--- fpu/softfloat.c | 17 +++++++++++++++++ include/fpu/softfloat.h | 6 ++++++ 2 files changed, 23 insertions(+)
fpu/softfloat.c +17 -0
@@ -3893,6 +3893,22 @@ static float64 float64_minmax(float64 a, float64 b, float_status *s, int flags)return which ? b : a; } +static float128 float128_minmax (float128 a,float128 b,float_status *s, +int flags) +{ +FloatParts128 pa, pb; +int which; + +float128_unpack_canonical (&pa, a, s); +float128_unpack_canonical (&pb, b, s); + which =parts_minmax (&pa, &pb, s, flags, &float64_params); +if (unlikely (which <0 )) { +/* Some sort of nan, need to repack default and silenced nans. */ +return float128_round_pack_canonical (&pa, s); + } +return which ? b : a; +} +#define MINMAX_1 (type, name, flags) \ type type##_##name(type a, type b, float_status *s) \ { return type##_minmax(a, b, s, flags); }
@@ -3909,6 +3925,7 @@ MINMAX_2(float16) MINMAX_2(bfloat16) MINMAX_2(float32) MINMAX_2(float64) +MINMAX_2(float128)#undef MINMAX_1#undef MINMAX_2
include/fpu/softfloat.h +6 -0
@@ -1204,6 +1204,12 @@ float128 float128_rem(float128, float128, float_status *status);float128 float128_sqrt (float128 ,float_status *status);FloatRelation float128_compare (float128 ,float128 ,float_status *status);FloatRelation float128_compare_quiet (float128 ,float128 ,float_status *status); +float128 float128_min (float128 ,float128 ,float_status *status); +float128 float128_max (float128 ,float128 ,float_status *status); +float128 float128_minnum (float128 ,float128 ,float_status *status); +float128 float128_maxnum (float128 ,float128 ,float_status *status); +float128 float128_minnummag (float128 ,float128 ,float_status *status); +float128 float128_maxnummag (float128 ,float128 ,float_status *status);bool float128_is_quiet_nan (float128 ,float_status *status);bool float128_is_signaling_nan (float128 ,float_status *status);float128 float128_silence_nan (float128 ,float_status *status);
Signature · 1 line
2.31.1
Re: [PATCH v2 23/26] softfloat: Implement float128_(min|minnum|minnummag|max|maxnum|maxnummag)
Quoted 9 lines · David Hildenbrand
With Richard's softfloat rework, the float128 implementation is straight-forward. Unfortuantely, we don't have any tests we can simply adjust/unlock.
Cc Aurelien Jarno <[email protected]>Cc Peter Maydell <[email protected]>Cc "Alex Bennée" <[email protected]>Cc Richard Henderson <[email protected]>Signed-off-by David Hildenbrand <[email protected]>
Queueing this into my softfloat rework. Thanks,
r~
Quoted 58 lines
--- fpu/softfloat.c | 17 +++++++++++++++++ include/fpu/softfloat.h | 6 ++++++ 2 files changed, 23 insertions(+)fpu/softfloat.c +17
-0@@ -3893,6 +3893,22 @@ static float64 float64_minmax(float64 a, float64 b, float_status *s, int flags)return which ? b : a; } +static float128 float128_minmax (float128 a,float128 b,float_status *s, +int flags) +{ +FloatParts128 pa, pb; +int which; + +float128_unpack_canonical (&pa, a, s); +float128_unpack_canonical (&pb, b, s); + which =parts_minmax (&pa, &pb, s, flags, &float64_params); +if (unlikely (which <0 )) { +/* Some sort of nan, need to repack default and silenced nans. */ +return float128_round_pack_canonical (&pa, s); + } +return which ? b : a; +} +#define MINMAX_1 (type, name, flags) \ type type##_##name(type a, type b, float_status *s) \ { return type##_minmax(a, b, s, flags); }@@ -3909,6 +3925,7 @@ MINMAX_2(float16) MINMAX_2(bfloat16) MINMAX_2(float32) MINMAX_2(float64) +MINMAX_2(float128)#undef MINMAX_1#undef MINMAX_2include/fpu/softfloat.h +6
-0@@ -1204,6 +1204,12 @@ float128 float128_rem(float128, float128, float_status *status);float128 float128_sqrt (float128 ,float_status *status);FloatRelation float128_compare (float128 ,float128 ,float_status *status);FloatRelation float128_compare_quiet (float128 ,float128 ,float_status *status); +float128 float128_min (float128 ,float128 ,float_status *status); +float128 float128_max (float128 ,float128 ,float_status *status); +float128 float128_minnum (float128 ,float128 ,float_status *status); +float128 float128_maxnum (float128 ,float128 ,float_status *status); +float128 float128_minnummag (float128 ,float128 ,float_status *status); +float128 float128_maxnummag (float128 ,float128 ,float_status *status);bool float128_is_quiet_nan (float128 ,float_status *status);bool float128_is_signaling_nan (float128 ,float_status *status);float128 float128_silence_nan (float128 ,float_status *status);
PATCH v2 24/26 s390x/tcg: Implement VECTOR FP (MAXIMUM|MINIMUM)
In reply to David HildenbrandFor IEEE functions, we can reuse the softfloat implementations. For the other functions, implement it generically for 32bit/64bit/128bit - carefully taking care of all weird special cases according to the tables defined in the PoP.
--- target/s390x/helper.h | 6 + target/s390x/insn-data.def | 4 + target/s390x/internal.h | 9 + target/s390x/translate_vx.c.inc | 44 ++++ target/s390x/vec_fpu_helper.c | 361 ++++++++++++++++++++++++++++++++ 5 files changed, 424 insertions(+)
target/s390x/helper.h +6 -0
@@ -291,6 +291,12 @@ DEF_HELPER_FLAGS_4(gvec_vflr128, TCG_CALL_NO_WG, void, ptr, cptr, env, i32) DEF_HELPER_FLAGS_5(gvec_vfm32, TCG_CALL_NO_WG, void, ptr, cptr, cptr, env, i32) DEF_HELPER_FLAGS_5(gvec_vfm64, TCG_CALL_NO_WG, void, ptr, cptr, cptr, env, i32) DEF_HELPER_FLAGS_5(gvec_vfm128, TCG_CALL_NO_WG, void, ptr, cptr, cptr, env, i32) +DEF_HELPER_FLAGS_5(gvec_vfmax32, TCG_CALL_NO_WG, void, ptr, cptr, cptr, env, i32) +DEF_HELPER_FLAGS_5(gvec_vfmax64, TCG_CALL_NO_WG, void, ptr, cptr, cptr, env, i32) +DEF_HELPER_FLAGS_5(gvec_vfmax128, TCG_CALL_NO_WG, void, ptr, cptr, cptr, env, i32) +DEF_HELPER_FLAGS_5(gvec_vfmin32, TCG_CALL_NO_WG, void, ptr, cptr, cptr, env, i32) +DEF_HELPER_FLAGS_5(gvec_vfmin64, TCG_CALL_NO_WG, void, ptr, cptr, cptr, env, i32) +DEF_HELPER_FLAGS_5(gvec_vfmin128, TCG_CALL_NO_WG, void, ptr, cptr, cptr, env, i32) DEF_HELPER_FLAGS_6(gvec_vfma32, TCG_CALL_NO_WG, void, ptr, cptr, cptr, cptr, env, i32) DEF_HELPER_FLAGS_6(gvec_vfma64, TCG_CALL_NO_WG, void, ptr, cptr, cptr, cptr, env, i32)DEF_HELPER_FLAGS_6 (gvec_vfma128,TCG_CALL_NO_WG , void, ptr, cptr, cptr, cptr, env, i32)
target/s390x/insn-data.def +4 -0
@@ -1253,6 +1253,10 @@ F(0xe7c4, VFLL, VRR_a, V, 0, 0, 0, 0, vfll, 0, IF_VEC) /* VECTOR FP LOAD ROUNDED */ F(0xe7c5, VFLR, VRR_a, V, 0, 0, 0, 0, vcdg, 0, IF_VEC) +/* VECTOR FP MAXIMUM */ + F(0xe7ef, VFMAX, VRR_c, VE, 0, 0, 0, 0, vfmax, 0, IF_VEC) +/* VECTOR FP MINIMUM */ + F(0xe7ee, VFMIN, VRR_c, VE, 0, 0, 0, 0, vfmax, 0, IF_VEC) /* VECTOR FP MULTIPLY */ F(0xe7e7, VFM, VRR_c, V, 0, 0, 0, 0, vfa, 0, IF_VEC) /* VECTOR FP MULTIPLY AND ADD */
target/s390x/internal.h +9 -0
@@ -288,6 +288,15 @@ uint8_t s390_softfloat_exc_to_ieee(unsigned int exc);int s390_swap_bfp_rounding_mode (CPUS390XState *env,int m3);void s390_restore_bfp_rounding_mode (CPUS390XState *env,int old_mode);int float_comp_to_cc (CPUS390XState *env,int float_compare); + +#define DCMASK_ZERO 0x0c00 +#define DCMASK_NORMAL 0x0300 +#define DCMASK_SUBNORMAL 0x00c0 +#define DCMASK_INFINITY 0x0030 +#define DCMASK_QUIET_NAN 0x000c +#define DCMASK_SIGNALING_NAN 0x0003 +#define DCMASK_NAN 0x000f +#define DCMASK_NEGATIVE 0x0555uint16_t float32_dcmask (CPUS390XState *env,float32 f1);uint16_t float64_dcmask (CPUS390XState *env,float64 f1);uint16_t float128_dcmask (CPUS390XState *env,float128 f1);
target/s390x/translate_vx.c.inc +44 -0
50 lines not on this page · raw message
target/s390x/vec_fpu_helper.c +361 -0
364 lines not on this page · raw message
Signature · 1 line
2.31.1
Re: [PATCH v2 24/26] s390x/tcg: Implement VECTOR FP (MAXIMUM|MINIMUM)
Quoted 1 line · David Hildenbrand
+ if (
unlikely(nan_a || nan_b)) {
Perhaps better as (dcmask_a | dcmask_b) & DCMASK_NAN ?
Quoted 1 line
+ if (
sig_a||sig_b) {
Similarly.
target/s390x/vec_fpu_helper.c void HELPER(gvec_vftci128)(void *v1, const void *v2, CPUS390XState *env, · line 815
Quoted 12 lines
target/s390x/vec_fpu_helper.c +12
-0+ }else if (unlikely (inf_a && inf_b)) { +switch (type) { +case S390_MINMAX_TYPE_JAVA : +return neg_a && !neg_b ?S390_MINMAX_RES_A :S390_MINMAX_RES_B ; +case S390_MINMAX_TYPE_C_MACRO : +case S390_MINMAX_TYPE_CPP : +return neg_b ?S390_MINMAX_RES_B :S390_MINMAX_RES_A ; +case S390_MINMAX_TYPE_F : +return !neg_a && neg_b ?S390_MINMAX_RES_B :S390_MINMAX_RES_A ; +default : +g_assert_not_reached (); + }
I don't understand why inf_a && inf_b gets a special case. Inf is well-ordered. If the arguments are equal you can't tell the difference between them, so it doesn't matter whether A or B is returned.
I would pass this case along to S390_MINMAX_RES_MINMAX.
target/s390x/vec_fpu_helper.c void HELPER(gvec_vftci128)(void *v1, const void *v2, CPUS390XState *env, · line 819
Quoted 4 lines
target/s390x/vec_fpu_helper.c +4
-0+ }else if (unlikely (zero_a && zero_b)) { +switch (type) { +case S390_MINMAX_TYPE_JAVA : +return neg_a && !neg_b ?S390_MINMAX_RES_A :S390_MINMAX_RES_B ;
If neg_a && neg_b, both A and B are -0, and you can't distinguish them. So this would seem to simplify to
neg_a ? S390_MINMAX_RES_A : S390_MINMAX_RES_B
target/s390x/vec_fpu_helper.c void HELPER(gvec_vftci128)(void *v1, const void *v2, CPUS390XState *env, · line 812
Quoted 4 lines
target/s390x/vec_fpu_helper.c +4
-0+case S390_MINMAX_TYPE_C_MACRO : +return S390_MINMAX_RES_B ; +case S390_MINMAX_TYPE_F : +return !neg_a && neg_b ?S390_MINMAX_RES_B :S390_MINMAX_RES_A ;
Similarly if !neg_a && !neg_b, both A and B are +0.
Otherwise this looks good.
r~
Re: [PATCH v2 24/26] s390x/tcg: Implement VECTOR FP (MAXIMUM|MINIMUM)
Quoted 9 lines · Richard Henderson
Quoted 1 line · David Hildenbrand
+ if (
unlikely(nan_a || nan_b)) {Perhaps better as (
dcmask_a|dcmask_b) &DCMASK_NAN?Quoted 1 line
+ if (
sig_a||sig_b) {Similarly.
Will do, thanks.
Quoted 13 lines
target/s390x/vec_fpu_helper.c void HELPER(gvec_vftci128)(void *v1, const void *v2, CPUS390XState *env, · line 815
Quoted 12 lines
target/s390x/vec_fpu_helper.c +12
-0+ }else if (unlikely (inf_a && inf_b)) { +switch (type) { +case S390_MINMAX_TYPE_JAVA : +return neg_a && !neg_b ?S390_MINMAX_RES_A :S390_MINMAX_RES_B ; +case S390_MINMAX_TYPE_C_MACRO : +case S390_MINMAX_TYPE_CPP : +return neg_b ?S390_MINMAX_RES_B :S390_MINMAX_RES_A ; +case S390_MINMAX_TYPE_F : +return !neg_a && neg_b ?S390_MINMAX_RES_B :S390_MINMAX_RES_A ; +default : +g_assert_not_reached (); + }
Quoted 5 lines
I don't understand why
inf_a&&inf_bgets a special case. Inf is well-ordered. If the arguments are equal you can't tell the difference between them, so it doesn't matter whether A or B is returned.I would pass this case along to
S390_MINMAX_RES_MINMAX.
Thinking about it, that makes sense. I have no clue why the PoP has these special cases expressed in the tables, at least it managed to confuse me.
Quoted 8 lines
target/s390x/vec_fpu_helper.c void HELPER(gvec_vftci128)(void *v1, const void *v2, CPUS390XState *env, · line 819
Quoted 5 lines
target/s390x/vec_fpu_helper.c +4
-0+ }else if (unlikely (zero_a && zero_b)) { +switch (type) { +case S390_MINMAX_TYPE_JAVA : +return neg_a && !neg_b ?S390_MINMAX_RES_A :S390_MINMAX_RES_B ;If
neg_a&&neg_b, both A and B are -0, and you can't distinguish them. So this would seem to simplify to
Another case of "let's make the tables inconsistent to confuse David".
Quoted 11 lines
neg_a ? S390_MINMAX_RES_A : S390_MINMAX_RES_Btarget/s390x/vec_fpu_helper.c void HELPER(gvec_vftci128)(void *v1, const void *v2, CPUS390XState *env, · line 812
Quoted 4 lines
target/s390x/vec_fpu_helper.c +4
-0+case S390_MINMAX_TYPE_C_MACRO : +return S390_MINMAX_RES_B ; +case S390_MINMAX_TYPE_F : +return !neg_a && neg_b ?S390_MINMAX_RES_B :S390_MINMAX_RES_A ;Similarly if !neg_a && !neg_b, both A and B are +0.
Otherwise this looks good.
Agreed, thanks!
Signature · 3 lines
Thanks, David / dhildenb
PATCH v2 25/26 s390x/tcg: We support Vector enhancements facility
In reply to David Hildenbrand--- target/s390x/gen-features.c | 1 + 1 file changed, 1 insertion(+)
target/s390x/gen-features.c +1 -0
@@ -720,6 +720,7 @@ static uint16_t qemu_MAX[] = {S390_FEAT_INSTRUCTION_EXEC_PROT ,S390_FEAT_MISC_INSTRUCTION_EXT2 ,S390_FEAT_MSA_EXT_8 , + S390_FEAT_VECTOR_ENH, };/****** END FEATURE DEFS ******/
Signature · 1 line
2.31.1
Re: [PATCH v2 25/26] s390x/tcg: We support Vector enhancements facility
Quoted 12 lines · David Hildenbrand
Reviewed-by Richard Henderson <[email protected]>Signed-off-by David Hildenbrand <[email protected]>--- target/s390x/gen-features.c | 1 + 1 file changed, 1 insertion(+)target/s390x/gen-features.c +0
-0
target/s390x/gen-features.c static uint16_t qemu_MAX[] = { · line 726
Quoted 7 lines
target/s390x/gen-features.c +1
-0@@ -720,6 +720,7 @@ static uint16_t qemu_MAX[] = {S390_FEAT_INSTRUCTION_EXEC_PROT ,S390_FEAT_MISC_INSTRUCTION_EXT2 ,S390_FEAT_MSA_EXT_8 , + S390_FEAT_VECTOR_ENH, };/****** END FEATURE DEFS ******/
I'll squash the following changes:
include/elf.h +1 -0
@@ -605,6 +605,7 @@ typedef struct {#define HWCAP_S390_HIGH_GPRS 512#define HWCAP_S390_TE 1024#define HWCAP_S390_VXRS 2048 +#define HWCAP_S390_VXRS_EXT 8192/* M68K specific definitions. */ /* We use the top 24 bits to encode information about the
linux-user/elfload.c +1 -0
@@ -1374,6 +1374,7 @@ static uint32_t get_elf_hwcap(void) hwcap |=HWCAP_S390_ETF3EH ; }GET_FEATURE (S390_FEAT_VECTOR ,HWCAP_S390_VXRS ); +GET_FEATURE (S390_FEAT_VECTOR_ENH ,HWCAP_S390_VXRS_EXT );return hwcap; }
Signature · 3 lines
Thanks, David / dhildenb
PATCH v2 26/26 s390x/cpumodel: Bump up QEMU model to a stripped-down IBM z14 GA2
In reply to David HildenbrandTCG implements everything we need to run basic z14 OS+software.
--- hw/s390x/s390-virtio-ccw.c | 3 +++ target/s390x/cpu_models.c | 4 ++-- target/s390x/gen-features.c | 15 +++++++++------ 3 files changed, 14 insertions(+), 8 deletions(-)
hw/s390x/s390-virtio-ccw.c +3 -0
@@ -802,7 +802,10 @@ DEFINE_CCW_MACHINE(6_1, "6.1", true);static void ccw_machine_6_0_instance_options (MachineState *machine) { +static const S390FeatInit qemu_cpu_feat = {S390_FEAT_LIST_QEMU_V6_0 }; +ccw_machine_6_1_instance_options (machine); +s390_set_qemu_cpu_model (0x2964 ,13 ,2 , qemu_cpu_feat); }static void ccw_machine_6_0_class_options (MachineClass *mc)
target/s390x/cpu_models.c +2 -2
@@ -90,8 +90,8 @@ static S390CPUDef s390_cpu_defs[] = { CPUDEF_INIT(0x8562, 15, 1, 47, 0x08000000U, "gen15b", "IBM z15 T02 GA1"), }; -#define QEMU_MAX_CPU_TYPE 0x2964 -#define QEMU_MAX_CPU_GEN 13 +#define QEMU_MAX_CPU_TYPE 0x3906 +#define QEMU_MAX_CPU_GEN 14#define QEMU_MAX_CPU_EC_GA 2static const S390FeatInit qemu_max_cpu_feat_init = {S390_FEAT_LIST_QEMU_MAX };static S390FeatBitmap qemu_max_cpu_feat;
target/s390x/gen-features.c +9 -6
@@ -706,23 +706,25 @@ static uint16_t qemu_V4_1[] = { S390_FEAT_VECTOR, }; -static uint16_t qemu_LATEST[] = { +static uint16_t qemu_V6_0[] = {S390_FEAT_ACCESS_EXCEPTION_FS_INDICATION ,S390_FEAT_SIDE_EFFECT_ACCESS_ESOP2 ,S390_FEAT_ESOP , }; -/* add all new definitions before this point */ -static uint16_t qemu_MAX[] = { -/* generates a dependency warning, leave it out for now */ -S390_FEAT_MSA_EXT_5 , -/* features introduced after the z13 */ +static uint16_t qemu_LATEST[] = {S390_FEAT_INSTRUCTION_EXEC_PROT ,S390_FEAT_MISC_INSTRUCTION_EXT2 ,S390_FEAT_MSA_EXT_8 ,S390_FEAT_VECTOR_ENH , }; +/* add all new definitions before this point */ +static uint16_t qemu_MAX[] = { +/* generates a dependency warning, leave it out for now */ +S390_FEAT_MSA_EXT_5 , +}; +/****** END FEATURE DEFS ******/ #define _YEARS "2016"
@@ -839,6 +841,7 @@ static FeatGroupDefSpec QemuFeatDef[] = {QEMU_FEAT_INITIALIZER (V3_1 ),QEMU_FEAT_INITIALIZER (V4_0 ),QEMU_FEAT_INITIALIZER (V4_1 ), +QEMU_FEAT_INITIALIZER (V6_0 ),QEMU_FEAT_INITIALIZER (LATEST ), QEMU_FEAT_INITIALIZER(MAX), };
Signature · 1 line
2.31.1