aboutsummaryrefslogtreecommitdiff
path: root/target/s390x/cc_helper.c
diff options
context:
space:
mode:
authorDavid Hildenbrand <david@redhat.com>2019-04-11 10:00:25 +0200
committerDavid Hildenbrand <david@redhat.com>2019-05-17 10:54:13 +0200
commitff825c6d6408cc1deae408821b6fd9d1127cc70b (patch)
treed0894a608095b256ba5afffd167a31e88c794d0a /target/s390x/cc_helper.c
parent751a564f79b6a1f1fd7a7866af3a0af6468d9c4f (diff)
downloadqemu-ff825c6d6408cc1deae408821b6fd9d1127cc70b.zip
qemu-ff825c6d6408cc1deae408821b6fd9d1127cc70b.tar.gz
qemu-ff825c6d6408cc1deae408821b6fd9d1127cc70b.tar.bz2
s390x/tcg: Implement VECTOR COMPARE *
To carry out the comparison, we can reuse the existing gvec comparison function. In case the CC is to be computed, save the result vector and compute the CC lazily. The result is a vector consisting of all 1's for elements that matched and 0's for elements that didn't match. Reviewed-by: Richard Henderson <richard.henderson@linaro.org> Signed-off-by: David Hildenbrand <david@redhat.com>
Diffstat (limited to 'target/s390x/cc_helper.c')
-rw-r--r--target/s390x/cc_helper.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/target/s390x/cc_helper.c b/target/s390x/cc_helper.c
index 0e467bf..a00294f 100644
--- a/target/s390x/cc_helper.c
+++ b/target/s390x/cc_helper.c
@@ -402,6 +402,20 @@ static uint32_t cc_calc_lcbb(uint64_t dst)
return dst == 16 ? 0 : 3;
}
+static uint32_t cc_calc_vc(uint64_t low, uint64_t high)
+{
+ if (high == -1ull && low == -1ull) {
+ /* all elements match */
+ return 0;
+ } else if (high == 0 && low == 0) {
+ /* no elements match */
+ return 3;
+ } else {
+ /* some elements but not all match */
+ return 1;
+ }
+}
+
static uint32_t do_calc_cc(CPUS390XState *env, uint32_t cc_op,
uint64_t src, uint64_t dst, uint64_t vr)
{
@@ -514,6 +528,9 @@ static uint32_t do_calc_cc(CPUS390XState *env, uint32_t cc_op,
case CC_OP_LCBB:
r = cc_calc_lcbb(dst);
break;
+ case CC_OP_VC:
+ r = cc_calc_vc(src, dst);
+ break;
case CC_OP_NZ_F32:
r = set_cc_nz_f32(dst);