From patchwork Tue Mar 17 16:36:10 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 184634 Delivered-To: patch@linaro.org Received: by 2002:a92:1f12:0:0:0:0:0 with SMTP id i18csp4370522ile; Tue, 17 Mar 2020 09:53:27 -0700 (PDT) X-Google-Smtp-Source: ADFU+vup50xNJZ+g8KwB75btwIYRLUAKii8p3Lxfgo8pclCsdb6XNEWVyRvZQVyMg7CWFN9nxcOF X-Received: by 2002:ac8:76d5:: with SMTP id q21mr63986qtr.202.1584464006989; Tue, 17 Mar 2020 09:53:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1584464006; cv=none; d=google.com; s=arc-20160816; b=r4TCzhKmTSvxqUBnpdwxKpBVDFezBW0xah1FF5DBO+3Y0YMK7iRpr1hni5a4XRAb1R dtlk8lBPEScMvD0NBRo6Q15ikNoZPdEZukouqlegvd5+r+1Ch3yEWR9CymhI/TMo7M+P EIMwt56WqPQQiDJl9AxwUR9EuqOgidoLAY17ZiuarcMW85uCclO5O1kvPeY52ymHtIFj gqzRB8KvEDSbKt2XWdlI6nhIeC5YxMTBauSIm8gPNVyPcG2NBX6hQ8TXD4NdRexHWJGg Rgt1CS0DxNXIlsrr2ZllA1adBFxJHpf6AdoLduYVtog5z/Rlc58ylECxisNYU0xcdpH2 u+Cw== 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:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=8H31Kuq83wCqOybbZslqXDuQ3rjWt6eVyrdWP3O9Tt4=; b=AX/osaYjFy5NFQWWJ7mf5N6fKCwzwPkTSgbsLb/kVrBckv0Gp8fCMY6L6Sg8Ia0LHP UELwi0owVNZLs4+wNrfzVpaYCv5Qwv2Kf/1JshHl6mVapXSHsnkOOPBBklbLWpLS9Wi5 BjDJ0B0DYKvOXg8/rfoPI5O3kDU99Eye9Ro1rRTIDa1pL+EiMZq6B17yP+FfxJ93AWig A1cilPETvdZaGu0WGtfUuaDQEbKWzY7QSie4NFI+9WGErvsWRUDiYsAzMeeEof5o8A74 giqo+LdKxJBMEOfwq5qfN947v6ZCDpBSEMxJSFuANs/UHSGDrrYuSuMEZv+sJMzcrmjm P2hA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=Zj05tBN4; 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=fail (p=NONE sp=NONE dis=NONE) header.from=amsat.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id d3si2221549qti.145.2020.03.17.09.53.26 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 17 Mar 2020 09:53:26 -0700 (PDT) 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=fail header.i=@gmail.com header.s=20161025 header.b=Zj05tBN4; 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=fail (p=NONE sp=NONE dis=NONE) header.from=amsat.org Received: from localhost ([::1]:36906 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jEFT4-00049p-DQ for patch@linaro.org; Tue, 17 Mar 2020 12:53:26 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:35860) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jEFCh-0003oo-EL for qemu-devel@nongnu.org; Tue, 17 Mar 2020 12:36:33 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1jEFCf-0003RF-GJ for qemu-devel@nongnu.org; Tue, 17 Mar 2020 12:36:31 -0400 Received: from mail-wm1-x333.google.com ([2a00:1450:4864:20::333]:36768) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1jEFCf-0003HF-7p for qemu-devel@nongnu.org; Tue, 17 Mar 2020 12:36:29 -0400 Received: by mail-wm1-x333.google.com with SMTP id g62so22780941wme.1 for ; Tue, 17 Mar 2020 09:36:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=8H31Kuq83wCqOybbZslqXDuQ3rjWt6eVyrdWP3O9Tt4=; b=Zj05tBN4m1B4KoT/wmoCrgGzodfDvKiFchX1wty7xjDCPM0uPocYEnMz/0B6upbJ8L 3cu1MKBTxB7ZDDR7CQPRuxskHBeO+I//ZKmbGnzKwsVN/0qa0HHel1vOa24rOQZommhv i7zaA5vEnEbYO86U0CD/dJdEECs/cEBBt5GZYWKX9txQmhjesBNLex539bWcDQ7t0BhA 8DM9+Mx4HTgUhtUJvrOheAF/5QW17VL3GirbAJWNE5wjzIIrx/EiykMw9vhELjSSOCza ODpl/L9HGNM1rmRtj/F1wJwcUhAPAaGVdSZopEu3Sj9ID/OCEk4wwilVbk3dai33Hv/m GBVg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=8H31Kuq83wCqOybbZslqXDuQ3rjWt6eVyrdWP3O9Tt4=; b=K57AOkY9m0BCxFUqEE8Vz6NvzOyy9JcpbHEUWgzIeontwjbX+uPOPpZwClgclK6N5W T43/CcspSrJxmPdDkhrJ4I8FITjfBcZ5tA7VkC1+uUGusNsiG6C8bnPqnn0bAK/b6Mwp UgYKEoLy4sV4CTzRMa+DFtjP0ggUBRQnxFD3DMC0LK84i7z9H2pXkrOjaKp0hHbYBLKs ++zKsd+rfA7npYX90lhEDXSpyQCZpVfXIr8oKBuOnoqpIMulBWqyOLV/G4rS0nZmSj0k FsYXPHmTMGEzYObEwdjnGtcYXnbCjFlwIdX/30anyZYMYocLELrggHj1rtQSWEFKlZb9 U50w== X-Gm-Message-State: ANhLgQ1J4JymtEPAQFI2GcCqn70SxfqSMO45CP6n44pOBjXKd4POCfGV roQQclyou4u6p8h/9pb/bOTiZj/Q X-Received: by 2002:a7b:c854:: with SMTP id c20mr120961wml.99.1584462987441; Tue, 17 Mar 2020 09:36:27 -0700 (PDT) Received: from x1w.redhat.com (96.red-83-59-163.dynamicip.rima-tde.net. [83.59.163.96]) by smtp.gmail.com with ESMTPSA id b202sm4618697wmd.15.2020.03.17.09.36.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 17 Mar 2020 09:36:26 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Subject: [PULL 07/13] target/rx: Disassemble rx_index_addr into a string Date: Tue, 17 Mar 2020 17:36:10 +0100 Message-Id: <20200317163616.30027-8-f4bug@amsat.org> X-Mailer: git-send-email 2.21.1 In-Reply-To: <20200317163616.30027-1-f4bug@amsat.org> References: <20200317163616.30027-1-f4bug@amsat.org> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::333 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Richard Henderson , =?utf-8?q?Philippe_?= =?utf-8?q?Mathieu-Daud=C3=A9?= , Yoshinori Sato , Richard Henderson Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Richard Henderson We were eliding all zero indexes. It is only ld==0 that does not have an index in the instruction. This also allows us to avoid breaking the final print into multiple pieces. Reviewed-by: Yoshinori Sato Tested-by: Philippe Mathieu-Daudé Signed-off-by: Richard Henderson Message-Id: <20190531134315.4109-19-richard.henderson@linaro.org> Acked-by: Richard Henderson Signed-off-by: Philippe Mathieu-Daudé --- target/rx/disas.c | 154 +++++++++++++++++----------------------------- 1 file changed, 55 insertions(+), 99 deletions(-) -- 2.21.1 diff --git a/target/rx/disas.c b/target/rx/disas.c index 04cdfdc567..7abb53d776 100644 --- a/target/rx/disas.c +++ b/target/rx/disas.c @@ -107,49 +107,42 @@ static const char psw[] = { 'i', 'u', 0, 0, 0, 0, 0, 0, }; -static uint32_t rx_index_addr(int ld, int size, DisasContext *ctx) +static void rx_index_addr(DisasContext *ctx, char out[8], int ld, int mi) { - bfd_byte buf[2]; + uint32_t addr = ctx->addr; + uint8_t buf[2]; + uint16_t dsp; + switch (ld) { case 0: - return 0; + /* No index; return empty string. */ + out[0] = '\0'; + return; case 1: - ctx->dis->read_memory_func(ctx->addr, buf, 1, ctx->dis); ctx->addr += 1; - return ((uint8_t)buf[0]) << size; + ctx->dis->read_memory_func(addr, buf, 1, ctx->dis); + dsp = buf[0]; + break; case 2: - ctx->dis->read_memory_func(ctx->addr, buf, 2, ctx->dis); ctx->addr += 2; - return lduw_le_p(buf) << size; + ctx->dis->read_memory_func(addr, buf, 2, ctx->dis); + dsp = lduw_le_p(buf); + break; + default: + g_assert_not_reached(); } - g_assert_not_reached(); + + sprintf(out, "%u", dsp << (mi < 3 ? mi : 4 - mi)); } static void operand(DisasContext *ctx, int ld, int mi, int rs, int rd) { - int dsp; static const char sizes[][4] = {".b", ".w", ".l", ".uw", ".ub"}; + char dsp[8]; + if (ld < 3) { - switch (mi) { - case 4: - /* dsp[rs].ub */ - dsp = rx_index_addr(ld, RX_MEMORY_BYTE, ctx); - break; - case 3: - /* dsp[rs].uw */ - dsp = rx_index_addr(ld, RX_MEMORY_WORD, ctx); - break; - default: - /* dsp[rs].b */ - /* dsp[rs].w */ - /* dsp[rs].l */ - dsp = rx_index_addr(ld, mi, ctx); - break; - } - if (dsp > 0) { - prt("%d", dsp); - } - prt("[r%d]%s", rs, sizes[mi]); + rx_index_addr(ctx, dsp, ld, mi); + prt("%s[r%d]%s", dsp, rs, sizes[mi]); } else { prt("r%d", rs); } @@ -235,7 +228,7 @@ static bool trans_MOV_ra(DisasContext *ctx, arg_MOV_ra *a) /* mov.[bwl] rs,rd */ static bool trans_MOV_mm(DisasContext *ctx, arg_MOV_mm *a) { - int dsp; + char dspd[8], dsps[8]; prt("mov.%c\t", size[a->sz]); if (a->lds == 3 && a->ldd == 3) { @@ -244,29 +237,15 @@ static bool trans_MOV_mm(DisasContext *ctx, arg_MOV_mm *a) return true; } if (a->lds == 3) { - prt("r%d, ", a->rd); - dsp = rx_index_addr(a->ldd, a->sz, ctx); - if (dsp > 0) { - prt("%d", dsp); - } - prt("[r%d]", a->rs); + rx_index_addr(ctx, dspd, a->ldd, a->sz); + prt("r%d, %s[r%d]", a->rs, dspd, a->rd); } else if (a->ldd == 3) { - dsp = rx_index_addr(a->lds, a->sz, ctx); - if (dsp > 0) { - prt("%d", dsp); - } - prt("[r%d], r%d", a->rs, a->rd); + rx_index_addr(ctx, dsps, a->lds, a->sz); + prt("%s[r%d], r%d", dsps, a->rs, a->rd); } else { - dsp = rx_index_addr(a->lds, a->sz, ctx); - if (dsp > 0) { - prt("%d", dsp); - } - prt("[r%d], ", a->rs); - dsp = rx_index_addr(a->ldd, a->sz, ctx); - if (dsp > 0) { - prt("%d", dsp); - } - prt("[r%d]", a->rd); + rx_index_addr(ctx, dsps, a->lds, a->sz); + rx_index_addr(ctx, dspd, a->ldd, a->sz); + prt("%s[r%d], %s[r%d]", dsps, a->rs, dspd, a->rd); } return true; } @@ -357,12 +336,10 @@ static bool trans_PUSH_r(DisasContext *ctx, arg_PUSH_r *a) /* push dsp[rs] */ static bool trans_PUSH_m(DisasContext *ctx, arg_PUSH_m *a) { - prt("push\t"); - int dsp = rx_index_addr(a->ld, a->sz, ctx); - if (dsp > 0) { - prt("%d", dsp); - } - prt("[r%d]", a->rs); + char dsp[8]; + + rx_index_addr(ctx, dsp, a->ld, a->sz); + prt("push\t%s[r%d]", dsp, a->rs); return true; } @@ -389,17 +366,13 @@ static bool trans_XCHG_rr(DisasContext *ctx, arg_XCHG_rr *a) /* xchg dsp[rs].,rd */ static bool trans_XCHG_mr(DisasContext *ctx, arg_XCHG_mr *a) { - int dsp; static const char msize[][4] = { "b", "w", "l", "ub", "uw", }; + char dsp[8]; - prt("xchg\t"); - dsp = rx_index_addr(a->ld, a->mi, ctx); - if (dsp > 0) { - prt("%d", dsp); - } - prt("[r%d].%s, r%d", a->rs, msize[a->mi], a->rd); + rx_index_addr(ctx, dsp, a->ld, a->mi); + prt("xchg\t%s[r%d].%s, r%d", dsp, a->rs, msize[a->mi], a->rd); return true; } @@ -552,13 +525,10 @@ static bool trans_ADC_rr(DisasContext *ctx, arg_ADC_rr *a) /* adc dsp[rs], rd */ static bool trans_ADC_mr(DisasContext *ctx, arg_ADC_mr *a) { - int dsp; - prt("adc\t"); - dsp = rx_index_addr(a->ld, 2, ctx); - if (dsp > 0) { - prt("%d", dsp); - } - prt("[r%d], r%d", a->rs, a->rd); + char dsp[8]; + + rx_index_addr(ctx, dsp, a->ld, 2); + prt("adc\t%s[r%d], r%d", dsp, a->rs, a->rd); return true; } @@ -1217,25 +1187,17 @@ static bool trans_ITOF(DisasContext *ctx, arg_ITOF *a) #define BOP_IM(name, reg) \ do { \ - int dsp; \ - prt("b%s\t#%d, ", #name, a->imm); \ - dsp = rx_index_addr(a->ld, RX_MEMORY_BYTE, ctx); \ - if (dsp > 0) { \ - prt("%d", dsp); \ - } \ - prt("[r%d]", reg); \ + char dsp[8]; \ + rx_index_addr(ctx, dsp, a->ld, RX_MEMORY_BYTE); \ + prt("b%s\t#%d, %s[r%d]", #name, a->imm, dsp, reg); \ return true; \ } while (0) #define BOP_RM(name) \ do { \ - int dsp; \ - prt("b%s\tr%d, ", #name, a->rd); \ - dsp = rx_index_addr(a->ld, RX_MEMORY_BYTE, ctx); \ - if (dsp > 0) { \ - prt("%d", dsp); \ - } \ - prt("[r%d]", a->rs); \ + char dsp[8]; \ + rx_index_addr(ctx, dsp, a->ld, RX_MEMORY_BYTE); \ + prt("b%s\tr%d, %s[r%d]", #name, a->rd, dsp, a->rs); \ return true; \ } while (0) @@ -1346,12 +1308,10 @@ static bool trans_BNOT_ir(DisasContext *ctx, arg_BNOT_ir *a) /* bmcond #imm, dsp[rd] */ static bool trans_BMCnd_im(DisasContext *ctx, arg_BMCnd_im *a) { - int dsp = rx_index_addr(a->ld, RX_MEMORY_BYTE, ctx); - prt("bm%s\t#%d, ", cond[a->cd], a->imm); - if (dsp > 0) { - prt("%d", dsp); - } - prt("[%d]", a->rd); + char dsp[8]; + + rx_index_addr(ctx, dsp, a->ld, RX_MEMORY_BYTE); + prt("bm%s\t#%d, %s[r%d]", cond[a->cd], a->imm, dsp, a->rd); return true; } @@ -1443,16 +1403,12 @@ static bool trans_WAIT(DisasContext *ctx, arg_WAIT *a) /* sccnd.[bwl] dsp:[rd] */ static bool trans_SCCnd(DisasContext *ctx, arg_SCCnd *a) { - int dsp; - prt("sc%s.%c\t", cond[a->cd], size[a->sz]); if (a->ld < 3) { - dsp = rx_index_addr(a->sz, a->ld, ctx); - if (dsp > 0) { - prt("%d", dsp); - } - prt("[r%d]", a->rd); + char dsp[8]; + rx_index_addr(ctx, dsp, a->sz, a->ld); + prt("sc%s.%c\t%s[r%d]", cond[a->cd], size[a->sz], dsp, a->rd); } else { - prt("r%d", a->rd); + prt("sc%s.%c\tr%d", cond[a->cd], size[a->sz], a->rd); } return true; } From patchwork Tue Mar 17 16:36:11 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 184631 Delivered-To: patch@linaro.org Received: by 2002:a92:1f12:0:0:0:0:0 with SMTP id i18csp4365597ile; Tue, 17 Mar 2020 09:48:30 -0700 (PDT) X-Google-Smtp-Source: ADFU+vvYTFXIYmLqbE3xrsQ3Tcd7z1GdNpGOze0MIJ+poM46g52BM1nUhQMsAx60X6FPjuwEg11T X-Received: by 2002:ae9:eb0e:: with SMTP id b14mr5320970qkg.283.1584463710151; Tue, 17 Mar 2020 09:48:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1584463710; cv=none; d=google.com; s=arc-20160816; b=AVjbCgYlPM1BB7/35FM7O8dVDZ79a8YRzwfj90vpnxtx8RkoNn2JUsqDscXfGBoh/J LzjqwEI1Br8DyR1CdyWo/bo0ykV9oQUIQ9qs9KEUyKHCQqtHpXlE0EYW3xBnLARlZRQe 8Dr7zMoekC6RKFmomzhTMLRuItnL+I4EkEqnmqOL4hMz7MGEtNqXXXg8bGRkDi2d/Lzb gjsL/P6VVMrYWKu94KjerZC/zvLJgk8cFnFMlCktM1MxQA5qJuKC+OYbo7e3RNR3GbPd Wds4OMaBgN+TZPO06ymwOvXoJ81QhsPKGQlzO9HJSrMPnRUeJY8xNzog1ixSAiVOYqY7 mdKQ== 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:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=yRLrMiYAa2eSXqh7vxtfwTDgpEpApTWjV4HpUsCvytk=; b=pry7210Y0T20+PN1MJ3pjGPptSGabWnj/v0WeclxP4FBqkRwZw3i8Is3shqP39T/sO x3tZjUiMgPpL6TkeCpphvPWulDY4dm/+EXSONM9sj2PBH5ma98jW0CuA7m3k9mc63vaC TXazof4uaNk+ixPtTR7hdLHmHWZ7gTYJ+U7lCQFIn87wmOShOmiaT4Wpm+gmh9/GR6xJ jS6PnWMSI5lO8Z8LNNiJEZzvpcWW9iwv3sscwg5Ld8LsOiMzsMlxrABC9BJ56rM76H/Y v3j5kCl5dsE+Cn2xcLNC51TcyGhcKKcu5TSshfZOsKnGAxN9PbnawbLlQpJKKTktL51e Fz3Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=YEYR8tnv; 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=fail (p=NONE sp=NONE dis=NONE) header.from=amsat.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id n6si2563035qke.78.2020.03.17.09.48.30 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 17 Mar 2020 09:48:30 -0700 (PDT) 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=fail header.i=@gmail.com header.s=20161025 header.b=YEYR8tnv; 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=fail (p=NONE sp=NONE dis=NONE) header.from=amsat.org Received: from localhost ([::1]:36816 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jEFOH-0004ax-LH for patch@linaro.org; Tue, 17 Mar 2020 12:48:29 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:35927) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jEFCk-0003tm-2g for qemu-devel@nongnu.org; Tue, 17 Mar 2020 12:36:36 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1jEFCh-0003hI-L6 for qemu-devel@nongnu.org; Tue, 17 Mar 2020 12:36:33 -0400 Received: from mail-wr1-x444.google.com ([2a00:1450:4864:20::444]:42011) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1jEFCh-0003XH-CQ for qemu-devel@nongnu.org; Tue, 17 Mar 2020 12:36:31 -0400 Received: by mail-wr1-x444.google.com with SMTP id v11so26605327wrm.9 for ; Tue, 17 Mar 2020 09:36:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=yRLrMiYAa2eSXqh7vxtfwTDgpEpApTWjV4HpUsCvytk=; b=YEYR8tnviBuxO41FtcOcuqykOcPhpqXEmGWkSIIFaw/DNoa61/uzYKSEOKTgoq/xe2 6wtTT3MpOSJcyYzfIXgQjc0WJ4DXqpSgXuK81+EliIImM4QfBaO5SOGtGL1+YCniPUBc uXxw3NfeAYmm+YkEgJxifuptTJH9C9mWIWkqeQYVwV7VTPuVZbtS76k1uEFLlh0fe3AM e1bDQUByRq4ZvoEsDa0wOwfZurNl3PFtighH4l4nwQS0/PQ+m5qnI0KbkWcYLWy+MvP6 ENSob6d0Nsemhl7GyEf+ORhuI3Jr23p4+dmNO/hoYy5PQvJGTD4IqtqxZAJPiKiZ4rqs vrcg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=yRLrMiYAa2eSXqh7vxtfwTDgpEpApTWjV4HpUsCvytk=; b=fCW6uDTR4TBbtNQoi+KhZS8LsmGNZcAyIqSt0bxZsMevap9TBObNxx0YNqLIUW7wt9 tMIFdlKl9Cm+ObWD88w2eHnwFtWz0kZoKUAvoZtxkhrXMbQE1kO/sQeMN2XQ8UtT5w2R IsHvdbB36VHMNjK3YCO+1B7i0anYAitUTF1uIVpfI0g9DTlQP3LrEbj8KQiwk2HBUI5/ zpXhWScu6kBuLI0CBVVwTYND4Zrx60JjbeIiCVHZlItpBn/TmdvKo3lDFKALIcFMYP0f ZM+Au1rgyICifyof3QJ9lzeBCa4lzc7AYeOeKvf0quAI2c00X8coDOfmG6rLx4H1lQBR eygQ== X-Gm-Message-State: ANhLgQ0kSqMAAZByTONzsnSvFyod4G3jRXrrZosmxsg8CNZUJSWbT6eZ RonefMR+YwpAmtaxX7eNccf1gW+Y X-Received: by 2002:adf:dc90:: with SMTP id r16mr6155143wrj.338.1584462988630; Tue, 17 Mar 2020 09:36:28 -0700 (PDT) Received: from x1w.redhat.com (96.red-83-59-163.dynamicip.rima-tde.net. [83.59.163.96]) by smtp.gmail.com with ESMTPSA id b202sm4618697wmd.15.2020.03.17.09.36.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 17 Mar 2020 09:36:27 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Subject: [PULL 08/13] target/rx: Replace operand with prt_ldmi in disassembler Date: Tue, 17 Mar 2020 17:36:11 +0100 Message-Id: <20200317163616.30027-9-f4bug@amsat.org> X-Mailer: git-send-email 2.21.1 In-Reply-To: <20200317163616.30027-1-f4bug@amsat.org> References: <20200317163616.30027-1-f4bug@amsat.org> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::444 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Richard Henderson , =?utf-8?q?Philippe_?= =?utf-8?q?Mathieu-Daud=C3=A9?= , Yoshinori Sato , Richard Henderson Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Richard Henderson This has consistency with prt_ri(). It loads all data before beginning output. It uses exactly one call to prt() to emit the full instruction. Reviewed-by: Philippe Mathieu-Daudé Reviewed-by: Yoshinori Sato Tested-by: Philippe Mathieu-Daudé Signed-off-by: Richard Henderson Message-Id: <20190531134315.4109-20-richard.henderson@linaro.org> Acked-by: Richard Henderson Signed-off-by: Philippe Mathieu-Daudé --- target/rx/disas.c | 77 +++++++++++++++++------------------------------ 1 file changed, 27 insertions(+), 50 deletions(-) -- 2.21.1 diff --git a/target/rx/disas.c b/target/rx/disas.c index 7abb53d776..0c4115669d 100644 --- a/target/rx/disas.c +++ b/target/rx/disas.c @@ -135,18 +135,18 @@ static void rx_index_addr(DisasContext *ctx, char out[8], int ld, int mi) sprintf(out, "%u", dsp << (mi < 3 ? mi : 4 - mi)); } -static void operand(DisasContext *ctx, int ld, int mi, int rs, int rd) +static void prt_ldmi(DisasContext *ctx, const char *insn, + int ld, int mi, int rs, int rd) { static const char sizes[][4] = {".b", ".w", ".l", ".uw", ".ub"}; char dsp[8]; if (ld < 3) { rx_index_addr(ctx, dsp, ld, mi); - prt("%s[r%d]%s", dsp, rs, sizes[mi]); + prt("%s\t%s[r%d]%s, r%d", insn, dsp, rs, sizes[mi], rd); } else { - prt("r%d", rs); + prt("%s\tr%d, r%d", insn, rs, rd); } - prt(", r%d", rd); } static void prt_ir(DisasContext *ctx, const char *insn, int imm, int rd) @@ -416,8 +416,7 @@ static bool trans_AND_ir(DisasContext *ctx, arg_AND_ir *a) /* and rs,rd */ static bool trans_AND_mr(DisasContext *ctx, arg_AND_mr *a) { - prt("and\t"); - operand(ctx, a->ld, a->mi, a->rs, a->rd); + prt_ldmi(ctx, "and", a->ld, a->mi, a->rs, a->rd); return true; } @@ -440,8 +439,7 @@ static bool trans_OR_ir(DisasContext *ctx, arg_OR_ir *a) /* or rs,rd */ static bool trans_OR_mr(DisasContext *ctx, arg_OR_mr *a) { - prt("or\t"); - operand(ctx, a->ld, a->mi, a->rs, a->rd); + prt_ldmi(ctx, "or", a->ld, a->mi, a->rs, a->rd); return true; } @@ -463,8 +461,7 @@ static bool trans_XOR_ir(DisasContext *ctx, arg_XOR_ir *a) /* xor rs,rd */ static bool trans_XOR_mr(DisasContext *ctx, arg_XOR_mr *a) { - prt("xor\t"); - operand(ctx, a->ld, a->mi, a->rs, a->rd); + prt_ldmi(ctx, "xor", a->ld, a->mi, a->rs, a->rd); return true; } @@ -479,8 +476,7 @@ static bool trans_TST_ir(DisasContext *ctx, arg_TST_ir *a) /* tst rs, rd */ static bool trans_TST_mr(DisasContext *ctx, arg_TST_mr *a) { - prt("tst\t"); - operand(ctx, a->ld, a->mi, a->rs, a->rd); + prt_ldmi(ctx, "tst", a->ld, a->mi, a->rs, a->rd); return true; } @@ -548,8 +544,7 @@ static bool trans_ADD_irr(DisasContext *ctx, arg_ADD_irr *a) /* add dsp[rs], rd */ static bool trans_ADD_mr(DisasContext *ctx, arg_ADD_mr *a) { - prt("add\t"); - operand(ctx, a->ld, a->mi, a->rs, a->rd); + prt_ldmi(ctx, "add", a->ld, a->mi, a->rs, a->rd); return true; } @@ -573,8 +568,7 @@ static bool trans_CMP_ir(DisasContext *ctx, arg_CMP_ir *a) /* cmp dsp[rs], rs2 */ static bool trans_CMP_mr(DisasContext *ctx, arg_CMP_mr *a) { - prt("cmp\t"); - operand(ctx, a->ld, a->mi, a->rs, a->rd); + prt_ldmi(ctx, "cmp", a->ld, a->mi, a->rs, a->rd); return true; } @@ -589,8 +583,7 @@ static bool trans_SUB_ir(DisasContext *ctx, arg_SUB_ir *a) /* sub dsp[rs], rd */ static bool trans_SUB_mr(DisasContext *ctx, arg_SUB_mr *a) { - prt("sub\t"); - operand(ctx, a->ld, a->mi, a->rs, a->rd); + prt_ldmi(ctx, "sub", a->ld, a->mi, a->rs, a->rd); return true; } @@ -611,8 +604,7 @@ static bool trans_SBB_rr(DisasContext *ctx, arg_SBB_rr *a) /* sbb dsp[rs], rd */ static bool trans_SBB_mr(DisasContext *ctx, arg_SBB_mr *a) { - prt("sbb\t"); - operand(ctx, a->ld, RX_IM_LONG, a->rs, a->rd); + prt_ldmi(ctx, "sbb", a->ld, RX_IM_LONG, a->rs, a->rd); return true; } @@ -640,8 +632,7 @@ static bool trans_MAX_ir(DisasContext *ctx, arg_MAX_ir *a) /* max dsp[rs], rd */ static bool trans_MAX_mr(DisasContext *ctx, arg_MAX_mr *a) { - prt("max\t"); - operand(ctx, a->ld, a->mi, a->rs, a->rd); + prt_ldmi(ctx, "max", a->ld, a->mi, a->rs, a->rd); return true; } @@ -656,8 +647,7 @@ static bool trans_MIN_ir(DisasContext *ctx, arg_MIN_ir *a) /* min dsp[rs], rd */ static bool trans_MIN_mr(DisasContext *ctx, arg_MIN_mr *a) { - prt("max\t"); - operand(ctx, a->ld, a->mi, a->rs, a->rd); + prt_ldmi(ctx, "min", a->ld, a->mi, a->rs, a->rd); return true; } @@ -673,8 +663,7 @@ static bool trans_MUL_ir(DisasContext *ctx, arg_MUL_ir *a) /* mul dsp[rs], rd */ static bool trans_MUL_mr(DisasContext *ctx, arg_MUL_mr *a) { - prt("mul\t"); - operand(ctx, a->ld, a->mi, a->rs, a->rd); + prt_ldmi(ctx, "mul", a->ld, a->mi, a->rs, a->rd); return true; } @@ -696,8 +685,7 @@ static bool trans_EMUL_ir(DisasContext *ctx, arg_EMUL_ir *a) /* emul dsp[rs], rd */ static bool trans_EMUL_mr(DisasContext *ctx, arg_EMUL_mr *a) { - prt("emul\t"); - operand(ctx, a->ld, a->mi, a->rs, a->rd); + prt_ldmi(ctx, "emul", a->ld, a->mi, a->rs, a->rd); return true; } @@ -712,8 +700,7 @@ static bool trans_EMULU_ir(DisasContext *ctx, arg_EMULU_ir *a) /* emulu dsp[rs], rd */ static bool trans_EMULU_mr(DisasContext *ctx, arg_EMULU_mr *a) { - prt("emulu\t"); - operand(ctx, a->ld, a->mi, a->rs, a->rd); + prt_ldmi(ctx, "emulu", a->ld, a->mi, a->rs, a->rd); return true; } @@ -728,8 +715,7 @@ static bool trans_DIV_ir(DisasContext *ctx, arg_DIV_ir *a) /* div dsp[rs], rd */ static bool trans_DIV_mr(DisasContext *ctx, arg_DIV_mr *a) { - prt("div\t"); - operand(ctx, a->ld, a->mi, a->rs, a->rd); + prt_ldmi(ctx, "div", a->ld, a->mi, a->rs, a->rd); return true; } @@ -744,8 +730,7 @@ static bool trans_DIVU_ir(DisasContext *ctx, arg_DIVU_ir *a) /* divu dsp[rs], rd */ static bool trans_DIVU_mr(DisasContext *ctx, arg_DIVU_mr *a) { - prt("divu\t"); - operand(ctx, a->ld, a->mi, a->rs, a->rd); + prt_ldmi(ctx, "divu", a->ld, a->mi, a->rs, a->rd); return true; } @@ -1089,8 +1074,7 @@ static bool trans_FADD_ir(DisasContext *ctx, arg_FADD_ir *a) /* fadd rs, rd */ static bool trans_FADD_mr(DisasContext *ctx, arg_FADD_mr *a) { - prt("fadd\t"); - operand(ctx, a->ld, RX_IM_LONG, a->rs, a->rd); + prt_ldmi(ctx, "fadd", a->ld, RX_IM_LONG, a->rs, a->rd); return true; } @@ -1105,8 +1089,7 @@ static bool trans_FCMP_ir(DisasContext *ctx, arg_FCMP_ir *a) /* fcmp rs, rd */ static bool trans_FCMP_mr(DisasContext *ctx, arg_FCMP_mr *a) { - prt("fcmp\t"); - operand(ctx, a->ld, RX_IM_LONG, a->rs, a->rd); + prt_ldmi(ctx, "fcmp", a->ld, RX_IM_LONG, a->rs, a->rd); return true; } @@ -1121,8 +1104,7 @@ static bool trans_FSUB_ir(DisasContext *ctx, arg_FSUB_ir *a) /* fsub rs, rd */ static bool trans_FSUB_mr(DisasContext *ctx, arg_FSUB_mr *a) { - prt("fsub\t"); - operand(ctx, a->ld, RX_IM_LONG, a->rs, a->rd); + prt_ldmi(ctx, "fsub", a->ld, RX_IM_LONG, a->rs, a->rd); return true; } @@ -1130,8 +1112,7 @@ static bool trans_FSUB_mr(DisasContext *ctx, arg_FSUB_mr *a) /* ftoi rs, rd */ static bool trans_FTOI(DisasContext *ctx, arg_FTOI *a) { - prt("ftoi\t"); - operand(ctx, a->ld, RX_IM_LONG, a->rs, a->rd); + prt_ldmi(ctx, "ftoi", a->ld, RX_IM_LONG, a->rs, a->rd); return true; } @@ -1146,8 +1127,7 @@ static bool trans_FMUL_ir(DisasContext *ctx, arg_FMUL_ir *a) /* fmul rs, rd */ static bool trans_FMUL_mr(DisasContext *ctx, arg_FMUL_mr *a) { - prt("fmul\t"); - operand(ctx, a->ld, RX_IM_LONG, a->rs, a->rd); + prt_ldmi(ctx, "fmul", a->ld, RX_IM_LONG, a->rs, a->rd); return true; } @@ -1162,8 +1142,7 @@ static bool trans_FDIV_ir(DisasContext *ctx, arg_FDIV_ir *a) /* fdiv rs, rd */ static bool trans_FDIV_mr(DisasContext *ctx, arg_FDIV_mr *a) { - prt("fdiv\t"); - operand(ctx, a->ld, RX_IM_LONG, a->rs, a->rd); + prt_ldmi(ctx, "fdiv", a->ld, RX_IM_LONG, a->rs, a->rd); return true; } @@ -1171,8 +1150,7 @@ static bool trans_FDIV_mr(DisasContext *ctx, arg_FDIV_mr *a) /* round rs, rd */ static bool trans_ROUND(DisasContext *ctx, arg_ROUND *a) { - prt("round\t"); - operand(ctx, a->ld, RX_IM_LONG, a->rs, a->rd); + prt_ldmi(ctx, "round", a->ld, RX_IM_LONG, a->rs, a->rd); return true; } @@ -1180,8 +1158,7 @@ static bool trans_ROUND(DisasContext *ctx, arg_ROUND *a) /* itof dsp[rs], rd */ static bool trans_ITOF(DisasContext *ctx, arg_ITOF *a) { - prt("itof\t"); - operand(ctx, a->ld, RX_IM_LONG, a->rs, a->rd); + prt_ldmi(ctx, "itof", a->ld, RX_IM_LONG, a->rs, a->rd); return true; } From patchwork Tue Mar 17 16:36:12 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 184632 Delivered-To: patch@linaro.org Received: by 2002:a92:1f12:0:0:0:0:0 with SMTP id i18csp4365952ile; Tue, 17 Mar 2020 09:48:52 -0700 (PDT) X-Google-Smtp-Source: ADFU+vtQqKYfbRRSuYyNZVSuF9TwQwgv+P4gAiDU4Ud6PcLMbvMR1J+rZKaXA4vXZHqTYFXtm4/Y X-Received: by 2002:a05:620a:12f9:: with SMTP id f25mr6066345qkl.370.1584463732291; Tue, 17 Mar 2020 09:48:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1584463732; cv=none; d=google.com; s=arc-20160816; b=iQ0E14Orvsp1TCQGwkbD8OqsNyNfvV/D4DulldysHHHeqCAl59Wy0YIYpYwR6tQU3z x1khI+rfnVso68iwhDdkLj/8p7+LHJxp9HJdNYiE5TngDK7mBa5V/a58cb6E8fOj7e8D YUzQdnJS9TjCCOXwUH/n2xSvkDNSrobDyHTuK88oW6H0h+mf40p5rXmKtFriInDC9/SQ bCs8NZfQ1Jz5oalfDW0oL18jvljgTjeEWZgiv+/B6G60NbPuD4Dy+c3/NxDrCoQucN2N NkDLN+ifx1mz5XikxGafxWQIu4WU4gtbmmzg/KbZVcWgZO2c7NOH1yDoIXrtCh12zjAC lEow== 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:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=1enKsIBdEviq5nykP6LOEgZbSgk5slEBebWoM6e6JJM=; b=TpUL3z+Fc8XdJHR3wyPV2LLAOF19SZciWj2imB41itnXs/a9stSmjW5lsBfv/46b7s VrTYJsV7yRwmlByGMWt4NkoZlPxOaiUztD9CtBMlRA0XUEzD4bHlPKHpIo9w3tT30fW/ rPFrkWQNGmGe/1Q8X9AYJOK5GsQZJXUtySzk6NpdAuBOS3TbRvP6gnZjr+/TJOlzTz1h tClrOkjAiqhlmRDN3cmno0JFzRleQ8k95WFLnYfqL7FQWRKt8X24rbGQNomjMQw/0yMw 8ekdfP393/TotT4ZklS0iiZfGYIqrHnCAj2V+x1gEw/7AFkm5MZUMplzaU0KlAN5CuHd eXfg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=Lhu1xL46; 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=fail (p=NONE sp=NONE dis=NONE) header.from=amsat.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id ep10si2081590qvb.115.2020.03.17.09.48.52 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 17 Mar 2020 09:48:52 -0700 (PDT) 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=fail header.i=@gmail.com header.s=20161025 header.b=Lhu1xL46; 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=fail (p=NONE sp=NONE dis=NONE) header.from=amsat.org Received: from localhost ([::1]:36822 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jEFOd-0005H2-OC for patch@linaro.org; Tue, 17 Mar 2020 12:48:51 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:35922) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jEFCj-0003tK-R2 for qemu-devel@nongnu.org; Tue, 17 Mar 2020 12:36:36 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1jEFCi-0003ml-HG for qemu-devel@nongnu.org; Tue, 17 Mar 2020 12:36:33 -0400 Received: from mail-wr1-x42d.google.com ([2a00:1450:4864:20::42d]:39201) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1jEFCi-0003ge-9m for qemu-devel@nongnu.org; Tue, 17 Mar 2020 12:36:32 -0400 Received: by mail-wr1-x42d.google.com with SMTP id h6so6221560wrs.6 for ; Tue, 17 Mar 2020 09:36:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=1enKsIBdEviq5nykP6LOEgZbSgk5slEBebWoM6e6JJM=; b=Lhu1xL46r5+epPlep0AEbOEjzP7r8OMGtrUbgA9duExYp/Nuc2R/sctwDj64FckOet 620FH2+fM1t/E6ctFqDaoZvhpQJ/r8+dWK8wbSv9q4fHNe1mnMsXZ4EeA9t+1b4yt+wb vwe2RqYpEmUJDOJp42eZ/8dK8I+vQaExsBPV7UMo+cSfTCIYtGpelxg43xNBaE2Mjs0A LHZn7YNpztvSIpx/B/KaWHKHq6Sb8KyPQyfMxRh27jZhFnmyNlsGLw7JEGUQ2LNuy+kR GTkceBV6C6ePaIJ45qOCF0wCwfjn8E72ntCruerJu9YcDduVexi2z8SOZz9V3cBVNSvo 4ejw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=1enKsIBdEviq5nykP6LOEgZbSgk5slEBebWoM6e6JJM=; b=XDe59++A6XIc181msWtarFyHbwC+C3OZGYvYZKpO4EVqwHiRVSUej7jFuOqgzde6Yt m6CKmCT5K5SBGCs5fgWbL/4DOegnBE5lt7R4PCNrkDeInf/oHX119SvP5sXdeF09LhOO oYkN4ihu3j3Jz+tuwc6+UXSflFSwoxXWh0u9R3jPibJuSJB61Jcilyy7feMboxwxBMFV CHjfZutaMr5Y2p7J6fbcfH4jh3aJNqRUfytTw1XHm2lDsnZojZ/rEISsx3aHNl1Wm+iV 6AUkhoJW3N60CdgpC9zj5pyXW31eq0+uc2Sfi3SIEwisio39F7g2uGmDoMSDrNjPL6qn O0mw== X-Gm-Message-State: ANhLgQ1eHNu1Q73vq5eEItKr8YLGhaWasz2L8WCIqf/7ogwoOJYcFAY6 STPKtMh1KNi5X6tISYRdaKAoeQ73 X-Received: by 2002:a5d:4a10:: with SMTP id m16mr6618622wrq.333.1584462990895; Tue, 17 Mar 2020 09:36:30 -0700 (PDT) Received: from x1w.redhat.com (96.red-83-59-163.dynamicip.rima-tde.net. [83.59.163.96]) by smtp.gmail.com with ESMTPSA id b202sm4618697wmd.15.2020.03.17.09.36.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 17 Mar 2020 09:36:29 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Subject: [PULL 09/13] target/rx: Use prt_ldmi for XCHG_mr disassembly Date: Tue, 17 Mar 2020 17:36:12 +0100 Message-Id: <20200317163616.30027-10-f4bug@amsat.org> X-Mailer: git-send-email 2.21.1 In-Reply-To: <20200317163616.30027-1-f4bug@amsat.org> References: <20200317163616.30027-1-f4bug@amsat.org> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::42d X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Richard Henderson , =?utf-8?q?Philippe_?= =?utf-8?q?Mathieu-Daud=C3=A9?= , Yoshinori Sato , Richard Henderson Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Richard Henderson Note that the ld == 3 case handled by prt_ldmi is decoded as XCHG_rr and cannot appear here. Reviewed-by: Philippe Mathieu-Daudé Reviewed-by: Yoshinori Sato Tested-by: Philippe Mathieu-Daudé Signed-off-by: Richard Henderson Message-Id: <20190531134315.4109-21-richard.henderson@linaro.org> Acked-by: Richard Henderson Signed-off-by: Philippe Mathieu-Daudé --- target/rx/disas.c | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) -- 2.21.1 diff --git a/target/rx/disas.c b/target/rx/disas.c index 0c4115669d..a0c444020c 100644 --- a/target/rx/disas.c +++ b/target/rx/disas.c @@ -366,13 +366,7 @@ static bool trans_XCHG_rr(DisasContext *ctx, arg_XCHG_rr *a) /* xchg dsp[rs].,rd */ static bool trans_XCHG_mr(DisasContext *ctx, arg_XCHG_mr *a) { - static const char msize[][4] = { - "b", "w", "l", "ub", "uw", - }; - char dsp[8]; - - rx_index_addr(ctx, dsp, a->ld, a->mi); - prt("xchg\t%s[r%d].%s, r%d", dsp, a->rs, msize[a->mi], a->rd); + prt_ldmi(ctx, "xchg", a->ld, a->mi, a->rs, a->rd); return true; } From patchwork Tue Mar 17 16:36:13 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 184633 Delivered-To: patch@linaro.org Received: by 2002:a92:1f12:0:0:0:0:0 with SMTP id i18csp4366227ile; Tue, 17 Mar 2020 09:49:08 -0700 (PDT) X-Google-Smtp-Source: ADFU+vvtmEjtiCie6Mpu44A/XfA5rrF/k3nDFTV9PDHEGCyxLuMF0QFJal0VKFhACej0RInJp6aV X-Received: by 2002:a0c:e7c3:: with SMTP id c3mr74993qvo.62.1584463747939; Tue, 17 Mar 2020 09:49:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1584463747; cv=none; d=google.com; s=arc-20160816; b=CF5oyheCaDzZQI9GbT2h/n2qMiGkWrsAXHbbQESdeMF8lafxKc5SC+rgMn56EaXLNK w5Q7YLwPs0HSlbNIWjMZu5l0U1n9m8cpL7ZYwZCb3FVffoU2im3dx2blsVo45iYatJwa bbq1u4jh2rTXKvuvgcIrjBq7YXLH7T5TWq6wohqMwP6bVoZCtgMN0chW1GpFXtNnUKNT rEzffnnmS9LD1Zjn3cuwedgcPPeg9eZh7HA+HM1Q5NiFFJNCpQTnpLd1D1CnGINZOKsW 623aPVG/0a8nOlc2V+cMQmH9FIJFep6wwfgP2UuCh68xWFVrGqAod6rhwCVbZeXuHPwh CAHQ== 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:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=Yyb54Z5z/ykNOhXoH1gOKUFqMaavHpOhkHDAz9vguSE=; b=yfXWG3fD7rT9LGIexnreUZ4qT9hHW/Z1N1x4ujklLGKiccPMK1PIxpxI8WCXTBWJht usgkP+m8QnQizrhwnjoGJ3WR+JeJJaP59kRMimIO6wUAb8dv1XqBiP5Fi2baX6ZJAcso M+ueo5aeCd2I0jC78WeJs1nSiM7rQ5XnAPmbvuf967lsReJ6LZrtMITsW3bmUZP1BSLh N1nhn98ySD109dGx5qGqn1wcmNW6A2HrLzn3Y3htW+4a6Cfnr2uQXeGXk5wec/a0yqdN p/WH8YkBxn+qqgMriBNKEdSWI2mad26QW3WpZHqegr2oweu4TQ+B7D61hhhOEKOCQ+A6 pJxw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=XmPpHWY8; 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=fail (p=NONE sp=NONE dis=NONE) header.from=amsat.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id f3si2120042qtc.267.2020.03.17.09.49.07 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 17 Mar 2020 09:49:07 -0700 (PDT) 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=fail header.i=@gmail.com header.s=20161025 header.b=XmPpHWY8; 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=fail (p=NONE sp=NONE dis=NONE) header.from=amsat.org Received: from localhost ([::1]:36824 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jEFOt-0005QS-DZ for patch@linaro.org; Tue, 17 Mar 2020 12:49:07 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:35963) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jEFCl-0003vW-Ur for qemu-devel@nongnu.org; Tue, 17 Mar 2020 12:36:37 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1jEFCk-0003wQ-7T for qemu-devel@nongnu.org; Tue, 17 Mar 2020 12:36:35 -0400 Received: from mail-wm1-x344.google.com ([2a00:1450:4864:20::344]:37371) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1jEFCj-0003p5-VD for qemu-devel@nongnu.org; Tue, 17 Mar 2020 12:36:34 -0400 Received: by mail-wm1-x344.google.com with SMTP id a141so22755406wme.2 for ; Tue, 17 Mar 2020 09:36:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=Yyb54Z5z/ykNOhXoH1gOKUFqMaavHpOhkHDAz9vguSE=; b=XmPpHWY8AVuixOtR7Jk3RVcJQehHWonDGm4s4ahpCkV99AG0nHBngUrUej8ekOScGt 3qFBo2aPFMlgnZVwQAxJLz0De2sqKKVpT3Yo/GilQYizRPs9huD/Tf3EFo+y4X05hPxM xSEiHKtr2OsqPUvSwjPA9XGgHsl0N3S48SwkgdYbuQR2ylolWPliBXUG9fH/MhAdWsDO U1huhqlUFOa8ruyqT7QnLl95GN28Sjg/Gd9X+Uv6ajZww9aB2bsavlOw9/vf7cz6K1M+ Bdnqu9zmYrNTKEqaFrYf/bw4ghy2Kk3BR1PxZaJTcRIQHvQiIfpkdBfI7KVDNpbYKShM upXA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=Yyb54Z5z/ykNOhXoH1gOKUFqMaavHpOhkHDAz9vguSE=; b=RQOePulKvfiFcGgFuat84xFY6v9hkrpLirjuL1GdIXoeeg7ti2yzfo64lE6KgNi+IO m1QwohjRnDsus+MQ0oMRE5jih0hmyACZq7D/k6tFVU+esBzXJa4XJeluu0PQi8lgGbfx uckuFT/yoB+6Gd9V0e0ups32mxxLJdKIBMaIpUdwmkInN5/0ZEhNQZlss71eMfPeaU/3 TnBwoTDoavH23OWkyF5Xg5llbbvHICSgw8MXyK0vbVATpx8OwIIMFnIt1fNPLbtX/8hq 8FjJXuCnXa8p4XnZkxKsKLwRm/rkiOS/T0RUoqfy3/UmxV4BRSngQFpF7c6WS2o9Dx5r zemA== X-Gm-Message-State: ANhLgQ3WdsDRPVg+yNxQ7OLfyfKrHgPIlxRqzeM+O8es4Q6HXKMjJCyM Gj8jeol4dQFPQMwDH7XFsuZGTTP3 X-Received: by 2002:a05:600c:214f:: with SMTP id v15mr169207wml.110.1584462992162; Tue, 17 Mar 2020 09:36:32 -0700 (PDT) Received: from x1w.redhat.com (96.red-83-59-163.dynamicip.rima-tde.net. [83.59.163.96]) by smtp.gmail.com with ESMTPSA id b202sm4618697wmd.15.2020.03.17.09.36.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 17 Mar 2020 09:36:31 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Subject: [PULL 10/13] target/rx: Emit all disassembly in one prt() Date: Tue, 17 Mar 2020 17:36:13 +0100 Message-Id: <20200317163616.30027-11-f4bug@amsat.org> X-Mailer: git-send-email 2.21.1 In-Reply-To: <20200317163616.30027-1-f4bug@amsat.org> References: <20200317163616.30027-1-f4bug@amsat.org> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::344 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Richard Henderson , =?utf-8?q?Philippe_?= =?utf-8?q?Mathieu-Daud=C3=A9?= , Yoshinori Sato , Richard Henderson Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Richard Henderson Many of the multi-part prints have been eliminated by previous patches. Eliminate the rest of them. Reviewed-by: Philippe Mathieu-Daudé Reviewed-by: Yoshinori Sato Tested-by: Philippe Mathieu-Daudé Signed-off-by: Richard Henderson Message-Id: <20190531134315.4109-22-richard.henderson@linaro.org> Acked-by: Richard Henderson Signed-off-by: Philippe Mathieu-Daudé --- target/rx/disas.c | 75 ++++++++++++++++++++++++----------------------- 1 file changed, 39 insertions(+), 36 deletions(-) -- 2.21.1 diff --git a/target/rx/disas.c b/target/rx/disas.c index a0c444020c..814ef97480 100644 --- a/target/rx/disas.c +++ b/target/rx/disas.c @@ -228,24 +228,21 @@ static bool trans_MOV_ra(DisasContext *ctx, arg_MOV_ra *a) /* mov.[bwl] rs,rd */ static bool trans_MOV_mm(DisasContext *ctx, arg_MOV_mm *a) { - char dspd[8], dsps[8]; + char dspd[8], dsps[8], szc = size[a->sz]; - prt("mov.%c\t", size[a->sz]); if (a->lds == 3 && a->ldd == 3) { /* mov.[bwl] rs,rd */ - prt("r%d, r%d", a->rs, a->rd); - return true; - } - if (a->lds == 3) { + prt("mov.%c\tr%d, r%d", szc, a->rs, a->rd); + } else if (a->lds == 3) { rx_index_addr(ctx, dspd, a->ldd, a->sz); - prt("r%d, %s[r%d]", a->rs, dspd, a->rd); + prt("mov.%c\tr%d, %s[r%d]", szc, a->rs, dspd, a->rd); } else if (a->ldd == 3) { rx_index_addr(ctx, dsps, a->lds, a->sz); - prt("%s[r%d], r%d", dsps, a->rs, a->rd); + prt("mov.%c\t%s[r%d], r%d", szc, dsps, a->rs, a->rd); } else { rx_index_addr(ctx, dsps, a->lds, a->sz); rx_index_addr(ctx, dspd, a->ldd, a->sz); - prt("%s[r%d], %s[r%d]", dsps, a->rs, dspd, a->rd); + prt("mov.%c\t%s[r%d], %s[r%d]", szc, dsps, a->rs, dspd, a->rd); } return true; } @@ -254,8 +251,11 @@ static bool trans_MOV_mm(DisasContext *ctx, arg_MOV_mm *a) /* mov.[bwl] rs,[-rd] */ static bool trans_MOV_rp(DisasContext *ctx, arg_MOV_rp *a) { - prt("mov.%c\tr%d, ", size[a->sz], a->rs); - prt((a->ad == 0) ? "[r%d+]" : "[-r%d]", a->rd); + if (a->ad) { + prt("mov.%c\tr%d, [-r%d]", size[a->sz], a->rs, a->rd); + } else { + prt("mov.%c\tr%d, [r%d+]", size[a->sz], a->rs, a->rd); + } return true; } @@ -263,9 +263,11 @@ static bool trans_MOV_rp(DisasContext *ctx, arg_MOV_rp *a) /* mov.[bwl] [-rd],rs */ static bool trans_MOV_pr(DisasContext *ctx, arg_MOV_pr *a) { - prt("mov.%c\t", size[a->sz]); - prt((a->ad == 0) ? "[r%d+]" : "[-r%d]", a->rd); - prt(", r%d", a->rs); + if (a->ad) { + prt("mov.%c\t[-r%d], r%d", size[a->sz], a->rd, a->rs); + } else { + prt("mov.%c\t[r%d+], r%d", size[a->sz], a->rd, a->rs); + } return true; } @@ -299,9 +301,11 @@ static bool trans_MOVU_ar(DisasContext *ctx, arg_MOVU_ar *a) /* movu.[bw] [-rs],rd */ static bool trans_MOVU_pr(DisasContext *ctx, arg_MOVU_pr *a) { - prt("movu.%c\t", size[a->sz]); - prt((a->ad == 0) ? "[r%d+]" : "[-r%d]", a->rd); - prt(", r%d", a->rs); + if (a->ad) { + prt("movu.%c\t[-r%d], r%d", size[a->sz], a->rd, a->rs); + } else { + prt("movu.%c\t[r%d+], r%d", size[a->sz], a->rd, a->rs); + } return true; } @@ -478,11 +482,11 @@ static bool trans_TST_mr(DisasContext *ctx, arg_TST_mr *a) /* not rs, rd */ static bool trans_NOT_rr(DisasContext *ctx, arg_NOT_rr *a) { - prt("not\t"); if (a->rs != a->rd) { - prt("r%d, ", a->rs); + prt("not\tr%d, r%d", a->rs, a->rd); + } else { + prt("not\tr%d", a->rs); } - prt("r%d", a->rd); return true; } @@ -490,11 +494,11 @@ static bool trans_NOT_rr(DisasContext *ctx, arg_NOT_rr *a) /* neg rs, rd */ static bool trans_NEG_rr(DisasContext *ctx, arg_NEG_rr *a) { - prt("neg\t"); if (a->rs != a->rd) { - prt("r%d, ", a->rs); + prt("neg\tr%d, r%d", a->rs, a->rd); + } else { + prt("neg\tr%d", a->rs); } - prt("r%d", a->rd); return true; } @@ -606,11 +610,10 @@ static bool trans_SBB_mr(DisasContext *ctx, arg_SBB_mr *a) /* abs rs, rd */ static bool trans_ABS_rr(DisasContext *ctx, arg_ABS_rr *a) { - prt("abs\t"); - if (a->rs == a->rd) { - prt("r%d", a->rd); + if (a->rs != a->rd) { + prt("abs\tr%d, r%d", a->rs, a->rd); } else { - prt("r%d, r%d", a->rs, a->rd); + prt("abs\tr%d", a->rs); } return true; } @@ -733,11 +736,11 @@ static bool trans_DIVU_mr(DisasContext *ctx, arg_DIVU_mr *a) /* shll #imm:5, rs, rd */ static bool trans_SHLL_irr(DisasContext *ctx, arg_SHLL_irr *a) { - prt("shll\t#%d, ", a->imm); if (a->rs2 != a->rd) { - prt("r%d, ", a->rs2); + prt("shll\t#%d, r%d, r%d", a->imm, a->rs2, a->rd); + } else { + prt("shll\t#%d, r%d", a->imm, a->rd); } - prt("r%d", a->rd); return true; } @@ -752,11 +755,11 @@ static bool trans_SHLL_rr(DisasContext *ctx, arg_SHLL_rr *a) /* shar #imm:5, rs, rd */ static bool trans_SHAR_irr(DisasContext *ctx, arg_SHAR_irr *a) { - prt("shar\t#%d,", a->imm); if (a->rs2 != a->rd) { - prt("r%d, ", a->rs2); + prt("shar\t#%d, r%d, r%d", a->imm, a->rs2, a->rd); + } else { + prt("shar\t#%d, r%d", a->imm, a->rd); } - prt("r%d", a->rd); return true; } @@ -771,11 +774,11 @@ static bool trans_SHAR_rr(DisasContext *ctx, arg_SHAR_rr *a) /* shlr #imm:5, rs, rd */ static bool trans_SHLR_irr(DisasContext *ctx, arg_SHLR_irr *a) { - prt("shlr\t#%d, ", a->imm); if (a->rs2 != a->rd) { - prt("r%d, ", a->rs2); + prt("shlr\t#%d, r%d, r%d", a->imm, a->rs2, a->rd); + } else { + prt("shlr\t#%d, r%d", a->imm, a->rd); } - prt("r%d", a->rd); return true; } From patchwork Tue Mar 17 16:36:14 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 184630 Delivered-To: patch@linaro.org Received: by 2002:a92:1f12:0:0:0:0:0 with SMTP id i18csp4363988ile; Tue, 17 Mar 2020 09:46:53 -0700 (PDT) X-Google-Smtp-Source: ADFU+vvT3ogGuuWFBoYEEt8TdNKB0jtziexDS3kzUCbvgkRzgLXaNpqVVXV8wWD3UGaT0AtcjgbQ X-Received: by 2002:a0c:c344:: with SMTP id j4mr21148qvi.51.1584463613108; Tue, 17 Mar 2020 09:46:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1584463613; cv=none; d=google.com; s=arc-20160816; b=LYrvfupiV9NnU0M+pSN38XVKB12pOZG1moO3sPCoOJe7AYEYTinXmrql9BTmmuupkm K+Vkmqahzn9rziPrm/Q6ufuszfnK4ySpNRuwkuocONgd0Sy69ZceeAEXUjlmdIqyA434 ayOiN6gmJ94n4ffzN8dKUXuRSmaZxSn+9VfXLIoQqS+vpPjgolymYJTW1+OXGPaKKPQk +9lgDF8pQL/ZUiJyFE7UHa0PkaSw4lybqVTrW2cOcnBCXBKkLHPawFJs1PBUsZ4tYDja ouR+KWrT5t7qbQBfLBAYsncP+Xq81yLodaalonUR7gsiFX9IIxVoj4DVS2gf5PqNI2Sz lR1w== 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:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=T0CiFFiWYIaYPKYRBKJcJx8291mmGW0+BGwrLGbj5DM=; b=uLmPd+tus52xnZ5B0LPBjbasooOShlIBXqjU7TwjoqOgcTnKwmV0RCMULJG8QoEOwL ti+qUPjo0PhOC7MRyLnT8aCAGWH1qGnja7K0lRV6eFNJizLOEcDlifMkTtTOiGgIJjsH 24jRPvwhXO0Pbst1D9EESErP8lo/E/g9bNHlpIQg1qxe3l8d6M9nPDx2KWf7YfvFYL1J mrPObY9OYeGu/OoLqlZW2D14dPIG+d+8MCanKE2miwcuj/CR+U0YXx/LRelcga2XcxUQ Yvjm6hplY6qSrMx3iH7dyGHPp0TL46oaGvdJ2xFsj6TlMTlAj5S852QQ1TQ3ILcoJybr BQkw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=dVlUAW+b; 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=fail (p=NONE sp=NONE dis=NONE) header.from=amsat.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id h23si2079379qtq.224.2020.03.17.09.46.53 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 17 Mar 2020 09:46:53 -0700 (PDT) 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=fail header.i=@gmail.com header.s=20161025 header.b=dVlUAW+b; 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=fail (p=NONE sp=NONE dis=NONE) header.from=amsat.org Received: from localhost ([::1]:36794 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jEFMi-0001CD-JF for patch@linaro.org; Tue, 17 Mar 2020 12:46:52 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:36051) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jEFCo-000420-P0 for qemu-devel@nongnu.org; Tue, 17 Mar 2020 12:36:40 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1jEFCm-0004An-Tf for qemu-devel@nongnu.org; Tue, 17 Mar 2020 12:36:38 -0400 Received: from mail-wm1-x343.google.com ([2a00:1450:4864:20::343]:50677) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1jEFCm-000445-L4 for qemu-devel@nongnu.org; Tue, 17 Mar 2020 12:36:36 -0400 Received: by mail-wm1-x343.google.com with SMTP id z13so6136154wml.0 for ; Tue, 17 Mar 2020 09:36:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=T0CiFFiWYIaYPKYRBKJcJx8291mmGW0+BGwrLGbj5DM=; b=dVlUAW+bq0fqQaimnqyzzZBO/DO3zzFS0V4nYLEc05tUX9r2CRZEZ7ijYbpJS6s6K7 W9765FKZNyNMlk0THX3LriDxOJ2cCBxsgFfFKLIi8qAZKIg47zI7b1n8zhpZwOrGWdoq YzV8t2N+RbxTA7EsRWGNMsKcO2bz6Pwt7KScCC6VPWsx3d2dCuv/Vx778DxHsIY53/uX QPwiy4F7OPCEgOSMTjaEKqwe2cOaR384QHupu/v5Ve6/DtQoQ702fuRYePN0o3xuq2+F K+gCjDk5BC/0eLnL3WWCLi6NlvYwqcQgVBXarhEVfh+Tz2VN65vdoD12f1VyGt8qkM5s MTGA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=T0CiFFiWYIaYPKYRBKJcJx8291mmGW0+BGwrLGbj5DM=; b=ekPOSJxbC1b63ZCgKStZnNP8nvDad2xWcdICH/T0PmEIN6Vq/F5i5lwas8QxhJUe6O DKH1PmgTa2uOi+4yJw7yBI5nAdMo5jboxtCfmewL+dz0SUHoS8AKI5AEiQVDEy0MrQAk qcGnKwHNipFpAs9KUGGqR2nC+4Nr4mi9E+4oLcHejKWp2zgpylub6cEtI/f+HCAoWNVm sStpDKkSEg2rNf0LC3SQ8UGr7dqIwUxhfJ4xy3j7SfV9nMGN41B+2DqxRqYujVdvVoFO st9KR9QmjVFI48jHKQKOXKCd8ijarGiRCJj7rKQZzssdnqu9+FIylr1uhiUWnPZI58zo mjOQ== X-Gm-Message-State: ANhLgQ013OppKrQiWwTq+oWKkUAuSnSwI0z9rdBZ8LIimRKhu8xZEdzH s4Z/xpmiYAIKACUnnANSv5Rds3qZ X-Received: by 2002:a05:600c:14d5:: with SMTP id i21mr167586wmh.82.1584462993256; Tue, 17 Mar 2020 09:36:33 -0700 (PDT) Received: from x1w.redhat.com (96.red-83-59-163.dynamicip.rima-tde.net. [83.59.163.96]) by smtp.gmail.com with ESMTPSA id b202sm4618697wmd.15.2020.03.17.09.36.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 17 Mar 2020 09:36:32 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Subject: [PULL 11/13] target/rx: Collect all bytes during disassembly Date: Tue, 17 Mar 2020 17:36:14 +0100 Message-Id: <20200317163616.30027-12-f4bug@amsat.org> X-Mailer: git-send-email 2.21.1 In-Reply-To: <20200317163616.30027-1-f4bug@amsat.org> References: <20200317163616.30027-1-f4bug@amsat.org> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::343 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Richard Henderson , =?utf-8?q?Philippe_?= =?utf-8?q?Mathieu-Daud=C3=A9?= , Yoshinori Sato , Richard Henderson Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Richard Henderson Collected, to be used in the next patch. Reviewed-by: Philippe Mathieu-Daudé Reviewed-by: Yoshinori Sato Tested-by: Philippe Mathieu-Daudé Signed-off-by: Richard Henderson Message-Id: <20190531134315.4109-23-richard.henderson@linaro.org> Acked-by: Richard Henderson Signed-off-by: Philippe Mathieu-Daudé --- target/rx/disas.c | 62 ++++++++++++++++++++++++++++++++--------------- 1 file changed, 42 insertions(+), 20 deletions(-) -- 2.21.1 diff --git a/target/rx/disas.c b/target/rx/disas.c index 814ef97480..dcfb7baf99 100644 --- a/target/rx/disas.c +++ b/target/rx/disas.c @@ -25,43 +25,59 @@ typedef struct DisasContext { disassemble_info *dis; uint32_t addr; uint32_t pc; + uint8_t len; + uint8_t bytes[8]; } DisasContext; static uint32_t decode_load_bytes(DisasContext *ctx, uint32_t insn, - int i, int n) + int i, int n) { - bfd_byte buf; + uint32_t addr = ctx->addr; + + g_assert(ctx->len == i); + g_assert(n <= ARRAY_SIZE(ctx->bytes)); + while (++i <= n) { - ctx->dis->read_memory_func(ctx->addr++, &buf, 1, ctx->dis); - insn |= buf << (32 - i * 8); + ctx->dis->read_memory_func(addr++, &ctx->bytes[i - 1], 1, ctx->dis); + insn |= ctx->bytes[i - 1] << (32 - i * 8); } + ctx->addr = addr; + ctx->len = n; + return insn; } static int32_t li(DisasContext *ctx, int sz) { - int32_t addr; - bfd_byte buf[4]; - addr = ctx->addr; + uint32_t addr = ctx->addr; + uintptr_t len = ctx->len; switch (sz) { case 1: + g_assert(len + 1 <= ARRAY_SIZE(ctx->bytes)); ctx->addr += 1; - ctx->dis->read_memory_func(addr, buf, 1, ctx->dis); - return (int8_t)buf[0]; + ctx->len += 1; + ctx->dis->read_memory_func(addr, ctx->bytes + len, 1, ctx->dis); + return (int8_t)ctx->bytes[len]; case 2: + g_assert(len + 2 <= ARRAY_SIZE(ctx->bytes)); ctx->addr += 2; - ctx->dis->read_memory_func(addr, buf, 2, ctx->dis); - return ldsw_le_p(buf); + ctx->len += 2; + ctx->dis->read_memory_func(addr, ctx->bytes + len, 2, ctx->dis); + return ldsw_le_p(ctx->bytes + len); case 3: + g_assert(len + 3 <= ARRAY_SIZE(ctx->bytes)); ctx->addr += 3; - ctx->dis->read_memory_func(addr, buf, 3, ctx->dis); - return (int8_t)buf[2] << 16 | lduw_le_p(buf); + ctx->len += 3; + ctx->dis->read_memory_func(addr, ctx->bytes + len, 3, ctx->dis); + return (int8_t)ctx->bytes[len + 2] << 16 | lduw_le_p(ctx->bytes + len); case 0: + g_assert(len + 4 <= ARRAY_SIZE(ctx->bytes)); ctx->addr += 4; - ctx->dis->read_memory_func(addr, buf, 4, ctx->dis); - return ldl_le_p(buf); + ctx->len += 4; + ctx->dis->read_memory_func(addr, ctx->bytes + len, 4, ctx->dis); + return ldl_le_p(ctx->bytes + len); default: g_assert_not_reached(); } @@ -110,7 +126,7 @@ static const char psw[] = { static void rx_index_addr(DisasContext *ctx, char out[8], int ld, int mi) { uint32_t addr = ctx->addr; - uint8_t buf[2]; + uintptr_t len = ctx->len; uint16_t dsp; switch (ld) { @@ -119,14 +135,18 @@ static void rx_index_addr(DisasContext *ctx, char out[8], int ld, int mi) out[0] = '\0'; return; case 1: + g_assert(len + 1 <= ARRAY_SIZE(ctx->bytes)); ctx->addr += 1; - ctx->dis->read_memory_func(addr, buf, 1, ctx->dis); - dsp = buf[0]; + ctx->len += 1; + ctx->dis->read_memory_func(addr, ctx->bytes + len, 1, ctx->dis); + dsp = ctx->bytes[len]; break; case 2: + g_assert(len + 2 <= ARRAY_SIZE(ctx->bytes)); ctx->addr += 2; - ctx->dis->read_memory_func(addr, buf, 2, ctx->dis); - dsp = lduw_le_p(buf); + ctx->len += 2; + ctx->dis->read_memory_func(addr, ctx->bytes + len, 2, ctx->dis); + dsp = lduw_le_p(ctx->bytes + len); break; default: g_assert_not_reached(); @@ -1392,8 +1412,10 @@ int print_insn_rx(bfd_vma addr, disassemble_info *dis) DisasContext ctx; uint32_t insn; int i; + ctx.dis = dis; ctx.pc = ctx.addr = addr; + ctx.len = 0; insn = decode_load(&ctx); if (!decode(&ctx, insn)) { From patchwork Tue Mar 17 16:36:15 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 184635 Delivered-To: patch@linaro.org Received: by 2002:a92:1f12:0:0:0:0:0 with SMTP id i18csp4374038ile; Tue, 17 Mar 2020 09:57:01 -0700 (PDT) X-Google-Smtp-Source: ADFU+vsA5NzC3CHdSsYbIzYmqVfb/k40nf53YcZt6AR38P4nmXd0IDbVJO2EDHU/jrRa3uJUZOd5 X-Received: by 2002:a37:80c7:: with SMTP id b190mr5815883qkd.255.1584464221574; Tue, 17 Mar 2020 09:57:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1584464221; cv=none; d=google.com; s=arc-20160816; b=mbA3maMPQ9aLtJrYAXVsHnko5TVfc0eD5voqxZJiIYZC4DFwyJflk1bAPyND40NCRM wiWh8xCUwOpKnbjTAm0+zVKA6WNJu4zu6WfagkBcvbCbBEe2MAvTH1Q77rKW1EhjsDuO Aivu1Y+7XumqM1aX4s3rnB+Pm0vND4aMbZTdcK5OHv2pdqObONP2qGtwQ8EwfklG+ca7 BHEl59SBz1t0e7qB2X9ksGlSexrRAHt/SFoUF/R07niyb6NWAyhSGe1VPMH2Q6wxGT3o JoAOSIT21JcMSJHPNLVT6bfedOU32v1acTLI9lQQ0vK5yt/Ca3aUuLM6ic5UXYQo1QAL y2AQ== 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:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=mfXBsBn9LUhSN6WgjaxZSay9usosB3zq5/7Zod3QK24=; b=sNaKd9ukce0o4bFtYEvuQRNlkwsbECQQUYye0dlZvRmmIcpMEksNxJC4uQHNFio1oo BimY84VAv80kUaAsNFZXhQ1vDxnQP1ueuHNmfX6+A8rGp+vY2uOXyoVyziJCGnyBH9o2 TG9k8guG9QPU67yYhSvXa3htNBxAkznHdnbNcTZGTUwQM4lGm1XsgCswiFwItWh0uGcI gpEP8GCLoEx74A7Nk4sQYYo/veXYJUqYH6+jyHMdBk0GuWS9MGSx14MG1jDxc6oup55G FdLddVwfulNLtYM0u0ClwsU8cxHdic5wkCGQtj4MaXOFh1WUwgs2U/w8AoF+CK57tNZZ OvJg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=QUEYm0Gv; 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=fail (p=NONE sp=NONE dis=NONE) header.from=amsat.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id x15si2351832qkn.232.2020.03.17.09.57.01 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 17 Mar 2020 09:57:01 -0700 (PDT) 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=fail header.i=@gmail.com header.s=20161025 header.b=QUEYm0Gv; 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=fail (p=NONE sp=NONE dis=NONE) header.from=amsat.org Received: from localhost ([::1]:36986 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jEFWX-0001uY-0k for patch@linaro.org; Tue, 17 Mar 2020 12:57:01 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:36015) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jEFCn-0003z4-Hg for qemu-devel@nongnu.org; Tue, 17 Mar 2020 12:36:38 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1jEFCm-00045K-5y for qemu-devel@nongnu.org; Tue, 17 Mar 2020 12:36:37 -0400 Received: from mail-wr1-x429.google.com ([2a00:1450:4864:20::429]:38015) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1jEFCl-0003zS-UZ for qemu-devel@nongnu.org; Tue, 17 Mar 2020 12:36:36 -0400 Received: by mail-wr1-x429.google.com with SMTP id s1so4826255wrv.5 for ; Tue, 17 Mar 2020 09:36:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=mfXBsBn9LUhSN6WgjaxZSay9usosB3zq5/7Zod3QK24=; b=QUEYm0GvgtCTNgoqFK+49ALq0djvwNFe8r0Xv+LW/Ri4C19e9ps7Z2wAGtxu5r//9f ROkmA6VWTsMns3NN2D+6Qs/V5K63h/AxbvmhP5yfgwePIPfFScyJu3flpVE3r5s0ivsF zyHvRq6AKPieVIR50GBCat0tnwWvr3obgCG5jVMtIQWCWtGQnZG5a636A3GX2+vut1i9 mggir+p+4M1U7/gldFuJAfprah/nWk6zRgQ74PRlCekRYFOOPHI3esHYstiM4GpGutfl bvHBsBC1IACsMAnnIAtwxTvkBF8UH1FtIRRhd+RxTshfyK9VdWZr8+QXaYVIK3vHAbaS A9pQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=mfXBsBn9LUhSN6WgjaxZSay9usosB3zq5/7Zod3QK24=; b=EZwKcQbcKhOEJOlyFY4PokuAf3w4zpgJG6PWlN3suTRWbUVG/QCqi2SL8uuUJHMLgH cj0LgRfbSt0PrJLSoBuY7f80B3B3ri5MhNuCuMeCTa7uUcS7R3vPx01wdg+tYsxM4QID yv2AvqDPaAgPgA4OjMuNLlO2g2O5H2viXB3Png0bikIk78ft2iG/Bg98Dq/of00H8Wqm a32z93itv/PyXaQNcMNb4+41qxv0VYemlfUgNizMzVutUvsupGq7lCukjnxZVFP4ZMLr IRktO4+PwUq/8WfDL8y+S1exwB57Fcej2tq6GybZiVpNSQnCsid7fNn0LJOehVE1rWwf PqbQ== X-Gm-Message-State: ANhLgQ1tXiPzUr+qZMmWb6aBwCIYP2kgFR9z2Iz6ucJIaeRK+CsgOG9a LafO/3fXUEmu1/FWoHUrylalSYku X-Received: by 2002:a5d:5342:: with SMTP id t2mr7085696wrv.104.1584462994353; Tue, 17 Mar 2020 09:36:34 -0700 (PDT) Received: from x1w.redhat.com (96.red-83-59-163.dynamicip.rima-tde.net. [83.59.163.96]) by smtp.gmail.com with ESMTPSA id b202sm4618697wmd.15.2020.03.17.09.36.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 17 Mar 2020 09:36:33 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Subject: [PULL 12/13] target/rx: Dump bytes for each insn during disassembly Date: Tue, 17 Mar 2020 17:36:15 +0100 Message-Id: <20200317163616.30027-13-f4bug@amsat.org> X-Mailer: git-send-email 2.21.1 In-Reply-To: <20200317163616.30027-1-f4bug@amsat.org> References: <20200317163616.30027-1-f4bug@amsat.org> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::429 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Richard Henderson , =?utf-8?q?Philippe_?= =?utf-8?q?Mathieu-Daud=C3=A9?= , Yoshinori Sato , Richard Henderson Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Richard Henderson There are so many different forms of each RX instruction that it will be very useful to be able to look at the bytes to see on which path a bug may lie. Reviewed-by: Philippe Mathieu-Daudé Reviewed-by: Yoshinori Sato Tested-by: Philippe Mathieu-Daudé Signed-off-by: Richard Henderson Message-Id: <20190531134315.4109-24-richard.henderson@linaro.org> Acked-by: Richard Henderson Signed-off-by: Philippe Mathieu-Daudé --- target/rx/disas.c | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) -- 2.21.1 diff --git a/target/rx/disas.c b/target/rx/disas.c index dcfb7baf99..6dee7a0342 100644 --- a/target/rx/disas.c +++ b/target/rx/disas.c @@ -102,7 +102,21 @@ static int bdsp_s(DisasContext *ctx, int d) /* Include the auto-generated decoder. */ #include "decode.inc.c" -#define prt(...) (ctx->dis->fprintf_func)((ctx->dis->stream), __VA_ARGS__) +static void dump_bytes(DisasContext *ctx) +{ + int i, len = ctx->len; + + for (i = 0; i < len; ++i) { + ctx->dis->fprintf_func(ctx->dis->stream, "%02x ", ctx->bytes[i]); + } + ctx->dis->fprintf_func(ctx->dis->stream, "%*c", (8 - i) * 3, '\t'); +} + +#define prt(...) \ + do { \ + dump_bytes(ctx); \ + ctx->dis->fprintf_func(ctx->dis->stream, __VA_ARGS__); \ + } while (0) #define RX_MEMORY_BYTE 0 #define RX_MEMORY_WORD 1