From nobody Tue Feb 10 07:42:01 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1675115483; cv=none; d=zohomail.com; s=zohoarc; b=KIYc3QlTRd9GQIPZCUIl5bUWIApM0e107zuBnYrWMktreHcNjqq3V12G/wFvelaO6zHzSGUKdNTZfCsy4vdGdaXrLOdEZ9sxeTUQh2wOJYtBzF03rUD5hwQ1/rAod4lE/MLGyV+qpV6KKFz3vfwTPgW0gpUONHUq6PlbG0ZOAKo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1675115483; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=LHzGWvWFa4q7FhR/Zjnl6sZxcznG5V94Bca4nmBi0Ko=; b=k65CqsVsP1WpHGp6vFwF6mblh9fn2gliGvKIJ7o7lcovGbBLPQ8TqYHKv9AGLNxMsM6I6HdrygNZRXLbXCBJrK5eivjbwkLjYID5vqBDUu8XVkig8YBmgtamArwwjUvvOpImw4OsC3n2ddWHfijcqZ5Bd0oZnE+cIohwusRF1x0= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 16751154831941015.971874194767; Mon, 30 Jan 2023 13:51:23 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pMc1p-00026I-4e; Mon, 30 Jan 2023 16:49:29 -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 1pMc1n-00023V-6S for qemu-devel@nongnu.org; Mon, 30 Jan 2023 16:49:27 -0500 Received: from mail-pl1-x631.google.com ([2607:f8b0:4864:20::631]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pMc1l-0005h4-KG for qemu-devel@nongnu.org; Mon, 30 Jan 2023 16:49:26 -0500 Received: by mail-pl1-x631.google.com with SMTP id b5so5848803plz.5 for ; Mon, 30 Jan 2023 13:49:25 -0800 (PST) Received: from stoup.. (rrcs-173-197-98-118.west.biz.rr.com. [173.197.98.118]) by smtp.gmail.com with ESMTPSA id t4-20020a17090ad14400b00219220edf0dsm7451215pjw.48.2023.01.30.13.49.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 30 Jan 2023 13:49:23 -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=LHzGWvWFa4q7FhR/Zjnl6sZxcznG5V94Bca4nmBi0Ko=; b=viOdonl/nYCAN4UYZVA0ocEdWF0tREMdJG3qfe8TUtS27c5HN62zc5Bzj6yj73SWHe 8wcLeRYcRpGUMqfd8IQ2QI/2h4av7EQlmD/f1Bd7A33yKsqbOnjtu2mF4OuKfvN6cRCD cqEQ467u+1Vv0q7/H2bjI6muk+NZO+zJ12+lhSHSPBzXSlr6K9LTg09LMG1QUE6LROZl kSuqhSmNwDo2vMs81FEFQ4Z+rkaCEzaipbowaZAjJuM75t0GqH+7q0g5cf+sJl3TckE9 8eoHxhQbdI+4mHBx9hn+uT2ojKijD4J3MWWtByeek3BLwfbnVvyBah0KogbznTC/YLvk i4QQ== 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=LHzGWvWFa4q7FhR/Zjnl6sZxcznG5V94Bca4nmBi0Ko=; b=L0Jf+9offuXBR/ARtCtwrV7hcdpksBM144wREY3vcHd9855QnfOJMriJ+tx8kOCaHE G3nvOM6YpcAh4ULjsnay0DQlSLbBNtfPqBX8l0TBNady8UEROX1482sLHV/N45Z3LoJw qg3/RJV/beV5Zn/eyoIHbPquzCKiSprAoEZK1q9aUsuVyi0Qvq4VqmAtXo+mgDhaColV NlMnES0ghfisG04x7dcKEKe8za0VzvelyhT5ehqemAsqEF969WRO/rNk7wzUAax/+AB5 MTKW/ZS0w13fMjvEsKIqyDOmFWALMGsxqW37WxSAd6e8r40Ucx384V8dUPT5axko4Enq 9oiQ== X-Gm-Message-State: AO0yUKUyazv/Ay6tXFqX5co5JpvssnqCKkxYm60xyr2B65p97+VgXi9q Dot/sRV3BkLmOPLgCRZag1ye6MkC9kiEGUNn X-Google-Smtp-Source: AK7set8SkNUEOwwKwpsfmFcIsAQ0+wXkfPQIh7zPD6+qRq/z3W1GNthDAZRfTVb453aW/71VOvzgqA== X-Received: by 2002:a17:90b:17c2:b0:22b:fd64:c48e with SMTP id me2-20020a17090b17c200b0022bfd64c48emr24561692pjb.14.1675115364181; Mon, 30 Jan 2023 13:49:24 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Cc: alex.bennee@linaro.org, philmd@linaro.org, Ilya Leoshkevich Subject: [PATCH v6 22/36] tests/tcg/s390x: Add clst.c Date: Mon, 30 Jan 2023 11:48:30 -1000 Message-Id: <20230130214844.1158612-23-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230130214844.1158612-1-richard.henderson@linaro.org> References: <20230130214844.1158612-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::631; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x631.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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1675115484998100008 Content-Type: text/plain; charset="utf-8" From: Ilya Leoshkevich Add a basic test to prevent regressions. Signed-off-by: Ilya Leoshkevich Message-Id: <20221025213008.2209006-2-iii@linux.ibm.com> Signed-off-by: Richard Henderson --- tests/tcg/s390x/clst.c | 82 +++++++++++++++++++++++++++++++++ tests/tcg/s390x/Makefile.target | 1 + 2 files changed, 83 insertions(+) create mode 100644 tests/tcg/s390x/clst.c diff --git a/tests/tcg/s390x/clst.c b/tests/tcg/s390x/clst.c new file mode 100644 index 0000000000..ed2fe7326c --- /dev/null +++ b/tests/tcg/s390x/clst.c @@ -0,0 +1,82 @@ +#define _GNU_SOURCE +#include +#include + +static int clst(char sep, const char **s1, const char **s2) +{ + const char *r1 =3D *s1; + const char *r2 =3D *s2; + int cc; + + do { + register int r0 asm("r0") =3D sep; + + asm("clst %[r1],%[r2]\n" + "ipm %[cc]\n" + "srl %[cc],28" + : [r1] "+r" (r1), [r2] "+r" (r2), "+r" (r0), [cc] "=3Dr" (cc) + : + : "cc"); + *s1 =3D r1; + *s2 =3D r2; + } while (cc =3D=3D 3); + + return cc; +} + +static const struct test { + const char *name; + char sep; + const char *s1; + const char *s2; + int exp_cc; + int exp_off; +} tests[] =3D { + { + .name =3D "cc0", + .sep =3D 0, + .s1 =3D "aa", + .s2 =3D "aa", + .exp_cc =3D 0, + .exp_off =3D 0, + }, + { + .name =3D "cc1", + .sep =3D 1, + .s1 =3D "a\x01", + .s2 =3D "aa\x01", + .exp_cc =3D 1, + .exp_off =3D 1, + }, + { + .name =3D "cc2", + .sep =3D 2, + .s1 =3D "abc\x02", + .s2 =3D "abb\x02", + .exp_cc =3D 2, + .exp_off =3D 2, + }, +}; + +int main(void) +{ + const struct test *t; + const char *s1, *s2; + size_t i; + int cc; + + for (i =3D 0; i < sizeof(tests) / sizeof(tests[0]); i++) { + t =3D &tests[i]; + s1 =3D t->s1; + s2 =3D t->s2; + cc =3D clst(t->sep, &s1, &s2); + if (cc !=3D t->exp_cc || + s1 !=3D t->s1 + t->exp_off || + s2 !=3D t->s2 + t->exp_off) { + fprintf(stderr, "%s\n", t->name); + return EXIT_FAILURE; + } + } + + return EXIT_SUCCESS; +} diff --git a/tests/tcg/s390x/Makefile.target b/tests/tcg/s390x/Makefile.tar= get index ab7a3bcfb2..79250f31dd 100644 --- a/tests/tcg/s390x/Makefile.target +++ b/tests/tcg/s390x/Makefile.target @@ -25,6 +25,7 @@ TESTS+=3Dsignals-s390x TESTS+=3Dbranch-relative-long TESTS+=3Dnoexec TESTS+=3Ddiv +TESTS+=3Dclst =20 Z13_TESTS=3Dvistr $(Z13_TESTS): CFLAGS+=3D-march=3Dz13 -O2 --=20 2.34.1