From patchwork Fri Nov 11 08:08:08 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 623702 Delivered-To: patch@linaro.org Received: by 2002:a17:522:c983:b0:460:3032:e3c4 with SMTP id kr3csp627260pvb; Fri, 11 Nov 2022 00:10:32 -0800 (PST) X-Google-Smtp-Source: AA0mqf7OR+o6DrLGhgff934fBfFtL3g9qGmCkeymUSceij/2IFpamU5D0s81tPhnXKCwFzgIpZvE X-Received: by 2002:a37:ad4:0:b0:6fa:1e63:7233 with SMTP id 203-20020a370ad4000000b006fa1e637233mr233993qkk.290.1668154232071; Fri, 11 Nov 2022 00:10:32 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668154232; cv=none; d=google.com; s=arc-20160816; b=QalDBo6wyIRWxzeWZJ9SItcjA+ADgFBnRzXGZlswTICNWLQ3R3bHNyqjqfQuDgoogm AFgFV2tUS1MUbZSDO4c5K4FHW4qDzcodFvPsIOriXXKDG379gUzHi6aiePBqA7UjZc5E id9ndXHdXZPuJVOfpksW+V4qvQSkQVfZiGaEClQm0rfBeP5Y+WUF7hvPerw8xvuPo07r ZEqM6uvrq8kiZI45ZYuG8vzMWVd3kXxmM6UIsDNxD7xrY3Ucs4R8o9gHYL1XBCUpY5Qa kFx4cZEGv7Zl1eaf0ZUpauz0tYnfP32n+4zPATb+CFPWGYBDt101vEl6MVJN3vZO5+dA iE9A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=lE4xtEA+pGCE8llxbq4kNT+2kFoTqQa5IGjt6U1bFuE=; b=gVXWX4cKHeuraSAUDx7cpHZsNvlJJ9sqBwniQWjsNwetWLUSK9ctc0tFDScVju9WB0 hHLwB7piDAnxHvbTQrisL6dOQq0WBiBK869hkpQr1EtFE7b/rTag+FjsUVRCXR0EAs+l lvjzzMJaXRJf8Lc+VrVKAk2tf1bHdcz1rpT77XbSzpYAeEx52X+PJ8kcAJD70aSY2a8p PAiatBrVBLxr6v/4026J4t8Tkvah+ElXZfMcgHQ+JCN+xYN7ehVUj3e2H6klYE+vmW76 4z6Ws1mkS0Y7ieXR4+vah5AKFjg1BU8W3pr8zwdIUEw9xUP7NdT0er0uOkTx2nnDZ5rV YzYg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=KFEOlE5W; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id s41-20020a05622a1aa900b0039ce41f091esi763562qtc.413.2022.11.11.00.10.31 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 11 Nov 2022 00:10:32 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=KFEOlE5W; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1otP6C-0001Fk-Nn; Fri, 11 Nov 2022 03:09:17 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1otP5X-00010G-Fb for qemu-devel@nongnu.org; Fri, 11 Nov 2022 03:08:38 -0500 Received: from mail-pf1-x430.google.com ([2607:f8b0:4864:20::430]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1otP5T-0002Dp-CV for qemu-devel@nongnu.org; Fri, 11 Nov 2022 03:08:33 -0500 Received: by mail-pf1-x430.google.com with SMTP id 130so4274219pfu.8 for ; Fri, 11 Nov 2022 00:08:30 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=lE4xtEA+pGCE8llxbq4kNT+2kFoTqQa5IGjt6U1bFuE=; b=KFEOlE5WV6LomtCQx9lDL29ipj4MF8ZZrCnCE6E6sBIEbq8i50IJpqO7HhvjxJLWFM s1sVrkdkBHqeSU+hsauyaIJl5Rg6KuzTD7PgtiWhn8DBJn9tzxHnGfTMqyJJ0evDUv25 FRhKCMJqzvfO1B/BhLdgqdXYo/vtxA5ik/94QEVu3IbXMEr3Jbn16SE3OKxN7D0lVp7u DhDmM4JI8sua9R46c9eFpDfFjS2g4teevAjBM7iBRQ0w9ztY01IYeoHat6b2BT+VYNEm O0f/i+ymH+Nzsj0E+1t9x8AMXTi9i6t7WxR8xSZU4gJ6RzXILHd3o0dicQ6Fv59Dpx5A UUtw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=lE4xtEA+pGCE8llxbq4kNT+2kFoTqQa5IGjt6U1bFuE=; b=yhtQogyo61cZ9Gmlp4nQ4wUpbJX0DJxBNVrLhNxaL6eIqm9L6qDp7Lyv3EHj51SVRM qEW5lOlhMpCMzHOSU7dNFN4so0CCYbiHat6q6QHkOsEfGbJVfR3MWX16E/XXsykYXTcR mCprtkQj4eX/aotCS2OMi5YZC0ftLRaflIXgeZjMbI2ksC0eKt0ZFoJDC7W7bJFuT7iB 5fsQ2SKm286hs1iBCVIGXfySAkNvK77U+clN/M4t0X/fAsDOPbvbwj42Uwe+44sTa+Q4 tYjfy2CPjwc2TItBixi8jgabqvtxg8lSoc6ANe5b+SfAq7Xq+F982KSw4n3qzxwkiEoF a1ZA== X-Gm-Message-State: ANoB5pk0+wF5vZ4lVtbcRi7M1aN+kCcAmeSvq5rnV/my1TdnGLSQzXSM lgYjWtgny82VBwbWVNG6f6mzzQy1eWyJ7ams X-Received: by 2002:a63:4d1c:0:b0:462:e0d0:2582 with SMTP id a28-20020a634d1c000000b00462e0d02582mr740380pgb.48.1668154109891; Fri, 11 Nov 2022 00:08:29 -0800 (PST) Received: from stoup.lan (2001-44b8-2176-c800-0aef-59aa-1faf-7e61.static.ipv6.internode.on.net. [2001:44b8:2176:c800:aef:59aa:1faf:7e61]) by smtp.gmail.com with ESMTPSA id j4-20020a170902c3c400b00186a2dd3ffdsm1046341plj.15.2022.11.11.00.08.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 11 Nov 2022 00:08:29 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Cc: iii@linux.ibm.com, david@redhat.com Subject: [PATCH for-8.0 v2 01/13] tests/tcg/s390x: Add div.c Date: Fri, 11 Nov 2022 18:08:08 +1000 Message-Id: <20221111080820.2132412-2-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20221111080820.2132412-1-richard.henderson@linaro.org> References: <20221111080820.2132412-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::430; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x430.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org From: Ilya Leoshkevich Add a basic test to prevent regressions. Signed-off-by: Ilya Leoshkevich Message-Id: <20221101111300.2539919-1-iii@linux.ibm.com> Signed-off-by: Richard Henderson --- tests/tcg/s390x/div.c | 40 +++++++++++++++++++++++++++++++++ tests/tcg/s390x/Makefile.target | 1 + 2 files changed, 41 insertions(+) create mode 100644 tests/tcg/s390x/div.c diff --git a/tests/tcg/s390x/div.c b/tests/tcg/s390x/div.c new file mode 100644 index 0000000000..5807295614 --- /dev/null +++ b/tests/tcg/s390x/div.c @@ -0,0 +1,40 @@ +#include +#include + +static void test_dr(void) +{ + register int32_t r0 asm("r0") = -1; + register int32_t r1 asm("r1") = -4241; + int32_t b = 101, q, r; + + asm("dr %[r0],%[b]" + : [r0] "+r" (r0), [r1] "+r" (r1) + : [b] "r" (b) + : "cc"); + q = r1; + r = r0; + assert(q == -41); + assert(r == -100); +} + +static void test_dlr(void) +{ + register uint32_t r0 asm("r0") = 0; + register uint32_t r1 asm("r1") = 4243; + uint32_t b = 101, q, r; + + asm("dlr %[r0],%[b]" + : [r0] "+r" (r0), [r1] "+r" (r1) + : [b] "r" (b) + : "cc"); + q = r1; + r = r0; + assert(q == 42); + assert(r == 1); +} + +int main(void) +{ + test_dr(); + test_dlr(); +} diff --git a/tests/tcg/s390x/Makefile.target b/tests/tcg/s390x/Makefile.target index 07fcc6d0ce..ab7a3bcfb2 100644 --- a/tests/tcg/s390x/Makefile.target +++ b/tests/tcg/s390x/Makefile.target @@ -24,6 +24,7 @@ TESTS+=trap TESTS+=signals-s390x TESTS+=branch-relative-long TESTS+=noexec +TESTS+=div Z13_TESTS=vistr $(Z13_TESTS): CFLAGS+=-march=z13 -O2