From nobody Sat Feb 7 05:02:02 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.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; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1547406665150714.8794244385201; Sun, 13 Jan 2019 11:11:05 -0800 (PST) Received: from localhost ([127.0.0.1]:40776 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gil9z-0008VI-M1 for importer@patchew.org; Sun, 13 Jan 2019 14:11:03 -0500 Received: from eggs.gnu.org ([209.51.188.92]:34175) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gil6q-0006Gp-25 for qemu-devel@nongnu.org; Sun, 13 Jan 2019 14:07:48 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gil6o-00064n-5E for qemu-devel@nongnu.org; Sun, 13 Jan 2019 14:07:47 -0500 Received: from pio-pvt-msa2.bahnhof.se ([79.136.2.41]:55676) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gil6m-00063g-9C for qemu-devel@nongnu.org; Sun, 13 Jan 2019 14:07:44 -0500 Received: from localhost (localhost [127.0.0.1]) by pio-pvt-msa2.bahnhof.se (Postfix) with ESMTP id D9DAF3F52B; Sun, 13 Jan 2019 20:07:37 +0100 (CET) Received: from pio-pvt-msa2.bahnhof.se ([127.0.0.1]) by localhost (pio-pvt-msa2.bahnhof.se [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id CImUAebCY5LH; Sun, 13 Jan 2019 20:07:30 +0100 (CET) Received: from localhost (h-41-252.A163.priv.bahnhof.se [46.59.41.252]) (Authenticated sender: mb547485) by pio-pvt-msa2.bahnhof.se (Postfix) with ESMTPA id 1D9B13F510; Sun, 13 Jan 2019 20:07:30 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at bahnhof.se Date: Sun, 13 Jan 2019 20:07:29 +0100 From: Fredrik Noring To: Aleksandar Markovic , Aurelien Jarno , Philippe =?utf-8?Q?Mathieu-Daud=C3=A9?= Message-ID: <5a4aa79777985d3d5c777ad2cdc6fdee9081345f.1547403692.git.noring@nocrew.org> References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 79.136.2.41 Subject: [Qemu-devel] [PATCH 7/9] tests/tcg/mips: Test R5900 multimedia instructions PCPYUD and PCPYLD X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?utf-8?Q?J=C3=BCrgen?= Urban , qemu-devel@nongnu.org, "Maciej W. Rozycki" Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Signed-off-by: Fredrik Noring Reviewed-by: Aleksandar Markovic --- tests/tcg/mips/mipsn32r5900/Makefile | 25 +++++++++++++++ tests/tcg/mips/mipsn32r5900/pcpyuld.c | 46 +++++++++++++++++++++++++++ 2 files changed, 71 insertions(+) create mode 100644 tests/tcg/mips/mipsn32r5900/Makefile create mode 100644 tests/tcg/mips/mipsn32r5900/pcpyuld.c diff --git a/tests/tcg/mips/mipsn32r5900/Makefile b/tests/tcg/mips/mipsn32r= 5900/Makefile new file mode 100644 index 0000000000..f4887678ae --- /dev/null +++ b/tests/tcg/mips/mipsn32r5900/Makefile @@ -0,0 +1,25 @@ +-include ../../config-host.mak + +CROSS=3Dmips64r5900el-unknown-linux-gnu- + +SIM=3Dqemu-mipsn32el +SIM_FLAGS=3D-cpu R5900 + +CC =3D $(CROSS)gcc +CFLAGS =3D -Wall -mabi=3Dn32 -march=3Dr5900 -static + +TESTCASES =3D pcpyuld.tst + +all: $(TESTCASES) + +%.tst: %.c + $(CC) $(CFLAGS) $< -o $@ + +check: $(TESTCASES) + @for case in $(TESTCASES); do \ + echo $(SIM) $(SIM_FLAGS) ./$$case;\ + $(SIM) $(SIM_FLAGS) ./$$case; \ + done + +clean: + $(RM) -rf $(TESTCASES) diff --git a/tests/tcg/mips/mipsn32r5900/pcpyuld.c b/tests/tcg/mips/mipsn32= r5900/pcpyuld.c new file mode 100644 index 0000000000..c92af6330b --- /dev/null +++ b/tests/tcg/mips/mipsn32r5900/pcpyuld.c @@ -0,0 +1,46 @@ +/* + * Test PCPYUD and PCPYLD. + */ + +#include +#include +#include +#include + +/* 128-bit multimedia register */ +struct mmr { uint64_t hi, lo; } __attribute__((aligned(16))); + +static void verify_zero(void) +{ + __asm__ __volatile__ ( + " pcpyud $0, $0, $0\n" + " pcpyld $0, $0, $0\n" + ); +} + +static void verify_copy(void) +{ + const struct mmr value =3D { + .hi =3D 0x6665646362613938, + .lo =3D 0x3736353433323130 + }; + struct mmr result =3D { }; + + __asm__ __volatile__ ( + " pcpyld %0, %2, %3\n" + " move %1, %0\n" + " pcpyud %0, %0, %0\n" + : "=3Dr" (result.hi), "=3Dr" (result.lo) + : "r" (value.hi), "r" (value.lo)); + + assert(value.hi =3D=3D result.hi); + assert(value.lo =3D=3D result.lo); +} + +int main() +{ + verify_zero(); + verify_copy(); + + return 0; +} --=20 2.19.2