From patchwork Wed Jun 13 12:55:59 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Alex_Benn=C3=A9e?= X-Patchwork-Id: 138475 Delivered-To: patch@linaro.org Received: by 2002:a2e:970d:0:0:0:0:0 with SMTP id r13-v6csp720037lji; Wed, 13 Jun 2018 06:23:56 -0700 (PDT) X-Google-Smtp-Source: ADUXVKKcAPx2Uppvzzcz5lsHtkUfFKzBu9yJm+dVa0YUmb+VzNu8ZXSl3sk4yXP/8JxubNRk/Y+S X-Received: by 2002:a37:8e87:: with SMTP id q129-v6mr4314764qkd.76.1528896236471; Wed, 13 Jun 2018 06:23:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1528896236; cv=none; d=google.com; s=arc-20160816; b=UJRc2v6U4BPXPewr3GDFmYWiaN3N1usx6sZdWa0wLU4XSdeerA6sY/yFzhtEh9Y7z5 GSO2w00KEwsaaua17WN5XmbZCSbbMxTIlQ4I06Ua69XotCON/0jpNOSyfo//gN2aT43Q kaQAkRl8o/t+Wudqz2omoqt0OP+0oxZBcKik+3IpnpiYykwIL16waCIPBW4CUX03G/6D Udsy3e3nYKJoHXmP/o6ALmJamcREZthmjZnxRa4Sr931NFL8y9BNaha5d54/4grdk0Zy a0kAqL20sz8GIhplSsQMcqj32+EKE/7Uu0URJ58ycwj00aFgOcDwg58eN6u4MyQIYfqA gfkw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:subject :content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:to:from:dkim-signature:arc-authentication-results; bh=m5poxk/3IEl6hK1Nv7oygKfYCWi7POaKrRzUx6MinRw=; b=POGFLCstcoV7xBiHpTTQnk2w1+vLIoBtARxg+l3KanQN9jbjU3Rf1NVU+ZnxWz4yVH lG8M7oi3V52MOMfHQf27T6V8O+uG+WSeLECSvH+qjqw9AW7WFI9+EBe4VWjn+SiDQ67/ Sun87VU5k2q6IRPoLWJ0bdMT4EtvAPDJIIXY4OvbyHmE1xmB/WFTdqidzz9AN5ZOb3/X //8QD3xzH6jXyG163Lb1QCXPTX4RLqChenL8CcCXtKeu6SSSodda4Igmg8Okmnrq0pBm ERWwJScWOQR+RShRgyzpMj+aVAAehVJyeDrwymY6y9Y94Q6Bocqbrjt/MN7J8V6ND7zc LLew== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=Ll1eoHyB; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id t4-v6si2700476qvi.6.2018.06.13.06.23.56 for (version=TLS1 cipher=AES128-SHA bits=128/128); Wed, 13 Jun 2018 06:23:56 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) client-ip=2001:4830:134:3::11; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=Ll1eoHyB; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:34295 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fT5kh-00005v-Vl for patch@linaro.org; Wed, 13 Jun 2018 09:23:56 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:52546) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fT5SJ-0001Zy-SQ for qemu-devel@nongnu.org; Wed, 13 Jun 2018 09:04:57 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fT5SD-0005Ox-S0 for qemu-devel@nongnu.org; Wed, 13 Jun 2018 09:04:55 -0400 Received: from mail-wr0-x231.google.com ([2a00:1450:400c:c0c::231]:39123) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fT5SD-0005M3-Ji for qemu-devel@nongnu.org; Wed, 13 Jun 2018 09:04:49 -0400 Received: by mail-wr0-x231.google.com with SMTP id w7-v6so2683375wrn.6 for ; Wed, 13 Jun 2018 06:04:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=m5poxk/3IEl6hK1Nv7oygKfYCWi7POaKrRzUx6MinRw=; b=Ll1eoHyBhPlmFEWGFT8A0TIFdfHkgTmaUNnAtv9gzTM771C2QPcekhNHMxGJIwY90Z LNK2YtblYUNbGSI4/pce8OPRgcA1M8imFA5GfHVdXyb2pfUXiW+1KGZjHsmQ5zbmmU92 SH26dmv3J2tnG2YDvW45PFP2sEsUxv7yBPCLE= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=m5poxk/3IEl6hK1Nv7oygKfYCWi7POaKrRzUx6MinRw=; b=VkxFLpplM814k2A2XHUKDzMvmUJthTS96gzRgASEa/WtQvMckPKQQKAWrgqi7FFhzZ Vqz2F50oKJaAE4IaK2WGvh86JLigFgqXaLhNeskdPT18P7A1wBpN5MP0Ig90abtdYqj4 u4LLox3kVR3VgMV3bi/pFOo8hxSwtb8LqcYUfgEsdy018EYYtOlAEFi/VBtIR0D86Pqe WmQ5QVetmtswLsJzSvIMljqrlqFfmMowFJq9+P01ajTg2cM8fwQT9yNqDLeCqW7NlSYv 7G7RUhgCSKkLHR09Q3MgWu++FeYRX8dAOh1VcO+XHZvD9+nytAElcuskPckSfOfQazap 6K/w== X-Gm-Message-State: APt69E3ueEckR0l6feepA25jRSfsvSByGwnx9LptHeqlBg6I2oD1cQYC 7tmq7hAaSu9EZC2INKqt92gkMg== X-Received: by 2002:adf:f112:: with SMTP id r18-v6mr4017135wro.134.1528895088500; Wed, 13 Jun 2018 06:04:48 -0700 (PDT) Received: from zen.linaro.local ([81.128.185.34]) by smtp.gmail.com with ESMTPSA id t17-v6sm3596895wrr.82.2018.06.13.06.04.45 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 13 Jun 2018 06:04:45 -0700 (PDT) Received: from zen.linaroharston (localhost [127.0.0.1]) by zen.linaro.local (Postfix) with ESMTP id 319203E130E; Wed, 13 Jun 2018 13:56:02 +0100 (BST) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: peter.maydell@linaro.org Date: Wed, 13 Jun 2018 13:55:59 +0100 Message-Id: <20180613125601.14371-21-alex.bennee@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180613125601.14371-1-alex.bennee@linaro.org> References: <20180613125601.14371-1-alex.bennee@linaro.org> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:400c:c0c::231 Subject: [Qemu-devel] [RISU PATCH v3 20/22] risu_reginfo_aarch64: add SVE support to reginfo_dump_mismatch 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?Alex_Benn=C3=A9e?= , qemu-arm@nongnu.org, richard.henderson@linaro.org, qemu-devel@nongnu.org Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Signed-off-by: Alex Bennée --- v2 - include ffr in comparison - mild re-factor of preg cmp/diff v3 - re-factoring --- risu_reginfo_aarch64.c | 74 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 74 insertions(+) -- 2.17.1 diff --git a/risu_reginfo_aarch64.c b/risu_reginfo_aarch64.c index 79db5dd..a352b4c 100644 --- a/risu_reginfo_aarch64.c +++ b/risu_reginfo_aarch64.c @@ -17,6 +17,7 @@ #include #include #include +#include #include "risu.h" #include "risu_reginfo_aarch64.h" @@ -164,6 +165,35 @@ int reginfo_is_eq(struct reginfo *r1, struct reginfo *r2) return memcmp(r1, r2, reginfo_size()) == 0; } +#ifdef SVE_MAGIC +static int sve_zreg_is_eq(struct reginfo *r1, struct reginfo *r2, int z) +{ + return memcmp(r1->sve.zregs[z], r2->sve.zregs[z], sizeof(*r1->sve.zregs[z])) == 0; +} + +static int sve_preg_is_eq(uint16_t const (*p1)[SVE_VQ_MAX], + uint16_t const (*p2)[SVE_VQ_MAX]) +{ + return memcmp(p1, p2, sizeof *p1) == 0; +} + +static void sve_dump_preg_diff(FILE *f, int vq, + uint16_t const (*p1)[SVE_VQ_MAX], + uint16_t const (*p2)[SVE_VQ_MAX]) +{ + int q; + + for (q = 0; q < vq; q++) { + fprintf(f, "%#04x", *p1[q]); + } + fprintf(f, " vs "); + for (q = 0; q < vq; q++) { + fprintf(f, "%#04x", *p2[q]); + } + fprintf(f, "\n"); +} +#endif + /* reginfo_dump: print state to a stream, returns nonzero on success */ int reginfo_dump(struct reginfo *ri, FILE * f) { @@ -227,6 +257,50 @@ int reginfo_dump_mismatch(struct reginfo *m, struct reginfo *a, FILE * f) fprintf(f, " fpcr : %08x vs %08x\n", m->fpcr, a->fpcr); } +#ifdef SVE_MAGIC + if (test_sve) { + struct sve_reginfo *ms = &m->sve; + struct sve_reginfo *as = &a->sve; + + if (ms->vl != as->vl) { + fprintf(f, " SVE VL : %d vs %d\n", ms->vl, as->vl); + } + + if (!sve_preg_is_eq(&ms->ffr, &as->ffr)) { + fprintf(f, " FFR : "); + sve_dump_preg_diff(f, sve_vq_from_vl(ms->vl), + &ms->pregs[i], &as->pregs[i]); + } + for (i = 0; i < SVE_NUM_PREGS; i++) { + if (!sve_preg_is_eq(&ms->pregs[i], &as->pregs[i])) { + fprintf(f, " P%2d : ", i); + sve_dump_preg_diff(f, sve_vq_from_vl(ms->vl), + &ms->pregs[i], &as->pregs[i]); + } + } + for (i = 0; i < SVE_NUM_ZREGS; i++) { + if (!sve_zreg_is_eq(m, a, i)) { + int q; + char *pad=""; + fprintf(f, " Z%2d : ", i); + for (q = 0; q < sve_vq_from_vl(ms->vl); q++) { + if (ms->zregs[i][q] != as->zregs[i][q]) { + fprintf(f, "%sq%02d: %016" PRIx64 "%016" PRIx64 + " vs %016" PRIx64 "%016" PRIx64"\n", pad, q, + (uint64_t) (ms->zregs[i][q] >> 64), + (uint64_t) ms->zregs[i][q], + (uint64_t) (as->zregs[i][q] >> 64), + (uint64_t) as->zregs[i][q]); + pad = " "; + } + } + } + } + + return !ferror(f); + } +#endif + for (i = 0; i < 32; i++) { if (m->simd.vregs[i] != a->simd.vregs[i]) { fprintf(f, " V%-2d : "