From patchwork Thu Nov 2 01:29:39 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 740378 Delivered-To: patch@linaro.org Received: by 2002:a5d:538f:0:b0:32d:baff:b0ca with SMTP id d15csp595316wrv; Wed, 1 Nov 2023 18:38:31 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHjeBT1Z65dgvHgu3WK4OLMn0j09TLm+sU7qs0ORs2pl08FVVaM7l7GKFRXCZ9+6v9GVK8i X-Received: by 2002:ac8:7d44:0:b0:415:138e:d858 with SMTP id h4-20020ac87d44000000b00415138ed858mr20664143qtb.60.1698889111342; Wed, 01 Nov 2023 18:38:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698889111; cv=none; d=google.com; s=arc-20160816; b=HT7QeE7q4ZWDoeVHlMh1wPL6iUfyHs4BtL3qgGEnAIZJafa0ckUKJyoY6M6zdBC3q/ /8jGBTdKM3OQzTfOcf/ID73nfCTujtHVxQIKdYhGqMWntNtehmV5jlU3rnz5yk+xDC8d SEWrF8UAKMOt4uWDPGTz0tZR6CslcZ0OPnqCCC3kkrol3lPaJtjcGcwibGEutczoSze7 +MiNxCB4x1RO9joBozYOg1hBjCTe3rrK5B7U8Fqx2qNSvP8/t1XugJaelzA/5aXgTAqo 9OpkY1HjBG+9hnWKHKvcGPOv0jz9Q5Uokw86nUX87OpHeX5YFonnpyjebUYY7D4JreY9 xTWQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to: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:cc:to :from:dkim-signature; bh=oL/Q9k4VdGpuvjlQ5aW5bW/J8E3SoDMupdQ5tQzg65o=; fh=f2WZoDMBYjCKWIIOoPI+rQtxlv4fmOm4u+dLdQLqpOk=; b=MU7EVVbvOsaXG9IaIuP6Sb1V6qswbc7mZ0IuMG1fCLASKLAu9mKP3xm8ipiIy8V/ch 3AJjrfZP7HIYRPfYdyOzvow5cbfRFo3h+f0rByaBMXYKqEBG8I3kzeEiwKtqgDVStH0B HqBAjZHLUUwNcEDVn3fGLDa675aSXw4HhkJm1MJ6dpZbXoNjjRo30O/4/39aDvDmJu3K OQF1ALQce7A52g+hVr4qdrx9NI8F6YyGJOHspCDqk/X2+5TLiBSmJ1yjI1OnVDgJ1A8v UDlJLjQ87f8Cq/qYQjVWLHJx2ubUDhF8JD72bssEZZP/cn14ylF6Wwa1e8d4IzMx5Ypg 4dHg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=eH3k9t69; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id s6-20020a05622a1a8600b0040538e3e2e4si3834430qtc.266.2023.11.01.18.38.31 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 01 Nov 2023 18:38:31 -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=pass header.i=@linaro.org header.s=google header.b=eH3k9t69; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qyMbN-0006fX-UZ; Wed, 01 Nov 2023 21:34:30 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qyMaz-0006QP-Ox for qemu-devel@nongnu.org; Wed, 01 Nov 2023 21:34:06 -0400 Received: from mail-pl1-x62a.google.com ([2607:f8b0:4864:20::62a]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qyMay-0001wE-2b for qemu-devel@nongnu.org; Wed, 01 Nov 2023 21:34:05 -0400 Received: by mail-pl1-x62a.google.com with SMTP id d9443c01a7336-1cc5916d578so3297185ad.2 for ; Wed, 01 Nov 2023 18:34:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1698888842; x=1699493642; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=oL/Q9k4VdGpuvjlQ5aW5bW/J8E3SoDMupdQ5tQzg65o=; b=eH3k9t69KZ/8pNWKRsDkCSTcprj9rzumLOWCsLtP2avJ4HoGkmOY8+u7JIEjRBL61I Fonty8K50pyJADJzn3ESOxgmCn+x7jPB7djQ8SR+tOnv34I8zRP7oReXxwMbPWB1fzD9 hIlx3Y7XelvhkE3el77owhkVGDCUyiyppre1hL4YofDbkdWR7lCKPMs+dGdCJ5lCLUU9 MNuMogAtppoKDbPKwjM5JJ217q5VYnH8e6aVVl1fnOlCczHIzpBRZFQqVAxsbKnXFjTe C+u26Xo0DftqFwjRdZaGiiSphwb4IS3PjWbZRzvu/FAAHl2cOULmRldLmfyZn3Dl5YzN 0poQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698888842; x=1699493642; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=oL/Q9k4VdGpuvjlQ5aW5bW/J8E3SoDMupdQ5tQzg65o=; b=Va/mHt5zkGhBeA3iH1acX+dY1ctaQW5Q8Siez7F2+vAlxvOi8ZDNZVli7SZnuA1SJB DH4Ol7H3Y58fpKKg73t6dK+APPOuaJY51U/mn4EnQSpLu9wpAH+vUr6blwB9Ey7RiXYr IZIIDVw0Zx9HtG1a5TQZBkga1DN0937Zo3lZcwSheTLWSGErRCeIS6EcWxP/slEtOq9N Uu5F6RhLOvOIba2MHYWJK7nxSk7xvnEh6rbdNnHRMfIY+dqzP89XgFpJ1CtBnHkVikxk Lct17jJEgIrgxz8EVAT2JAGrLfGPfvZPzadijGcNoUS4ZUdpd2wFYp6rcvgkWKP1oSQ7 OeOA== X-Gm-Message-State: AOJu0YyluM7QqxoppYVRNtgwXODu6aI/ZH0aCgzshpEnspBiGN9YuMrv iexDR+mdXtJTAQ9GY95dh3mlhpve2Dsl4FXX+lc= X-Received: by 2002:a17:902:d144:b0:1ca:28f3:5690 with SMTP id t4-20020a170902d14400b001ca28f35690mr15738759plt.46.1698888842727; Wed, 01 Nov 2023 18:34:02 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id t2-20020a1709027fc200b001a98f844e60sm1918125plb.263.2023.11.01.18.34.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 01 Nov 2023 18:34:02 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: deller@gmx.de Subject: [PATCH v3 51/88] target/hppa: Implement EXTRD Date: Wed, 1 Nov 2023 18:29:39 -0700 Message-Id: <20231102013016.369010-52-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231102013016.369010-1-richard.henderson@linaro.org> References: <20231102013016.369010-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::62a; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x62a.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org Signed-off-by: Richard Henderson --- target/hppa/insns.decode | 7 +++++-- target/hppa/translate.c | 42 +++++++++++++++++++++++++++++----------- 2 files changed, 36 insertions(+), 13 deletions(-) diff --git a/target/hppa/insns.decode b/target/hppa/insns.decode index 12684b590e..7b51f39b9e 100644 --- a/target/hppa/insns.decode +++ b/target/hppa/insns.decode @@ -335,8 +335,11 @@ addbi 101011 ..... ..... ... ........... . . @rib_cf f=1 shrpw_sar 110100 r2:5 r1:5 c:3 00 0 00000 t:5 shrpw_imm 110100 r2:5 r1:5 c:3 01 0 cpos:5 t:5 -extrw_sar 110100 r:5 t:5 c:3 10 se:1 00000 clen:5 -extrw_imm 110100 r:5 t:5 c:3 11 se:1 pos:5 clen:5 +extr_sar 110100 r:5 t:5 c:3 10 se:1 00 000 ..... d=0 len=%len5 +extr_sar 110100 r:5 t:5 c:3 10 se:1 1. 000 ..... d=1 len=%len6_8 +extr_imm 110100 r:5 t:5 c:3 11 se:1 pos:5 ..... d=0 len=%len5 +extr_imm 110110 r:5 t:5 c:3 .. se:1 ..... ..... \ + d=1 len=%len6_12 pos=%cpos6_11 dep_sar 110101 t:5 r:5 c:3 00 nz:1 00 000 ..... d=0 len=%len5 dep_sar 110101 t:5 r:5 c:3 00 nz:1 1. 000 ..... d=1 len=%len6_8 diff --git a/target/hppa/translate.c b/target/hppa/translate.c index ea2150cc55..533e29879e 100644 --- a/target/hppa/translate.c +++ b/target/hppa/translate.c @@ -3354,11 +3354,14 @@ static bool trans_shrpw_imm(DisasContext *ctx, arg_shrpw_imm *a) return nullify_end(ctx); } -static bool trans_extrw_sar(DisasContext *ctx, arg_extrw_sar *a) +static bool trans_extr_sar(DisasContext *ctx, arg_extr_sar *a) { - unsigned len = 32 - a->clen; + unsigned widthm1 = a->d ? 63 : 31; TCGv_reg dest, src, tmp; + if (!ctx->is_pa20 && a->d) { + return false; + } if (a->c) { nullify_over(ctx); } @@ -3368,36 +3371,53 @@ static bool trans_extrw_sar(DisasContext *ctx, arg_extrw_sar *a) tmp = tcg_temp_new(); /* Recall that SAR is using big-endian bit numbering. */ - tcg_gen_andi_reg(tmp, cpu_sar, 31); - tcg_gen_xori_reg(tmp, tmp, 31); + tcg_gen_andi_reg(tmp, cpu_sar, widthm1); + tcg_gen_xori_reg(tmp, tmp, widthm1); if (a->se) { + if (!a->d) { + tcg_gen_ext32s_reg(dest, src); + src = dest; + } tcg_gen_sar_reg(dest, src, tmp); - tcg_gen_sextract_reg(dest, dest, 0, len); + tcg_gen_sextract_reg(dest, dest, 0, a->len); } else { + if (!a->d) { + tcg_gen_ext32u_reg(dest, src); + src = dest; + } tcg_gen_shr_reg(dest, src, tmp); - tcg_gen_extract_reg(dest, dest, 0, len); + tcg_gen_extract_reg(dest, dest, 0, a->len); } save_gpr(ctx, a->t, dest); /* Install the new nullification. */ cond_free(&ctx->null_cond); if (a->c) { - ctx->null_cond = do_sed_cond(ctx, a->c, false, dest); + ctx->null_cond = do_sed_cond(ctx, a->c, a->d, dest); } return nullify_end(ctx); } -static bool trans_extrw_imm(DisasContext *ctx, arg_extrw_imm *a) +static bool trans_extr_imm(DisasContext *ctx, arg_extr_imm *a) { - unsigned len = 32 - a->clen; - unsigned cpos = 31 - a->pos; + unsigned len, cpos, width; TCGv_reg dest, src; + if (!ctx->is_pa20 && a->d) { + return false; + } if (a->c) { nullify_over(ctx); } + len = a->len; + width = a->d ? 64 : 32; + cpos = width - 1 - a->pos; + if (cpos + len > width) { + len = width - cpos; + } + dest = dest_gpr(ctx, a->t); src = load_gpr(ctx, a->r); if (a->se) { @@ -3410,7 +3430,7 @@ static bool trans_extrw_imm(DisasContext *ctx, arg_extrw_imm *a) /* Install the new nullification. */ cond_free(&ctx->null_cond); if (a->c) { - ctx->null_cond = do_sed_cond(ctx, a->c, false, dest); + ctx->null_cond = do_sed_cond(ctx, a->c, a->d, dest); } return nullify_end(ctx); }