From patchwork Sun Mar 15 13:28:03 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: 184561 Delivered-To: patch@linaro.org Received: by 2002:a92:1f12:0:0:0:0:0 with SMTP id i18csp1699582ile; Sun, 15 Mar 2020 06:38:52 -0700 (PDT) X-Google-Smtp-Source: ADFU+vsYYOkZS6IMb8Gv89cosdLoYjQPiZpRc7oP6uWMxpWyHz2QklvPLbRd9sW68LI5FecQ2kXf X-Received: by 2002:ac8:4913:: with SMTP id e19mr9779064qtq.315.1584279532819; Sun, 15 Mar 2020 06:38:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1584279532; cv=none; d=google.com; s=arc-20160816; b=xOYuzCoIQTD9tYfeBzErI49oezSrTuaSIFpRihBQUYNgRQGyhWK3FGttG8m2YhBSPo nh5Ku2Ezv/+SA6dhBhinwKD8BR662knjt8l8mOjVX5+G6K90VlCdrAbvYTZsNgcUiAyq QzHhL88Os0gNFseJGd6UQXE7NSuwK8VcinnlS+r941ebXArfZvXZjHakf0rTviRmpcQ2 fnmEe/K7RSQJbTV5rxph5Mv5p0Y6aG4+TgPzwdDddRTs9TI2jXi/ghbK95LWpr4O9Biu epCADbWZl2y0na5Y+iQcWEdo0MWLD3ZcWLIdrMhMnn7WUBH3TB2FipOUPldpoy60TPJ5 4w0A== 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=dU3gpjX3Posol9xmmDMnWL1NqczANAwUTw9txeOeohk=; b=kMqhl64UYBqXuTHE04VEwVaHXFHTj2Qq50+0JlM0JFbk8ZE/aWLawZdj7WN6qH/f++ HQ3SvEfciqDbW0BBrenv1cs57c61RSNWT2gSlNEqVcFqDqe6Y60ueOpMh8zj8a7/GDvw 5tKVeR6Ql++LWkzqkxmBC9Yl7H0WBT/OdAtk03vrz2o0qNiuggdT8ZslYSvKFFNQYUhK X3OxEOq6KrwK0cyHybLaR7EQAFQJFZIFIUqvbf/Pa2grLYv3nPb6ipasYMKcM8gQWwuS 366OOqm+OJmbiHavQQTWP9+7t7ocdQgGBwuM4O5E11duW9cFEPG0vz+SCG9EkbWy+sCJ Ourg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=aW1I5K+E; 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 t2si4218522qkt.62.2020.03.15.06.38.52 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sun, 15 Mar 2020 06:38: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=aW1I5K+E; 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]:54064 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jDTTg-0008Sv-97 for patch@linaro.org; Sun, 15 Mar 2020 09:38:52 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:50787) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jDTJg-00086T-AZ for qemu-devel@nongnu.org; Sun, 15 Mar 2020 09:28:34 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1jDTJd-0003Dc-37 for qemu-devel@nongnu.org; Sun, 15 Mar 2020 09:28:30 -0400 Received: from mail-wm1-x344.google.com ([2a00:1450:4864:20::344]:51919) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1jDTJb-00038j-8q for qemu-devel@nongnu.org; Sun, 15 Mar 2020 09:28:27 -0400 Received: by mail-wm1-x344.google.com with SMTP id a132so14755372wme.1 for ; Sun, 15 Mar 2020 06:28:27 -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=dU3gpjX3Posol9xmmDMnWL1NqczANAwUTw9txeOeohk=; b=aW1I5K+EX0G0MhRGm1zO7+wj2FJisphAR0piH/Dt/DVcyG3t7am1ehzldY0ITZLD51 95uApHUdd/ZVZyPJd+rFkCuryOQsTufnocbi9kpszT7FCEqfie2Z8wBpK92ZsSy7h9gD Os+wH0XXtYVjY5yn6EKqtYDW6nxB77/lCH6EffWEXhR0NLSbXQ81e54EhY5GyWHE/pzA FZkxAZOTUUgWgYGeIO7NxbMRPPHVZWyYHtR83nthPIcd9U4oUj/OV0Q08zy4EKLjhDI7 XcBhUlkdENLhY11S/OP4Ms8pn87g6XMSKZc3iLeWDFnOJNOILJIlCrCQ85cMPH4yZZAC XyRw== 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=dU3gpjX3Posol9xmmDMnWL1NqczANAwUTw9txeOeohk=; b=olyYrD9sqhJC6/Uj1MHLjSS2dN1m1Vwj/fPha+wm+3L5oR5egF4Zv5n/czdGoDG42p nDvLprC2vDXmYoJdMHJXlV+7zyU5cF1aZRusQj/ifZGtqZWuA2o2Vi2jXwTXw9Es99Cz tQokqIV2oRBMxOmtHfDQIyGDLlnkemkv/ikQlWWZXPqgXCWyEruU6mIkS+103dfUhPFS UmpthMJz4Hiuii9fHLN/eup3o4AmT1bVc0noz8yVgEvBcjN66AbS5pfSJu1+l55rPTXA FVf0FmDRcIGQuBjzpaj/yGYfPXk+9Xz3lkUFIPPtkjFlo2stcMknDbhg/VUMHSrAap60 Ei8g== X-Gm-Message-State: ANhLgQ1ry5U5vgPsFrwPuH+YLbydBsvsHtV01qrModwxM8criPp6qtLB 7oV+4tRX8xQp0LP6rgRjYP4AUB16 X-Received: by 2002:a7b:c194:: with SMTP id y20mr23203819wmi.129.1584278905773; Sun, 15 Mar 2020 06:28:25 -0700 (PDT) Received: from localhost.localdomain (191.red-83-42-66.dynamicip.rima-tde.net. [83.42.66.191]) by smtp.gmail.com with ESMTPSA id d15sm87590503wrp.37.2020.03.15.06.28.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 15 Mar 2020 06:28:25 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Subject: [PATCH 07/13] target/rx: Disassemble rx_index_addr into a string Date: Sun, 15 Mar 2020 14:28:03 +0100 Message-Id: <20200315132810.7022-8-f4bug@amsat.org> X-Mailer: git-send-email 2.21.1 In-Reply-To: <20200315132810.7022-1-f4bug@amsat.org> References: <20200315132810.7022-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: Yoshinori Sato , =?utf-8?q?Alex_Benn=C3=A9?= =?utf-8?q?e?= , Richard Henderson , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , 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> 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 Sun Mar 15 13:28:04 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: 184562 Delivered-To: patch@linaro.org Received: by 2002:a92:1f12:0:0:0:0:0 with SMTP id i18csp1701566ile; Sun, 15 Mar 2020 06:41:43 -0700 (PDT) X-Google-Smtp-Source: ADFU+vvjt9crpzv0ZN23uBIksKWwHg/HqMRznPlFx5pIU1iLGhHRt1W+RtN2ljaMcxoIt/nIXZBf X-Received: by 2002:a37:44c:: with SMTP id 73mr17600698qke.376.1584279702969; Sun, 15 Mar 2020 06:41:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1584279702; cv=none; d=google.com; s=arc-20160816; b=Ot8/jHaTZ5DzqUOp3t6O6wfEJwJLRef+KtS1F8IpggKIE2iwAPf9oIB5zUt7N4dOv6 KKi1Ex1vEc5J0SUlSwOfa33UkqNIjv6P31QPf9sB0PTgTv1RbzVUNVu5c6bRCEgid35d RsIc+XFpp27QqU7Kq1/wEYp/9ZXX0cvdRsaQlWWBHO9E4tiQ7oIcNNaOUtHOQHlC8xUL NdM7z5o7ZQM1BqgDTgUBdPw8fV8ThvOZDa+XPvEktEwC+26gFthYhnfVC18+t8b6RKRG ZcLNE9tKWjmxDP30XsuUMGdr88Nucq4NdX5HG12ZXW2cOHtAjMSjxp2OL4XvPQ033er8 Fjuw== 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=1VvzifdAgPN+wvhMY9eGYoS7NUwS+hDqsCqV0xhxGYU=; b=tSjmDHSAIw4imaCcnXdSw9m7KOAGlVhKMozjMAv1JW0ks0Lh8rM5QFJwqWsXHEVvlu YXeCi5Mpjk9sZM9hCPo7iFgcH+cuOiOktGfChcChHdJjCZe0RGx1XbFmFKP87rG+JNMZ 0iLZW95wD2B+aFRRmCPAEtOlRokdu85bqfEt1pj889fA/ZWxbAgY6TRl/w3JHE+8TKA1 EwN1ADtecyMAMoj179lmdPpmATko5WoP5SFVCXIq0l9UnTALrz+rdeZPt690a8EpRM0T 2knP4woLauDRPJEQIClHdQlSHShiEeCv0E5AFkYUCJiSYI3Z2NX8H+h019nVWSuwEILH KEEw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=eJGxvo5M; 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 b22si309696qvf.95.2020.03.15.06.41.42 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sun, 15 Mar 2020 06:41:42 -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=eJGxvo5M; 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]:54090 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jDTWQ-0001tO-Bn for patch@linaro.org; Sun, 15 Mar 2020 09:41:42 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:50793) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jDTJg-00086k-TI for qemu-devel@nongnu.org; Sun, 15 Mar 2020 09:28:34 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1jDTJd-0003GJ-Cc for qemu-devel@nongnu.org; Sun, 15 Mar 2020 09:28:31 -0400 Received: from mail-wr1-x442.google.com ([2a00:1450:4864:20::442]:40504) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1jDTJd-0003Cj-2y for qemu-devel@nongnu.org; Sun, 15 Mar 2020 09:28:29 -0400 Received: by mail-wr1-x442.google.com with SMTP id f3so10871563wrw.7 for ; Sun, 15 Mar 2020 06:28:28 -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=1VvzifdAgPN+wvhMY9eGYoS7NUwS+hDqsCqV0xhxGYU=; b=eJGxvo5M8B4k8MIxS6jYQCXmCALn+u+1Rz03Iom6+owf5KyV/P0vRYBYyNgolTXanh uR8MSq2chkW83sba27ycV+t1hn1Vf7OY3dueW+m2q0YxYA5F/fe+IBIcaVohyCw1+j9U F5S2a1WPa5uXrlKCxVEBMEp0/+xspP+fCHhrHCm7D/O4DlJ0Iegt7P8zuG7sNISAQXeK jTkRft9GWoicPRfL5jWlF3bFw+yMV1EnlLWfLBB27IDmiEl5IZWmlCrq+aerqgDGdkL7 dylywTrBJAUFhp5f6SrwTHg/qyNQgl9OeE0S8vT81CJScxUmWIdG/65Z4VFA9T7rTQ49 Xwpw== 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=1VvzifdAgPN+wvhMY9eGYoS7NUwS+hDqsCqV0xhxGYU=; b=gu06nHxGxnxp12ueXdql/2Ga8iMstLOEfkYvXRlE3rli8MJOsSOTRYeAocdt48nqjv XPzfnzXwlrShs1elthuYG0Kfrk9V6V/BbsNDyBT/r/xz61IM2RmM2pNng6jpSmNcuQiK LTX1xfrDO4j532+SOvG9g0Jt/zibxGmuyT6gQ8cvnD4u5+TVXF7U0iOcuvJmk2+hxljm 45aHx/gqKyZ8lO/h6Da6hvJl2wYiufqFApm/5mMt5R3wMRmQ3IaxHHrHWlzpblw28bHu oKHhQtEdovFEnmubvwOLa0minjH1tLIXcmnzrkzRmfwDgXUJ9YOH2+Qbexnmher3qC9a D2IA== X-Gm-Message-State: ANhLgQ3/Nh4X2SYWpl0MCkmhq5XY+w6vfqdXNE641x/7tsOBrRNlXfaf L5mrVguwU8EVfrG2wzyZwQZ6EEJh X-Received: by 2002:a5d:4ad1:: with SMTP id y17mr22734163wrs.119.1584278907253; Sun, 15 Mar 2020 06:28:27 -0700 (PDT) Received: from localhost.localdomain (191.red-83-42-66.dynamicip.rima-tde.net. [83.42.66.191]) by smtp.gmail.com with ESMTPSA id d15sm87590503wrp.37.2020.03.15.06.28.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 15 Mar 2020 06:28:26 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Subject: [PATCH 08/13] target/rx: Replace operand with prt_ldmi in disassembler Date: Sun, 15 Mar 2020 14:28:04 +0100 Message-Id: <20200315132810.7022-9-f4bug@amsat.org> X-Mailer: git-send-email 2.21.1 In-Reply-To: <20200315132810.7022-1-f4bug@amsat.org> References: <20200315132810.7022-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::442 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: Yoshinori Sato , =?utf-8?q?Alex_Benn=C3=A9?= =?utf-8?q?e?= , Richard Henderson , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , 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> 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 Sun Mar 15 13:28:05 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: 184558 Delivered-To: patch@linaro.org Received: by 2002:a92:1f12:0:0:0:0:0 with SMTP id i18csp1692557ile; Sun, 15 Mar 2020 06:30:22 -0700 (PDT) X-Google-Smtp-Source: ADFU+vs4EETuLN2vY7p9mGAzdgHQTzQ0yiVnVpfWQOP6LDr1NHVk0I34tjDzpdv9X3qVSde/oOzl X-Received: by 2002:a37:b646:: with SMTP id g67mr21860153qkf.52.1584279022272; Sun, 15 Mar 2020 06:30:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1584279022; cv=none; d=google.com; s=arc-20160816; b=jS2SEK+ifA/iv6GKuHP4Af9XiT3XrcHBTP1koFxShd11jWG3t9yP1GHojXSjjq6O9b DQw4x1ySTK7D87env+Lmpfz9eI5hh/ad6faX+0Fos2X7TmsVIzd+RhQ2r0YqcUu+AKAX QHzOU0EcUUdUmWemMDPZrJ6+khjzWaNTbQTnPWcW4WvQNas8A6S5qUy7/dJBDRPfbM6e /v0L1J1UZ5B/OuKF872a6PKp2dF6I9ntb6xJevtiuBTDj7iihdr9mD/1dqsUydqMBa88 IKCUmoTfUmi1xCNRYXXiIdKD4RFOaQuSVhaPUroLE5BLH1+X/hdhwr8r9olgbEGTbK88 RFkQ== 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=cElIp5LI4R05nZljrre+VQi0ay9bW2zvw5msneFgmQA=; b=e/XjSnf2g5h1+L34/b+IeIA+7RPscJ7x/S3WN3+ClmXwbZsw4b/C/ouPX6TUS+Kxsn x+lUecfmI/Z+h7yMQVrPQP6FJD4/++BNow5p8vOeS0SRX7Q9MbnWTC3o4vTrgyIQKbEZ tqcVJvU7roWMYQY2SuppNrU8NfPZZWxxte0rbhezzjPGLI8lM0pVuu+CiAZX9f8ydG06 7kEpo817SqzXAhMifJnjfQLWYwNKXD9dPLdKWYfA63Q6JsnIkEnZG3V/X0sj5h8vXx9L vlqVz7DdoC8GYlnxnHZPfFb6Hjo/R4VA4wPIEIeeV8MMLNLB3sYsdWRnHT/YbPiu4zeU 6ieg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=XNBSb2Kb; 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 136si8917747qkj.196.2020.03.15.06.30.22 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sun, 15 Mar 2020 06:30:22 -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=XNBSb2Kb; 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]:53954 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jDTLR-0000yx-Lb for patch@linaro.org; Sun, 15 Mar 2020 09:30:21 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:50830) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jDTJi-00087t-MH for qemu-devel@nongnu.org; Sun, 15 Mar 2020 09:28:36 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1jDTJg-0003LS-SV for qemu-devel@nongnu.org; Sun, 15 Mar 2020 09:28:33 -0400 Received: from mail-wr1-x441.google.com ([2a00:1450:4864:20::441]:46116) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1jDTJf-0003Ie-5K for qemu-devel@nongnu.org; Sun, 15 Mar 2020 09:28:32 -0400 Received: by mail-wr1-x441.google.com with SMTP id w16so1441484wrv.13 for ; Sun, 15 Mar 2020 06:28:30 -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=cElIp5LI4R05nZljrre+VQi0ay9bW2zvw5msneFgmQA=; b=XNBSb2Kb73VEMVZ6qaPqa9Sn9X6D3SxSKgChkwjkTSbB8Io0cvPZuKc2ubgMb+aDTj 8AVQTSwp6noKKQGI4EU9DerQB8i+0daxub2k5t213KCjlbjkjXl/74iR/80OMPJxN50z LULBL/mEd9KZ+FxAynxa7YwDPIyxQt3ewoQt8Ngc8QPHeFY5rsCAa4qiZ1RlvjDqIoKW 5qEL+MhSwdzrBupU7lSDLAT54ZtCPn74tp4oSRPGlrRoOd1eK5UmX5qFJb6Kx4tdBdDp AGjPQ8cVRc3w11tFxYVmTmHqcw9PLv3CrcOeAq/S0byg7snW5DSSuJrN65VfIUydKoSI qJ+A== 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=cElIp5LI4R05nZljrre+VQi0ay9bW2zvw5msneFgmQA=; b=KVhSfeNOYzkr3fx50mdmQxw0WLi0iKzC7M4jatLFo/Y66JF7l29fywmUXogRvTYUSy smee6uRsgrkZvFB7pIVPsje8l+/QZIxBDCmM9j4uvjgdDY14sLC1JnAXjVZZcG0qEPqF 84CpDsGzfDntnyXN//YELzy4lqEckIMl6+x7zFA7u+8QNN0ErC50/7khn8UxQFlM+cJO 7YwLHTceGxmHiKDsEC341F93vpNUlGtR14U0RyMjOUjdG5LK8EBAInYbc9QqB+GMHqO4 oEF0USibyYBxaEmX0bGFfsiuEhSNlzIfd0fjf1XLcvNBj+w6J17gYhrQm/6t6uBFZeIM jXzA== X-Gm-Message-State: ANhLgQ3Vc2oEmfRP7MAv2HFoF0cjfhlh3GmdavUxmdej3cHycNudWC+g mtKza3PXJQvah6np5Qc1d+2jEWFj X-Received: by 2002:adf:ff89:: with SMTP id j9mr28266681wrr.281.1584278908870; Sun, 15 Mar 2020 06:28:28 -0700 (PDT) Received: from localhost.localdomain (191.red-83-42-66.dynamicip.rima-tde.net. [83.42.66.191]) by smtp.gmail.com with ESMTPSA id d15sm87590503wrp.37.2020.03.15.06.28.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 15 Mar 2020 06:28:28 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Subject: [PATCH 09/13] target/rx: Use prt_ldmi for XCHG_mr disassembly Date: Sun, 15 Mar 2020 14:28:05 +0100 Message-Id: <20200315132810.7022-10-f4bug@amsat.org> X-Mailer: git-send-email 2.21.1 In-Reply-To: <20200315132810.7022-1-f4bug@amsat.org> References: <20200315132810.7022-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::441 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: Yoshinori Sato , =?utf-8?q?Alex_Benn=C3=A9?= =?utf-8?q?e?= , Richard Henderson , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , 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> 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 Sun Mar 15 13:28:06 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: 184559 Delivered-To: patch@linaro.org Received: by 2002:a92:1f12:0:0:0:0:0 with SMTP id i18csp1698275ile; Sun, 15 Mar 2020 06:37:05 -0700 (PDT) X-Google-Smtp-Source: ADFU+vvecVEg50eyYupJRJebFVjA75ZQtzo7oe8qGuRJ/CvcYLQ6BMUI0IV9JhtXVgVwMr5PXJA5 X-Received: by 2002:a37:27c1:: with SMTP id n184mr21460569qkn.67.1584279425550; Sun, 15 Mar 2020 06:37:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1584279425; cv=none; d=google.com; s=arc-20160816; b=Ba+qY6vGYSSWMUrLsP8IQH/hngStRJbTpISVO5AShcU9IhBT205dPGnLNfenFcMuO/ g7olca4Ki8fxNBXzLupUVluhk/PoxWYSqr9gMbOrKRvdd4zawbQIE7o8+l+NlE4CdVhg P5pYeWtLhA7RWueXkS/6V5YXkKa7PII2tIsq/LL+HElSDPV9L9gHdtEGGUiaJ8R0pGN0 WPgL0YOQ1j+11k7oJ60Qf0wpX+f+tuRCgaOf/yU5fJwAxSWmvMOFmzAtYKFB4jTCmRaj nxg8dgTX/1fj2Z4TjpAM8mXeSYAYX4hxoTfIAne/1sjY/CIyJ32xR+wLxjTHAvHAxA2u 6x+Q== 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=ljXAIEVRHrDp+LzUL6MHSEncF524g2j6WXSfjoxzCZE=; b=PjpF7USd5ZYmklOpDMjciyl0Ivnx1m9F0fardayrIxWpXhKHlUPAv10Q6xQdmE7xTq IuCq98psAdtDOHj8INr1DYmNnnPJZlyXuVsLtDPOJTb79Sxf+uVBrUicrdJYP3GJVqtQ kPTV+4PF1rGy/LxcZS5biMpT36deKCFSUzjHuDRWDKiS2z2xmodm3uAPCrw72Q+ePbEj ioI7RMCOZWDKfGQSDgRr+3WQ136EZisEqJJ3tNuIaJynJWuW4lG4VCpg+3NMtAewklMX kaJAc7xSqg5KcT+a4/f/+DpYeh4+ro8krxvw4wdMd9i05dZaNeZASS5INFm+uqYFbzTT qUpA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=N+xjrqF7; 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 d18si8095384qvo.25.2020.03.15.06.37.05 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sun, 15 Mar 2020 06:37:05 -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=N+xjrqF7; 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]:54040 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jDTRx-0006wj-0E for patch@linaro.org; Sun, 15 Mar 2020 09:37:05 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:50860) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jDTJk-00088D-HZ for qemu-devel@nongnu.org; Sun, 15 Mar 2020 09:28:38 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1jDTJh-0003Pt-Uu for qemu-devel@nongnu.org; Sun, 15 Mar 2020 09:28:36 -0400 Received: from mail-wr1-x443.google.com ([2a00:1450:4864:20::443]:43914) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1jDTJg-0003Je-QI for qemu-devel@nongnu.org; Sun, 15 Mar 2020 09:28:33 -0400 Received: by mail-wr1-x443.google.com with SMTP id b2so11632303wrj.10 for ; Sun, 15 Mar 2020 06:28: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=ljXAIEVRHrDp+LzUL6MHSEncF524g2j6WXSfjoxzCZE=; b=N+xjrqF7nf4ewrkD+xekj2yaK34XJLS/xpB/wV01dNeseNHOxL9MjNWBJWcJ2NYgb+ RkwvfZ7yhyNTdVHLjln/wDUxBUWrXsieWS0rfWT/MIew4k2JoszMR+VFf9lWsXork8gi L+DWuUiQluaS5uwHubQAIBymbfKBlrfv3VAWkJBwTbufh2kfKUDNiGkcA48MxekdcKhp h8Y3UApWONfT7VhEZ1VwDQCljXXJNNjl0+SDu8CuIq90vXtL5UI+8XztelZKB+uBjbBj 2BBQ39Fjbx+nVhux9pyZ5t7bpVin7UrjDkLGr47302DFZ6lh7D3Y7V/5iwPzH/nyGqLV rL9A== 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=ljXAIEVRHrDp+LzUL6MHSEncF524g2j6WXSfjoxzCZE=; b=SdTn1Um4OBvOlLQUzfyRpMxAFc/pKBoQoyy4CDFsSQeZvYNsPqodzQkR81pvSGfn68 Wp+3IjuEJNrI4heBOgXAz/V8Lb9trM30+iNdCjZZ6V2OWYTwoYuZumamfKDrDHQUJCMC IcvflqIaru3gi0cWh48HTjyXCXnuCwEEf7+ugJCnKVNZizGrxstDZYfV+4hTz5NI9SYn WbeRG+yjJo/lhICjahOyDWGFpwYME4TXgGmx1ulnk3T947hqNMY7XVNBOaDKNrGmwhyd 7Ly9wnuteRJbvih339vusjgQLillr1SYB4zbs/GhSa2YI5VBWMduHzgad6UJ99QNT64S KT4w== X-Gm-Message-State: ANhLgQ0dT86f0lUyFweATzt6wPEGUnwZX1hKTk247z+CFSAhikbdX+fq McZ9Y+RH53Dl3PdWNFNIL7zXRaRP X-Received: by 2002:a5d:4d51:: with SMTP id a17mr11906907wru.285.1584278910565; Sun, 15 Mar 2020 06:28:30 -0700 (PDT) Received: from localhost.localdomain (191.red-83-42-66.dynamicip.rima-tde.net. [83.42.66.191]) by smtp.gmail.com with ESMTPSA id d15sm87590503wrp.37.2020.03.15.06.28.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 15 Mar 2020 06:28:30 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Subject: [PATCH 10/13] target/rx: Emit all disassembly in one prt() Date: Sun, 15 Mar 2020 14:28:06 +0100 Message-Id: <20200315132810.7022-11-f4bug@amsat.org> X-Mailer: git-send-email 2.21.1 In-Reply-To: <20200315132810.7022-1-f4bug@amsat.org> References: <20200315132810.7022-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::443 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: Yoshinori Sato , =?utf-8?q?Alex_Benn=C3=A9?= =?utf-8?q?e?= , Richard Henderson , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , 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> 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 Sun Mar 15 13:28:07 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: 184563 Delivered-To: patch@linaro.org Received: by 2002:a92:1f12:0:0:0:0:0 with SMTP id i18csp1701856ile; Sun, 15 Mar 2020 06:42:07 -0700 (PDT) X-Google-Smtp-Source: ADFU+vv7DinvGjyTXjA1E+L53SA8aNQ0CqoV2K78L4Lp0lOPOgXWzVgI1Umde4iJFUDTucInYG6P X-Received: by 2002:a05:6214:3c9:: with SMTP id ce9mr20772247qvb.212.1584279727309; Sun, 15 Mar 2020 06:42:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1584279727; cv=none; d=google.com; s=arc-20160816; b=YGmfZsSWH+bcKI4eyirlNaRorFI/TkKMTbxarPf1gEjqsbSUMd17qvkn7SsA+07xn6 l6rfgT8BdayQ1SXuAzqMSZVyLXsurj6hwSkRe0VOQm0a3WsnJSA29l9RGyaatG0+qxL+ ik9xooKoW0HC4EbFzBXyx//HrNbx4rN5Puy023/k6qWWwMxfTF4CQAvHv+6DkOxZBbUK txBZrZdzyhUFgqViHVUny2awWszE/TH2cJ1NrV8Js4o7dfM9+plmyvN7I8BQD/L6kaIh T4crhQCCFj0w9YKZFnCRFgJ9ZUz1fDftx38vk2Cg+I8iyOpB9sSejhLtTKSgxL+vU+VP bvrA== 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=a8zAz9iWkn+7gzsaWAdfIiX2cwmNIeyNTWkgmqsB7IQ=; b=Ew7HZY1PPjpu4h2CI2+9PlMZ/QG2NgGfDkPNyXgF9NE28mJyjANbNO1l/op3rd7J4s taIthyofQ42JWE732i6gkIFrFWj8RZvARCMto73tnoeKi7Nc80qC1lGthZXViZEcTJ2U bkDSSkNgv6KfKc5rkXHXdCOLXl0pa3yExsiLYi3ziEpQklZoXWxMJ6v4NRCP7ELNMS2F oJA8Kxs5gJgGYfHogJITWJD54hoPJdmlwmh9e8NVIlRYar/chLySqC6AxLpxzpnmk1hL pFTve8Ih3Rk917IsLPLQhR4ddiWwuWO9DSHGyZZi9SZHXe+61zoHi6EZC/Z3HZlPcYFE TMIQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=O1YgHwmR; 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 d9si8472663qto.230.2020.03.15.06.42.07 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sun, 15 Mar 2020 06:42: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=O1YgHwmR; 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]:54092 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jDTWo-0001zd-PP for patch@linaro.org; Sun, 15 Mar 2020 09:42:06 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:50863) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jDTJk-00088E-Ht for qemu-devel@nongnu.org; Sun, 15 Mar 2020 09:28:38 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1jDTJi-0003Rd-ML for qemu-devel@nongnu.org; Sun, 15 Mar 2020 09:28:36 -0400 Received: from mail-wr1-x442.google.com ([2a00:1450:4864:20::442]:36803) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1jDTJh-0003L7-P0 for qemu-devel@nongnu.org; Sun, 15 Mar 2020 09:28:33 -0400 Received: by mail-wr1-x442.google.com with SMTP id s5so17917949wrg.3 for ; Sun, 15 Mar 2020 06:28: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=a8zAz9iWkn+7gzsaWAdfIiX2cwmNIeyNTWkgmqsB7IQ=; b=O1YgHwmRDlcL2q3Mvm5dtHYKy+CScFTB5SB1mJZMHddv7okzOnT5ZEWL2oMPzC9map my8NjX/MdDRdTYYh0WTGbCP4+4rWC55pw/C4Gs4QReAjt4UDYFdEroAYgF6pyMl/hXEB WQyfuxOwtCm/JF9v2Zz9BOLXJYCcU60uNzcO6W5fmr+Mu4c/0SrwbCXP6Udt6hfuv4uP XRv8/CRrmFi75FHGaqc9Yp/e1XIkV/hB9HeC4OSk6tno7RGDvRS1yYq3RGwIZi6PedFN COzFmEhx2PLg8AKuDyKMyAwtO2Lkpx8JgJps3BYfNdXJIU7ha92zliymdDDdprvBoGQX nA5w== 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=a8zAz9iWkn+7gzsaWAdfIiX2cwmNIeyNTWkgmqsB7IQ=; b=gf0QO+1NQS+5YPF6ao8YlGKOuBeznME9MlksrC2EL8SVS07zFFd3v8luscAoJakAt3 l4sguE5ewsMyMSTHjfxFPIES9zW9u5GTNI+c4gKBawXZ3YPLxY7s04Tok4e+BZ3q2TTx 0SmXzdO7CxOeynDacNd89XtwcaoP74mYKXdwPACUNV7AW1oFwrDWfMef+27dbc+IoNjX 4T3uyd17oWFHtWLG8JoyuS+WBqTj+5YRF9k0+p8/RJrE3oamCtE7m3A+hLa3A5J4n2s5 jArrumCfY9x3K/sJYhFYY11zycpRrI6dV1P3wNe60O+6J54r0e+jrY7Xtgyuca8ZI0NT V8LA== X-Gm-Message-State: ANhLgQ0jhjSyVQsaA6e8bXD87/+NzOYdErg7vunJDDf5HQndV+Ynn8m8 iY9RQsDusNLLHgJZ1+mJy9krrD1+ X-Received: by 2002:a5d:6a04:: with SMTP id m4mr29270735wru.127.1584278912115; Sun, 15 Mar 2020 06:28:32 -0700 (PDT) Received: from localhost.localdomain (191.red-83-42-66.dynamicip.rima-tde.net. [83.42.66.191]) by smtp.gmail.com with ESMTPSA id d15sm87590503wrp.37.2020.03.15.06.28.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 15 Mar 2020 06:28:31 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Subject: [PATCH 11/13] target/rx: Collect all bytes during disassembly Date: Sun, 15 Mar 2020 14:28:07 +0100 Message-Id: <20200315132810.7022-12-f4bug@amsat.org> X-Mailer: git-send-email 2.21.1 In-Reply-To: <20200315132810.7022-1-f4bug@amsat.org> References: <20200315132810.7022-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::442 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: Yoshinori Sato , =?utf-8?q?Alex_Benn=C3=A9?= =?utf-8?q?e?= , Richard Henderson , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , 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> 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 Sun Mar 15 13:28:08 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: 184560 Delivered-To: patch@linaro.org Received: by 2002:a92:1f12:0:0:0:0:0 with SMTP id i18csp1698674ile; Sun, 15 Mar 2020 06:37:41 -0700 (PDT) X-Google-Smtp-Source: ADFU+vurTAwUmvRsDuWuUEXeuU1URzBrlM8IDsBUj1u8ITqKkYsjbV7/YUPncZOXCJ/ptgG67xU1 X-Received: by 2002:a37:9c07:: with SMTP id f7mr22483781qke.349.1584279461229; Sun, 15 Mar 2020 06:37:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1584279461; cv=none; d=google.com; s=arc-20160816; b=UCtKSL7WZnK5GInMU0YB7zbtdwvjSzD3w7+/IE+VIHAgSaG9cz9XslKbexCGXs9eEh uSWynwDTBLdED2olnQrf3qjE/vyAUBWsubf57110JcfE4Lb1FRHnTpxnDLom8qRi0O9l OoHBMX0crXLo84jucn4038ALRAudbVcB3aKUrQTgPpO3q3SmM/ezTFgV9jsYu7eHQxFv Dl2FgG7SsUuLKmsAoD0oVEKw1sO9fo/YE7bJFiNeZCJsH6iF8ijdZG+ldgXmT4/WHRML iZVQDmHJplVX3ocKtfNadaLekRsKb1WduR5hYAoJKCLcwbMb9yV/S6J8p1VyD/FRVZPj kLbg== 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=rtyy8CX6lQ0m3U8wFWf3AzT/p7YOaZwtAFg++0OM+ps=; b=aKmYt51SPmIN+dBcQqHlsfakjQZ2gDIkUfXFuq0ugoXVsFOCOTZuWLenPozpxu9fr/ w9J0NWaEvP0jGyB77/mynjB7/HjaxIfsCs7oEVU+MZNvT/9FO2iqfOJ+6AKFh/2PUMuI RFqNys+XetpWRjMSYsZAoCFogp6HqVSRejC+1WY/KQZC+UtQgdDbOsRKivNs+sL/+8W+ qX28uXg+KhKcqeLbYK3unnUaZtalh+7rqXM1Dqf83TGJFWJiN7KUlKMxdsYeVLBRlcqk UkFF/+GxGAUcI7GRRsUHMIu4dBNrVQmK4a2MTaDbNauYcjDE4lhfPmtrjdoz6hvEf88b 6ejw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=JlLN8yVK; 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 u89si8735267qtd.76.2020.03.15.06.37.41 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sun, 15 Mar 2020 06:37:41 -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=JlLN8yVK; 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]:54048 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jDTSW-00075y-Nu for patch@linaro.org; Sun, 15 Mar 2020 09:37:40 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:50922) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jDTJl-00089o-Sx for qemu-devel@nongnu.org; Sun, 15 Mar 2020 09:28:39 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1jDTJk-0003Wf-NA for qemu-devel@nongnu.org; Sun, 15 Mar 2020 09:28:37 -0400 Received: from mail-wm1-x341.google.com ([2a00:1450:4864:20::341]:35894) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1jDTJk-0003Qd-FC for qemu-devel@nongnu.org; Sun, 15 Mar 2020 09:28:36 -0400 Received: by mail-wm1-x341.google.com with SMTP id g62so15117060wme.1 for ; Sun, 15 Mar 2020 06:28:34 -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=rtyy8CX6lQ0m3U8wFWf3AzT/p7YOaZwtAFg++0OM+ps=; b=JlLN8yVKsJtkMAokOUasuGG7z7aQ20ngIy//oSRTN2kvpOKeyS/eD0FVATR8ky75mt Ui8tyIIm1pBInZysWZnwjJHI6KmZVRZg6EWzhRs9a7IgOV1fooohlNMyHi8YB4L2Pgbm zJ9KB8Cvi2gkzZfTzEDFtX4SjI4dqPOh2t5o8zpCDTLe7TySU7JTWTTgjZK5FOe428+5 YFeU6Fq3MrxBKtVwMMWvLGSS7xubObEULYTbMNyuNO3yUX5xX4gCEzVTlldKc44DX/49 uc9zQ5aOD8+5T/epO6wO+P4MXbNKKhZEEnS2WevT6U1H0+TpY7ABpkRbxvxelKoSxdSh se8w== 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=rtyy8CX6lQ0m3U8wFWf3AzT/p7YOaZwtAFg++0OM+ps=; b=auL2QYGKD8sv7Bte4cSHnOlhExSsumzrqGI+QG+ruhTCECtzbkejsC123ejlnaLTA4 bRE29qgqjZ+bw5aukm/8XNTpRy0wgIhCDv3XtSGEJq6BJx7pAQvHMuH0SIQSA0pscPJC T4K/QYZsjulSJErSSVkgi7PDcfV4cAGpjii8BZhIBuguCvWZDkFa5YHt36UD1nMyOWsR HaiwdQW/fHgwwqxX0RSrXpLSfng689ru2V0UZakx1vqI/Ay7FjEdJG4cKMtaOGJSYdBo wn8ZP+DodS0G4UtUoI3hqjAjkMVxKX2g2gdE5FQ6K/P6a8wD5TbRLh94ufpAEI/Ncj3E g9/w== X-Gm-Message-State: ANhLgQ1lp+0xlkmM/jT3vMsb/Q+wQtRbZglTcYt0CpyVhAEvnFDvovB8 pDOjM/EmIPz9WerpSkq8EGDzyfWQ X-Received: by 2002:a05:600c:215:: with SMTP id 21mr22132041wmi.119.1584278913643; Sun, 15 Mar 2020 06:28:33 -0700 (PDT) Received: from localhost.localdomain (191.red-83-42-66.dynamicip.rima-tde.net. [83.42.66.191]) by smtp.gmail.com with ESMTPSA id d15sm87590503wrp.37.2020.03.15.06.28.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 15 Mar 2020 06:28:33 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Subject: [PATCH 12/13] target/rx: Dump bytes for each insn during disassembly Date: Sun, 15 Mar 2020 14:28:08 +0100 Message-Id: <20200315132810.7022-13-f4bug@amsat.org> X-Mailer: git-send-email 2.21.1 In-Reply-To: <20200315132810.7022-1-f4bug@amsat.org> References: <20200315132810.7022-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::341 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: Yoshinori Sato , =?utf-8?q?Alex_Benn=C3=A9?= =?utf-8?q?e?= , Richard Henderson , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , 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> Signed-off-by: Yoshinori Sato 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