From patchwork Wed Oct 18 21:51:15 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 735114 Delivered-To: patch@linaro.org Received: by 2002:adf:f0cd:0:b0:32d:baff:b0ca with SMTP id x13csp1226926wro; Wed, 18 Oct 2023 15:01:07 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFgVXz4GzEQVQiPKS16/CLVFPeEJrlMTsIlNoCshqNBlWAct3qKyIsOxjIaBkezXrPMtLHS X-Received: by 2002:a05:620a:288b:b0:777:5120:d5ba with SMTP id j11-20020a05620a288b00b007775120d5bamr486052qkp.8.1697666467498; Wed, 18 Oct 2023 15:01:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697666467; cv=none; d=google.com; s=arc-20160816; b=nCi+60By01w2u9tJz+DqbiPLfnzJlT+vyEpjtmoTSYL/BZZ9DxWuogZmYvxfjl+rql yFY+2LbDdFVK/bAi1R/ztkFBWn/RRO56SaFavmcq3yi2OFOhQoYDXV36B/Mm3pI4VF67 RhrSFZw6tO8YkHGG6UVaqqXh7pfoOvK8Y3w2Q8GNS52LPquZNky1ty4KQJkUhMbn9rmk WMJoapNuT9tSW+Um147r/0Fbp9vosZZjdNzWRJdFts8icBpVDirWWvW8zctgcvKbUOJM GT9Yyyh2hd1R2mtUnYmufumvOWRtlv2s1luilbtF9nxIv4dO42BkMCkLUvvmpY6tynvd i1cg== 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=78mYjhrfKONFT0vl9EP6HLOTdieHpipZhGsvKVkOOxE=; fh=f2WZoDMBYjCKWIIOoPI+rQtxlv4fmOm4u+dLdQLqpOk=; b=p89+tvuvHpB1LA99RSjTVTmePm/fhzs9PYufG9cAff9Ii46YAVnUoffvWCTDjPj6Uf Gz8iNS+0DfMz3ZZ703gz4H+/Vv1VqdJvcopLC7oPEToNAPT2YPpUZJAleOxHKGiDYr8M NWXzVbkKOZsfBn5p66sO8zppCjVAqlsJciKt5Fdq9v17tyZyKZ8uAa1dECwMB8Yhc+xA zYM/WREyLBR+XwYD9JIKNp6zW1FTbMdxCYyvFBPE4q9Vzu7MRF5gE/qLBdkhrweXVe55 3EpxTishOc7qVrlIt7GHQqtE1pAejHFO5Unmfj1+6/qbrEtKLFJzcstR7mAR1rrSkz8s Tfww== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Q24X8h60; 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 m21-20020ae9e015000000b0077748582bb4si591147qkk.421.2023.10.18.15.01.07 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 18 Oct 2023 15:01: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=pass header.i=@linaro.org header.s=google header.b=Q24X8h60; 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 1qtEVb-0001us-1D; Wed, 18 Oct 2023 17:55:19 -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 1qtEVX-0001ek-0T for qemu-devel@nongnu.org; Wed, 18 Oct 2023 17:55:15 -0400 Received: from mail-oo1-xc34.google.com ([2607:f8b0:4864:20::c34]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qtEVU-0004zp-FV for qemu-devel@nongnu.org; Wed, 18 Oct 2023 17:55:14 -0400 Received: by mail-oo1-xc34.google.com with SMTP id 006d021491bc7-581d487f8dbso1242494eaf.1 for ; Wed, 18 Oct 2023 14:55:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1697666111; x=1698270911; 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=78mYjhrfKONFT0vl9EP6HLOTdieHpipZhGsvKVkOOxE=; b=Q24X8h60vY6jTvh77B1Bqg6X3LBF6l3RCrgFVAGunsStqau97T5Y1vFe06HV7/n+Om cH/3YfVdXFekhM898ux65skTI3eIM/3pztV0xZI5FGUTdwjswtaDzREn77Sfd2wGJ/os +VybTMgqBT4eieCJztje2AvEdsfa/lMlCi+2U+mHwqEydl2vO06iBQJq9VUZu75YWe9E it+Kak7l/ZeoUzjYPS9DQcCALNO3MHMPVE8O4HyhHsxriaPyuCAZYZoWH37p7cYHmyI1 ltTcga0zEQ6ZAHKbbnS0jR7bhIUhcw2+PaZpm8u6pr6BulsyxEVgRh3JoJ/y32pfEcIa vKaQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697666111; x=1698270911; 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=78mYjhrfKONFT0vl9EP6HLOTdieHpipZhGsvKVkOOxE=; b=OebrRStvdzs/XOP9Z9uBMwxsE1jxpRDeyRdwXRBhC67KYB4dHkH2XCuUVLRfE/vOKV 4RsKJqtuSmXSyHhI1oG1b31oOxupvLIBpFIcSNEzSoHTYPHkhO0kEHmuVbuXo68Lozur 9iFx1lHcCwvXoCZXmsGLkHAaiaDQtX2I5WziVioIwkKtu8SC2+tr2wJ5Jb34aN4TcaBp j0QPjxYdVjOFWuLlmah73bHNfyt88e+dt6eJxPGOG1JpJAFz7ZbMJ+hqOEpoJVSnA5wl etCocZdqmS6fkigW7oRbJ/hdIWf7Yo+ussVsoga2dvCEYiiL6BIjon9BBsNDXJOc0bbt Fn8A== X-Gm-Message-State: AOJu0YxRCdFcL4Yg71v/MSiaZ3NDzXBUAQ3evc7X+SI6hKCXVNHGimgX 2Xn2LCkuCZmeNIDQquz9HUinmt+wF4vhn7kW1Q4= X-Received: by 2002:a05:6358:9d82:b0:143:81bd:c0ec with SMTP id d2-20020a0563589d8200b0014381bdc0ecmr252602rwo.6.1697666110784; Wed, 18 Oct 2023 14:55:10 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id r15-20020aa7962f000000b006889348ba6esm3796263pfg.127.2023.10.18.14.55.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Oct 2023 14:55:10 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: deller@gmx.de Subject: [PATCH 41/61] target/hppa: Implement EXTRD Date: Wed, 18 Oct 2023 14:51:15 -0700 Message-Id: <20231018215135.1561375-42-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231018215135.1561375-1-richard.henderson@linaro.org> References: <20231018215135.1561375-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::c34; envelope-from=richard.henderson@linaro.org; helo=mail-oo1-xc34.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 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 | 34 +++++++++++++++++++++++----------- 2 files changed, 28 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 b3d3506f94..974ed558d7 100644 --- a/target/hppa/translate.c +++ b/target/hppa/translate.c @@ -3333,11 +3333,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); } @@ -3347,36 +3350,45 @@ 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) { 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 { 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) { @@ -3389,7 +3401,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); }