{"id":1019117,"url":"http://patchwork.ozlabs.org/api/patches/1019117/?format=json","web_url":"http://patchwork.ozlabs.org/project/qemu-devel/patch/1545989148-13582-39-git-send-email-aleksandar.markovic@rt-rk.com/","project":{"id":14,"url":"http://patchwork.ozlabs.org/api/projects/14/?format=json","name":"QEMU Development","link_name":"qemu-devel","list_id":"qemu-devel.nongnu.org","list_email":"qemu-devel@nongnu.org","web_url":"","scm_url":"","webscm_url":"","list_archive_url":"","list_archive_url_format":"","commit_url_format":""},"msgid":"<1545989148-13582-39-git-send-email-aleksandar.markovic@rt-rk.com>","list_archive_url":null,"date":"2018-12-28T09:25:45","name":"[PULL,38/41] tests/tcg: mips: Test R5900 three-operand MADD","commit_ref":null,"pull_url":null,"state":"new","archived":false,"hash":"7fb2d71f40bd6237e731f2db061b99938b81f027","submitter":{"id":68635,"url":"http://patchwork.ozlabs.org/api/people/68635/?format=json","name":"Aleksandar Markovic","email":"aleksandar.markovic@rt-rk.com"},"delegate":null,"mbox":"http://patchwork.ozlabs.org/project/qemu-devel/patch/1545989148-13582-39-git-send-email-aleksandar.markovic@rt-rk.com/mbox/","series":[{"id":83742,"url":"http://patchwork.ozlabs.org/api/series/83742/?format=json","web_url":"http://patchwork.ozlabs.org/project/qemu-devel/list/?series=83742","date":"2018-12-28T09:25:09","name":"[PULL,01/41] MAINTAINERS: target/mips: Add MIPS files under default-configs directory","version":1,"mbox":"http://patchwork.ozlabs.org/series/83742/mbox/"}],"comments":"http://patchwork.ozlabs.org/api/patches/1019117/comments/","check":"pending","checks":"http://patchwork.ozlabs.org/api/patches/1019117/checks/","tags":{},"related":[],"headers":{"Return-Path":"<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>","X-Original-To":"incoming@patchwork.ozlabs.org","Delivered-To":"patchwork-incoming@bilbo.ozlabs.org","Authentication-Results":["ozlabs.org;\n\tspf=pass (mailfrom) smtp.mailfrom=nongnu.org\n\t(client-ip=208.118.235.17; helo=lists.gnu.org;\n\tenvelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org;\n\treceiver=<UNKNOWN>)","ozlabs.org;\n\tdmarc=none (p=none dis=none) header.from=rt-rk.com"],"Received":["from lists.gnu.org (lists.gnu.org [208.118.235.17])\n\t(using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits))\n\t(No client certificate requested)\n\tby ozlabs.org (Postfix) with ESMTPS id 43R24m4pJtz9s2P\n\tfor <incoming@patchwork.ozlabs.org>;\n\tFri, 28 Dec 2018 20:50:15 +1100 (AEDT)","from localhost ([127.0.0.1]:57893 helo=lists.gnu.org)\n\tby lists.gnu.org with esmtp (Exim 4.71) (envelope-from\n\t<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>)\n\tid 1gcomR-00084i-RM\n\tfor incoming@patchwork.ozlabs.org; Fri, 28 Dec 2018 04:50:11 -0500","from eggs.gnu.org ([208.118.235.92]:52301)\n\tby lists.gnu.org with esmtp (Exim 4.71)\n\t(envelope-from <aleksandar.markovic@rt-rk.com>) id 1gcom3-00082R-49\n\tfor qemu-devel@nongnu.org; Fri, 28 Dec 2018 04:49:50 -0500","from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)\n\t(envelope-from <aleksandar.markovic@rt-rk.com>) id 1gcoli-0001x0-A5\n\tfor qemu-devel@nongnu.org; Fri, 28 Dec 2018 04:49:29 -0500","from mx2.rt-rk.com ([89.216.37.149]:49920 helo=mail.rt-rk.com)\n\tby eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32)\n\t(Exim 4.71) (envelope-from <aleksandar.markovic@rt-rk.com>)\n\tid 1gcoPT-0003Ov-Hk\n\tfor qemu-devel@nongnu.org; Fri, 28 Dec 2018 04:26:27 -0500","from localhost (localhost [127.0.0.1])\n\tby mail.rt-rk.com (Postfix) with ESMTP id B5E821A2163;\n\tFri, 28 Dec 2018 10:25:56 +0100 (CET)","from rtrkw774-lin.domain.local (rtrkw774-lin.domain.local\n\t[10.10.13.43])\n\tby mail.rt-rk.com (Postfix) with ESMTPSA id 83FAC1A216C;\n\tFri, 28 Dec 2018 10:25:56 +0100 (CET)"],"X-Virus-Scanned":"amavisd-new at rt-rk.com","From":"Aleksandar Markovic <aleksandar.markovic@rt-rk.com>","To":"qemu-devel@nongnu.org","Date":"Fri, 28 Dec 2018 10:25:45 +0100","Message-Id":"<1545989148-13582-39-git-send-email-aleksandar.markovic@rt-rk.com>","X-Mailer":"git-send-email 2.7.4","In-Reply-To":"<1545989148-13582-1-git-send-email-aleksandar.markovic@rt-rk.com>","References":"<1545989148-13582-1-git-send-email-aleksandar.markovic@rt-rk.com>","X-detected-operating-system":"by eggs.gnu.org: GNU/Linux 3.x [fuzzy]","X-Received-From":"89.216.37.149","Subject":"[Qemu-devel] [PULL 38/41] tests/tcg: mips: Test R5900 three-operand\n\tMADD","X-BeenThere":"qemu-devel@nongnu.org","X-Mailman-Version":"2.1.21","Precedence":"list","List-Id":"<qemu-devel.nongnu.org>","List-Unsubscribe":"<https://lists.nongnu.org/mailman/options/qemu-devel>,\n\t<mailto:qemu-devel-request@nongnu.org?subject=unsubscribe>","List-Archive":"<http://lists.nongnu.org/archive/html/qemu-devel/>","List-Post":"<mailto:qemu-devel@nongnu.org>","List-Help":"<mailto:qemu-devel-request@nongnu.org?subject=help>","List-Subscribe":"<https://lists.nongnu.org/mailman/listinfo/qemu-devel>,\n\t<mailto:qemu-devel-request@nongnu.org?subject=subscribe>","Cc":"peter.maydell@linaro.org, amarkovic@wavecomp.com","Errors-To":"qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org","Sender":"\"Qemu-devel\"\n\t<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>"},"content":"From: Fredrik Noring <noring@nocrew.org>\n\nTest R5900 three-operand MADD.\n\nReviewed-by: Aleksandar Markovic <amarkovic@wavecomp.com>\nSigned-off-by: Aleksandar Markovic <amarkovic@wavecomp.com>\nSigned-off-by: Fredrik Noring <noring@nocrew.org>\n---\n tests/tcg/mips/mipsr5900/Makefile |  1 +\n tests/tcg/mips/mipsr5900/madd.c   | 45 +++++++++++++++++++++++++++++++++++++++\n 2 files changed, 46 insertions(+)\n create mode 100644 tests/tcg/mips/mipsr5900/madd.c","diff":"diff --git a/tests/tcg/mips/mipsr5900/Makefile b/tests/tcg/mips/mipsr5900/Makefile\nindex a1c388b..97ca2a6 100644\n--- a/tests/tcg/mips/mipsr5900/Makefile\n+++ b/tests/tcg/mips/mipsr5900/Makefile\n@@ -10,6 +10,7 @@ CFLAGS  = -Wall -mabi=32 -march=r5900 -static\n \n TESTCASES = div1.tst\n TESTCASES += divu1.tst\n+TESTCASES += madd.tst\n TESTCASES += mflohi1.tst\n TESTCASES += mtlohi1.tst\n TESTCASES += mult.tst\ndiff --git a/tests/tcg/mips/mipsr5900/madd.c b/tests/tcg/mips/mipsr5900/madd.c\nnew file mode 100644\nindex 0000000..9ad2ea6\n--- /dev/null\n+++ b/tests/tcg/mips/mipsr5900/madd.c\n@@ -0,0 +1,45 @@\n+/*\n+ * Test R5900-specific three-operand MADD.\n+ */\n+\n+#include <stdio.h>\n+#include <inttypes.h>\n+#include <assert.h>\n+\n+int64_t madd(int64_t a, int32_t rs, int32_t rt)\n+{\n+    int32_t lo = a;\n+    int32_t hi = a >> 32;\n+    int32_t rd;\n+    int64_t r;\n+\n+    __asm__ __volatile__ (\n+            \"    mtlo %5\\n\"\n+            \"    mthi %6\\n\"\n+            \"    madd %0, %3, %4\\n\"\n+            \"    mflo %1\\n\"\n+            \"    mfhi %2\\n\"\n+            : \"=r\" (rd), \"=r\" (lo), \"=r\" (hi)\n+            : \"r\" (rs), \"r\" (rt), \"r\" (lo), \"r\" (hi));\n+    r = ((int64_t)hi << 32) | (uint32_t)lo;\n+\n+    assert(a + (int64_t)rs * rt == r);\n+    assert(rd == lo);\n+\n+    return r;\n+}\n+\n+static void verify_madd(int64_t a, int32_t rs, int32_t rt, int64_t expected)\n+{\n+    assert(madd(a, rs, rt) == expected);\n+    assert(madd(a, -rs, rt) == a + a - expected);\n+    assert(madd(a, rs, -rt) == a + a - expected);\n+    assert(madd(a, -rs, -rt) == expected);\n+}\n+\n+int main()\n+{\n+    verify_madd(13, 17, 19, 336);\n+\n+    return 0;\n+}\n","prefixes":["PULL","38/41"]}