From patchwork Mon Oct 21 08:57:10 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Hildenbrand X-Patchwork-Id: 1180395 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.b="FYBeHPw9"; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 46xVxy1Fz2z9sP6 for ; Mon, 21 Oct 2019 20:01:58 +1100 (AEDT) Received: from localhost ([::1]:36094 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iMTZb-0005GY-JS for incoming@patchwork.ozlabs.org; Mon, 21 Oct 2019 05:01:55 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:59244) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iMTVK-0001Ae-5g for qemu-devel@nongnu.org; Mon, 21 Oct 2019 04:57:32 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iMTVH-0008De-5e for qemu-devel@nongnu.org; Mon, 21 Oct 2019 04:57:29 -0400 Received: from us-smtp-delivery-1.mimecast.com ([205.139.110.120]:55378 helo=us-smtp-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1iMTVH-0008D4-1b for qemu-devel@nongnu.org; Mon, 21 Oct 2019 04:57:27 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1571648246; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=L6wFx65ZMu/HCNWJsK+5QSfFpB7ABzBFCVZWDSbh/bo=; b=FYBeHPw94vLYVWehyx7Mheq0VrqFynRPMkLxeowXquwflIen56zQspkSNsrMktrqb8R+YQ kTuuBvPcUQeIBt9LLk3S0dW8WUfz+qXE3w6KD7kTwOYqlk3tjss+70Rwynqo1lrKF/SpEY KGB9/lqaJ6OA7j9QBQWnJhhQ7s2eyu4= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-46-AseNvGrXOHezlbmYDtPvYw-1; Mon, 21 Oct 2019 04:57:23 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id F2B4F1800DD0; Mon, 21 Oct 2019 08:57:21 +0000 (UTC) Received: from t460s.redhat.com (ovpn-116-198.ams2.redhat.com [10.36.116.198]) by smtp.corp.redhat.com (Postfix) with ESMTP id 759875D6B0; Mon, 21 Oct 2019 08:57:20 +0000 (UTC) From: David Hildenbrand To: qemu-devel@nongnu.org Subject: [PATCH v2 1/6] s390x/tcg: Fix VECTOR MULTIPLY LOGICAL ODD Date: Mon, 21 Oct 2019 10:57:10 +0200 Message-Id: <20191021085715.3797-2-david@redhat.com> In-Reply-To: <20191021085715.3797-1-david@redhat.com> References: <20191021085715.3797-1-david@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-MC-Unique: AseNvGrXOHezlbmYDtPvYw-1 X-Mimecast-Spam-Score: 0 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 205.139.110.120 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Thomas Huth , David Hildenbrand , Ivan Warren , Cornelia Huck , Richard Henderson , qemu-s390x@nongnu.org Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" We have to read from odd offsets. Fixes: 2bf3ee38f1f8 ("s390x/tcg: Implement VECTOR MULTIPLY *") Reviewed-by: Richard Henderson Signed-off-by: David Hildenbrand --- target/s390x/vec_int_helper.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/target/s390x/vec_int_helper.c b/target/s390x/vec_int_helper.c index 68eaae407b..03ae8631d9 100644 --- a/target/s390x/vec_int_helper.c +++ b/target/s390x/vec_int_helper.c @@ -488,7 +488,7 @@ void HELPER(gvec_vmlo##BITS)(void *v1, const void *v2, const void *v3, \ { \ int i, j; \ \ - for (i = 0, j = 0; i < (128 / TBITS); i++, j += 2) { \ + for (i = 0, j = 1; i < (128 / TBITS); i++, j += 2) { \ const uint##TBITS##_t a = s390_vec_read_element##BITS(v2, j); \ const uint##TBITS##_t b = s390_vec_read_element##BITS(v3, j); \ \ From patchwork Mon Oct 21 08:57:11 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Hildenbrand X-Patchwork-Id: 1180396 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.b="TM0eYAws"; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 46xVy9083Wz9sPT for ; Mon, 21 Oct 2019 20:02:09 +1100 (AEDT) Received: from localhost ([::1]:36098 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iMTZl-0005NK-V3 for incoming@patchwork.ozlabs.org; Mon, 21 Oct 2019 05:02:05 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:59290) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iMTVO-0001Fv-5U for qemu-devel@nongnu.org; Mon, 21 Oct 2019 04:57:35 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iMTVJ-0008F2-Gd for qemu-devel@nongnu.org; Mon, 21 Oct 2019 04:57:31 -0400 Received: from us-smtp-2.mimecast.com ([205.139.110.61]:37239 helo=us-smtp-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1iMTVJ-0008E3-CW for qemu-devel@nongnu.org; Mon, 21 Oct 2019 04:57:29 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1571648247; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=ushM5KxVVbNxV6eFVYoiic00qXkoSeU6WKmvD3sd2EQ=; b=TM0eYAwsJf+cHt1RoNqHnxfzE2pL52yq5YdPzAiEGvloF5NeC+fXqlI3G3yJHtdOGst4m1 mNbe2wwMtbfLax2Jbot5XzF/U3PqewslFPygByMCqwvy6pV24OUtk1EWLMyR5zkULwD2HG w6eqcNUK/V+R53LsqgmwZOL4xQ7EL+s= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-22-j80JIpApPxmn4haWRYqfrg-1; Mon, 21 Oct 2019 04:57:24 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id C69EA1005500; Mon, 21 Oct 2019 08:57:23 +0000 (UTC) Received: from t460s.redhat.com (ovpn-116-198.ams2.redhat.com [10.36.116.198]) by smtp.corp.redhat.com (Postfix) with ESMTP id 48E015D6B0; Mon, 21 Oct 2019 08:57:22 +0000 (UTC) From: David Hildenbrand To: qemu-devel@nongnu.org Subject: [PATCH v2 2/6] s390x/tcg: Fix VECTOR MULTIPLY AND ADD * Date: Mon, 21 Oct 2019 10:57:11 +0200 Message-Id: <20191021085715.3797-3-david@redhat.com> In-Reply-To: <20191021085715.3797-1-david@redhat.com> References: <20191021085715.3797-1-david@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-MC-Unique: j80JIpApPxmn4haWRYqfrg-1 X-Mimecast-Spam-Score: 0 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 205.139.110.61 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Thomas Huth , David Hildenbrand , Ivan Warren , Cornelia Huck , Richard Henderson , qemu-s390x@nongnu.org Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" We missed that we always read a "double-wide even-odd element pair of the fourth operand". Fix it in all four variants. Fixes: 1b430aec4157 ("s390x/tcg: Implement VECTOR MULTIPLY AND ADD *") Reviewed-by: Richard Henderson Signed-off-by: David Hildenbrand --- target/s390x/vec_int_helper.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/target/s390x/vec_int_helper.c b/target/s390x/vec_int_helper.c index 03ae8631d9..1b3aaecbdb 100644 --- a/target/s390x/vec_int_helper.c +++ b/target/s390x/vec_int_helper.c @@ -336,7 +336,7 @@ void HELPER(gvec_vmae##BITS)(void *v1, const void *v2, const void *v3, \ for (i = 0, j = 0; i < (128 / TBITS); i++, j += 2) { \ int##TBITS##_t a = (int##BITS##_t)s390_vec_read_element##BITS(v2, j); \ int##TBITS##_t b = (int##BITS##_t)s390_vec_read_element##BITS(v3, j); \ - int##TBITS##_t c = (int##BITS##_t)s390_vec_read_element##BITS(v4, j); \ + int##TBITS##_t c = s390_vec_read_element##TBITS(v4, i); \ \ s390_vec_write_element##TBITS(v1, i, a * b + c); \ } \ @@ -354,7 +354,7 @@ void HELPER(gvec_vmale##BITS)(void *v1, const void *v2, const void *v3, \ for (i = 0, j = 0; i < (128 / TBITS); i++, j += 2) { \ uint##TBITS##_t a = s390_vec_read_element##BITS(v2, j); \ uint##TBITS##_t b = s390_vec_read_element##BITS(v3, j); \ - uint##TBITS##_t c = s390_vec_read_element##BITS(v4, j); \ + uint##TBITS##_t c = s390_vec_read_element##TBITS(v4, i); \ \ s390_vec_write_element##TBITS(v1, i, a * b + c); \ } \ @@ -372,7 +372,7 @@ void HELPER(gvec_vmao##BITS)(void *v1, const void *v2, const void *v3, \ for (i = 0, j = 1; i < (128 / TBITS); i++, j += 2) { \ int##TBITS##_t a = (int##BITS##_t)s390_vec_read_element##BITS(v2, j); \ int##TBITS##_t b = (int##BITS##_t)s390_vec_read_element##BITS(v3, j); \ - int##TBITS##_t c = (int##BITS##_t)s390_vec_read_element##BITS(v4, j); \ + int##TBITS##_t c = s390_vec_read_element##TBITS(v4, i); \ \ s390_vec_write_element##TBITS(v1, i, a * b + c); \ } \ @@ -390,7 +390,7 @@ void HELPER(gvec_vmalo##BITS)(void *v1, const void *v2, const void *v3, \ for (i = 0, j = 1; i < (128 / TBITS); i++, j += 2) { \ uint##TBITS##_t a = s390_vec_read_element##BITS(v2, j); \ uint##TBITS##_t b = s390_vec_read_element##BITS(v3, j); \ - uint##TBITS##_t c = s390_vec_read_element##BITS(v4, j); \ + uint##TBITS##_t c = s390_vec_read_element##TBITS(v4, i); \ \ s390_vec_write_element##TBITS(v1, i, a * b + c); \ } \ From patchwork Mon Oct 21 08:57:12 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Hildenbrand X-Patchwork-Id: 1180393 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.b="J/6mbrv9"; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 46xVt11mFyz9sP6 for ; Mon, 21 Oct 2019 19:58:33 +1100 (AEDT) Received: from localhost ([::1]:36057 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iMTWI-0001Sj-Nt for incoming@patchwork.ozlabs.org; Mon, 21 Oct 2019 04:58:30 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:59338) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iMTVR-0001Kh-AS for qemu-devel@nongnu.org; Mon, 21 Oct 2019 04:57:38 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iMTVQ-0008HX-6L for qemu-devel@nongnu.org; Mon, 21 Oct 2019 04:57:37 -0400 Received: from us-smtp-delivery-1.mimecast.com ([207.211.31.120]:29856 helo=us-smtp-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1iMTVQ-0008G1-0R for qemu-devel@nongnu.org; Mon, 21 Oct 2019 04:57:36 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1571648252; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=FHlWXoHCnrB0OHhFNh6r59f33Iy5i10scQU1TwDX6JM=; b=J/6mbrv9CoNsAzUsLpqzyUhhHKirRK0M2XtfsNK3pItJYq50gGUGddY5y4I6bybrtnVgcG p6WzOKUoHQtFvEjxG9iUsoUZLyIi5rJy/+yXm7KDNgM7drrah2BqAEZaaNCpt6bz+MjBr+ UKAt0Gi5rpR2081wZUr9p3aKS/EgDfI= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-295-xmXgOX7PO56xVTk7WEeFPw-1; Mon, 21 Oct 2019 04:57:28 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 4BF4E1005516; Mon, 21 Oct 2019 08:57:27 +0000 (UTC) Received: from t460s.redhat.com (ovpn-116-198.ams2.redhat.com [10.36.116.198]) by smtp.corp.redhat.com (Postfix) with ESMTP id 1B3A15D6B0; Mon, 21 Oct 2019 08:57:23 +0000 (UTC) From: David Hildenbrand To: qemu-devel@nongnu.org Subject: [PATCH v2 3/6] s390x/tcg: Fix VECTOR SHIFT RIGHT ARITHMETIC BY BYTE Date: Mon, 21 Oct 2019 10:57:12 +0200 Message-Id: <20191021085715.3797-4-david@redhat.com> In-Reply-To: <20191021085715.3797-1-david@redhat.com> References: <20191021085715.3797-1-david@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-MC-Unique: xmXgOX7PO56xVTk7WEeFPw-1 X-Mimecast-Spam-Score: 0 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 207.211.31.120 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Thomas Huth , David Hildenbrand , Ivan Warren , Cornelia Huck , Richard Henderson , qemu-s390x@nongnu.org Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" We forgot to propagate the highest bit accross the high doubleword in two cases (shift >=64). Fixes: 5f724887e3dd ("s390x/tcg: Implement VECTOR SHIFT RIGHT ARITHMETIC") Reviewed-by: Richard Henderson Signed-off-by: David Hildenbrand --- target/s390x/vec_int_helper.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/target/s390x/vec_int_helper.c b/target/s390x/vec_int_helper.c index 1b3aaecbdb..d38405848f 100644 --- a/target/s390x/vec_int_helper.c +++ b/target/s390x/vec_int_helper.c @@ -70,15 +70,17 @@ static void s390_vec_sar(S390Vector *d, const S390Vector *a, uint64_t count) d->doubleword[0] = a->doubleword[0]; d->doubleword[1] = a->doubleword[1]; } else if (count == 64) { + tmp = (int64_t)a->doubleword[0] >> 63; d->doubleword[1] = a->doubleword[0]; - d->doubleword[0] = 0; + d->doubleword[0] = tmp; } else if (count < 64) { tmp = a->doubleword[1] >> count; d->doubleword[1] = deposit64(tmp, 64 - count, count, a->doubleword[0]); d->doubleword[0] = (int64_t)a->doubleword[0] >> count; } else { + tmp = (int64_t)a->doubleword[0] >> 63; d->doubleword[1] = (int64_t)a->doubleword[0] >> (count - 64); - d->doubleword[0] = 0; + d->doubleword[0] = tmp; } } From patchwork Mon Oct 21 08:57:13 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Hildenbrand X-Patchwork-Id: 1180394 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.b="isEtRAxo"; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 46xVvz48hjz9sP6 for ; Mon, 21 Oct 2019 20:00:15 +1100 (AEDT) Received: from localhost ([::1]:36074 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iMTXx-0003mF-0p for incoming@patchwork.ozlabs.org; Mon, 21 Oct 2019 05:00:13 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:59335) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iMTVR-0001KT-55 for qemu-devel@nongnu.org; Mon, 21 Oct 2019 04:57:38 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iMTVQ-0008HM-0x for qemu-devel@nongnu.org; Mon, 21 Oct 2019 04:57:37 -0400 Received: from us-smtp-1.mimecast.com ([207.211.31.81]:21672) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1iMTVN-0008Fs-Nu for qemu-devel@nongnu.org; Mon, 21 Oct 2019 04:57:34 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1571648251; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=UpzX3vb9RgNNLYiM/JvDGiNB0vNs3Bk5YnPik6Epjvk=; b=isEtRAxo4KMFzEdJq6tz24JaGzU/ptwoGqmxcW7KMeAabBVM0tQs5n5kZ6lreJS5040Ez+ kxIGUILL74sETYhG6BwGMakpcCvDzIpQ6gUeP22zJxYXkUY4+r9TqZJeOK5wwH7tv2NSrW o4ZJBjkKQtQyLSNjTh4R2cZqPggYXPc= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-9-FpeKXJQZO1OL8ZIwYpVLmA-1; Mon, 21 Oct 2019 04:57:30 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 1E349107AD31; Mon, 21 Oct 2019 08:57:29 +0000 (UTC) Received: from t460s.redhat.com (ovpn-116-198.ams2.redhat.com [10.36.116.198]) by smtp.corp.redhat.com (Postfix) with ESMTP id 95E955D6B0; Mon, 21 Oct 2019 08:57:27 +0000 (UTC) From: David Hildenbrand To: qemu-devel@nongnu.org Subject: [PATCH v2 4/6] s390x/tcg: Fix VECTOR SUBTRACT COMPUTE BORROW INDICATION Date: Mon, 21 Oct 2019 10:57:13 +0200 Message-Id: <20191021085715.3797-5-david@redhat.com> In-Reply-To: <20191021085715.3797-1-david@redhat.com> References: <20191021085715.3797-1-david@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-MC-Unique: FpeKXJQZO1OL8ZIwYpVLmA-1 X-Mimecast-Spam-Score: 0 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 207.211.31.81 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Thomas Huth , David Hildenbrand , Ivan Warren , Cornelia Huck , Richard Henderson , qemu-s390x@nongnu.org Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Looks like my idea of what a "borrow" is was wrong. The PoP says: "If the resulting subtraction results in a carry out of bit zero, a value of one is placed in the corresponding element of the first operand; otherwise, a value of zero is placed in the corresponding element" As clarified by Richard, all we have to do is invert the result. Fixes: 1ee2d7ba72f6 ("s390x/tcg: Implement VECTOR SUBTRACT COMPUTE BORROW INDICATION") Signed-off-by: David Hildenbrand Reviewed-by: Richard Henderson --- target/s390x/translate_vx.inc.c | 7 ++++--- target/s390x/vec_int_helper.c | 2 +- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/target/s390x/translate_vx.inc.c b/target/s390x/translate_vx.inc.c index 5ce7bfb0af..6032021d82 100644 --- a/target/s390x/translate_vx.inc.c +++ b/target/s390x/translate_vx.inc.c @@ -2132,12 +2132,12 @@ static DisasJumpType op_vs(DisasContext *s, DisasOps *o) static void gen_scbi_i32(TCGv_i32 d, TCGv_i32 a, TCGv_i32 b) { - tcg_gen_setcond_i32(TCG_COND_LTU, d, a, b); + tcg_gen_setcond_i32(TCG_COND_GEU, d, a, b); } static void gen_scbi_i64(TCGv_i64 d, TCGv_i64 a, TCGv_i64 b) { - tcg_gen_setcond_i64(TCG_COND_LTU, d, a, b); + tcg_gen_setcond_i64(TCG_COND_GEU, d, a, b); } static void gen_scbi2_i64(TCGv_i64 dl, TCGv_i64 dh, TCGv_i64 al, @@ -2151,7 +2151,8 @@ static void gen_scbi2_i64(TCGv_i64 dl, TCGv_i64 dh, TCGv_i64 al, tcg_gen_andi_i64(th, th, 1); tcg_gen_sub2_i64(tl, th, ah, zero, th, zero); tcg_gen_sub2_i64(tl, th, tl, th, bh, zero); - tcg_gen_andi_i64(dl, th, 1); + /* "invert" the result: -1 -> 0; 0 -> 1 */ + tcg_gen_addi_i64(dl, th, 1); tcg_gen_mov_i64(dh, zero); tcg_temp_free_i64(th); diff --git a/target/s390x/vec_int_helper.c b/target/s390x/vec_int_helper.c index d38405848f..0d6bc13dd6 100644 --- a/target/s390x/vec_int_helper.c +++ b/target/s390x/vec_int_helper.c @@ -593,7 +593,7 @@ void HELPER(gvec_vscbi##BITS)(void *v1, const void *v2, const void *v3, \ const uint##BITS##_t a = s390_vec_read_element##BITS(v2, i); \ const uint##BITS##_t b = s390_vec_read_element##BITS(v3, i); \ \ - s390_vec_write_element##BITS(v1, i, a < b); \ + s390_vec_write_element##BITS(v1, i, a >= b); \ } \ } DEF_VSCBI(8) From patchwork Mon Oct 21 08:57:14 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Hildenbrand X-Patchwork-Id: 1180397 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.b="MOPJokKf"; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 46xVyB74Qhz9sPV for ; Mon, 21 Oct 2019 20:02:10 +1100 (AEDT) Received: from localhost ([::1]:36102 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iMTZo-0005Qy-8g for incoming@patchwork.ozlabs.org; Mon, 21 Oct 2019 05:02:08 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:59341) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iMTVR-0001Kn-Ce for qemu-devel@nongnu.org; Mon, 21 Oct 2019 04:57:38 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iMTVQ-0008Hs-87 for qemu-devel@nongnu.org; Mon, 21 Oct 2019 04:57:37 -0400 Received: from us-smtp-delivery-1.mimecast.com ([207.211.31.120]:53389 helo=us-smtp-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1iMTVQ-0008GR-3O for qemu-devel@nongnu.org; Mon, 21 Oct 2019 04:57:36 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1571648253; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=OkwGk067nPs7KydfbubhuFCrne3UBwMkswXPEFkntV0=; b=MOPJokKfeUa/ze0CAcR/MtXrU0gDbJnQW4KCXTtOLh0v48/1Cu2dKuntj7E/gNz4ShEDXr Po79PClD0CYikSJjLw1yH65rNZ0cIkC4R5PHfnNRXM5tydhGoG0wWeSGfCaFgeGX72x9+E fZtsDKAX6msU5Race6iuRrhn7utx2xE= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-241-ioiE48vbNV2cDVXOmSyc0g-1; Mon, 21 Oct 2019 04:57:32 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 006C3800D41; Mon, 21 Oct 2019 08:57:30 +0000 (UTC) Received: from t460s.redhat.com (ovpn-116-198.ams2.redhat.com [10.36.116.198]) by smtp.corp.redhat.com (Postfix) with ESMTP id 69F205D6B0; Mon, 21 Oct 2019 08:57:29 +0000 (UTC) From: David Hildenbrand To: qemu-devel@nongnu.org Subject: [PATCH v2 5/6] s390x/tcg: Fix VECTOR SUBTRACT WITH BORROW INDICATION Date: Mon, 21 Oct 2019 10:57:14 +0200 Message-Id: <20191021085715.3797-6-david@redhat.com> In-Reply-To: <20191021085715.3797-1-david@redhat.com> References: <20191021085715.3797-1-david@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-MC-Unique: ioiE48vbNV2cDVXOmSyc0g-1 X-Mimecast-Spam-Score: 0 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 207.211.31.120 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Thomas Huth , David Hildenbrand , Ivan Warren , Cornelia Huck , Richard Henderson , qemu-s390x@nongnu.org Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Testing this, there seems to be something messed up. We are dealing with unsigned numbers. "Each operand is treated as an unsigned binary integer." Let's just implement as written in the PoP: "A subtraction is performed by adding the contents of the second operand with the bitwise complement of the third operand along with a borrow indication from the rightmost bit position of the fourth operand and the result is placed in the first operand." We can reuse gen_ac2_i64(). Fixes: 48390a7c2716 ("s390x/tcg: Implement VECTOR SUBTRACT WITH BORROW INDICATION") Signed-off-by: David Hildenbrand Reviewed-by: Richard Henderson --- target/s390x/translate_vx.inc.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/target/s390x/translate_vx.inc.c b/target/s390x/translate_vx.inc.c index 6032021d82..fd746ba35f 100644 --- a/target/s390x/translate_vx.inc.c +++ b/target/s390x/translate_vx.inc.c @@ -2187,13 +2187,13 @@ static void gen_sbi2_i64(TCGv_i64 dl, TCGv_i64 dh, TCGv_i64 al, TCGv_i64 ah, TCGv_i64 bl, TCGv_i64 bh, TCGv_i64 cl, TCGv_i64 ch) { TCGv_i64 tl = tcg_temp_new_i64(); - TCGv_i64 zero = tcg_const_i64(0); + TCGv_i64 th = tcg_temp_new_i64(); - tcg_gen_andi_i64(tl, cl, 1); - tcg_gen_sub2_i64(dl, dh, al, ah, bl, bh); - tcg_gen_sub2_i64(dl, dh, dl, dh, tl, zero); + tcg_gen_not_i64(tl, bl); + tcg_gen_not_i64(th, bh); + gen_ac2_i64(dl, dh, al, ah, tl, th, cl, ch); tcg_temp_free_i64(tl); - tcg_temp_free_i64(zero); + tcg_temp_free_i64(th); } static DisasJumpType op_vsbi(DisasContext *s, DisasOps *o) From patchwork Mon Oct 21 08:57:15 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Hildenbrand X-Patchwork-Id: 1180398 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.b="Ip3joPZu"; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 46xW0r3Mv2z9sPZ for ; Mon, 21 Oct 2019 20:04:28 +1100 (AEDT) Received: from localhost ([::1]:36184 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iMTc1-00007Z-SR for incoming@patchwork.ozlabs.org; Mon, 21 Oct 2019 05:04:25 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:59380) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iMTVS-0001O1-VR for qemu-devel@nongnu.org; Mon, 21 Oct 2019 04:57:39 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iMTVR-0008Jh-Pm for qemu-devel@nongnu.org; Mon, 21 Oct 2019 04:57:38 -0400 Received: from us-smtp-2.mimecast.com ([205.139.110.61]:32750 helo=us-smtp-delivery-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1iMTVR-0008Iv-LE for qemu-devel@nongnu.org; Mon, 21 Oct 2019 04:57:37 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1571648257; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=xxrTseFFVinnT6dz7W20NczKajlB+EKJ/qbB4WtneRk=; b=Ip3joPZuS+hBw/SAOWU7MJTrjc+joR1QiT7fh0LWQsdURMRwflOXa+VqvdW13oXL34X9Is eYnTof6bneQ60pCQujkV9QJyAd8fj8D9q+lSfDdcppM1HSPjVOGCdrKnL4O8lt+YjhnDYK UizT+cG8iQQloYXxvwKCmP7z712pBfk= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-36-fHKPS4pVMSOqsSnMasbm6w-1; Mon, 21 Oct 2019 04:57:33 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id C13E5107AD31; Mon, 21 Oct 2019 08:57:32 +0000 (UTC) Received: from t460s.redhat.com (ovpn-116-198.ams2.redhat.com [10.36.116.198]) by smtp.corp.redhat.com (Postfix) with ESMTP id 417495D717; Mon, 21 Oct 2019 08:57:31 +0000 (UTC) From: David Hildenbrand To: qemu-devel@nongnu.org Subject: [PATCH v2 6/6] s390x/tcg: Fix VECTOR SUBTRACT WITH BORROW COMPUTE BORROW INDICATION Date: Mon, 21 Oct 2019 10:57:15 +0200 Message-Id: <20191021085715.3797-7-david@redhat.com> In-Reply-To: <20191021085715.3797-1-david@redhat.com> References: <20191021085715.3797-1-david@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-MC-Unique: fHKPS4pVMSOqsSnMasbm6w-1 X-Mimecast-Spam-Score: 0 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 205.139.110.61 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Thomas Huth , David Hildenbrand , Ivan Warren , Cornelia Huck , Richard Henderson , qemu-s390x@nongnu.org Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" The numbers are unsigned, the computation is wrong. "Each operand is treated as an unsigned binary integer". Let's implement as given in the PoP: "A subtraction is performed by adding the contents of the second operand with the bitwise complement of the third operand along with a borrow indication from the rightmost bit of the fourth operand." Reuse gen_accc2_i64(). Fixes: bc725e65152c ("s390x/tcg: Implement VECTOR SUBTRACT WITH BORROW COMPUTE BORROW INDICATION") Signed-off-by: David Hildenbrand Reviewed-by: Richard Henderson --- target/s390x/translate_vx.inc.c | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/target/s390x/translate_vx.inc.c b/target/s390x/translate_vx.inc.c index fd746ba35f..71059f9ca0 100644 --- a/target/s390x/translate_vx.inc.c +++ b/target/s390x/translate_vx.inc.c @@ -2214,20 +2214,13 @@ static void gen_sbcbi2_i64(TCGv_i64 dl, TCGv_i64 dh, TCGv_i64 al, TCGv_i64 ah, { TCGv_i64 th = tcg_temp_new_i64(); TCGv_i64 tl = tcg_temp_new_i64(); - TCGv_i64 zero = tcg_const_i64(0); - tcg_gen_andi_i64(tl, cl, 1); - tcg_gen_sub2_i64(tl, th, al, zero, tl, zero); - tcg_gen_sub2_i64(tl, th, tl, th, bl, zero); - tcg_gen_andi_i64(th, th, 1); - tcg_gen_sub2_i64(tl, th, ah, zero, th, zero); - tcg_gen_sub2_i64(tl, th, tl, th, bh, zero); - tcg_gen_andi_i64(dl, th, 1); - tcg_gen_mov_i64(dh, zero); + tcg_gen_not_i64(tl, bl); + tcg_gen_not_i64(th, bh); + gen_accc2_i64(dl, dh, al, ah, tl, th, cl, ch); tcg_temp_free_i64(tl); tcg_temp_free_i64(th); - tcg_temp_free_i64(zero); } static DisasJumpType op_vsbcbi(DisasContext *s, DisasOps *o)