From patchwork Fri Oct 20 20:43:07 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 736331 Delivered-To: patch@linaro.org Received: by 2002:adf:dd81:0:b0:32d:baff:b0ca with SMTP id x1csp502903wrl; Fri, 20 Oct 2023 13:51:35 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFY93RheL9yH6I/b9c+CccY+Aix6vWI5L4Pdc+8Kl1HrtzSb9HFKnpv5XQF1kHCUkU/XrDm X-Received: by 2002:a0c:cd10:0:b0:66d:19d6:2eb5 with SMTP id b16-20020a0ccd10000000b0066d19d62eb5mr2525493qvm.7.1697835094848; Fri, 20 Oct 2023 13:51:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697835094; cv=none; d=google.com; s=arc-20160816; b=Jy91aFnJv2ubG3JdoeWuifDPh9Mb8tmSri/696v69lreauqftTxckszUB+F7Ss7ugI aWlugN9yXQ51onOmhWG+e9nBhdHYfmhUGaeyBh8VC9lgPDQjagw8L8v4gApHgkiuVFd9 Nnbl5AqOfzpWgxvpSs+nQtRSDh+OH+XJif5z+gvAHkfflMNxJdfV+sVnnk3Tm2mSpyYI ld8UFi6oFpVrVA2pAhe9zG15BxX9tpZabAy8Ze+oaxs3QICY4TmaSMgPkvfylvrKEFlq JQiOTbBjiUWxj0GST5lVCvvn4IYShjTq167HGUEuBWTdtugrCLiaebSFwO11RI+YRBYT PNGQ== 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=HnFt0Jqc97RoWbYAH0MygVjhqU7llo2mciBhZg9UKaQ=; fh=f2WZoDMBYjCKWIIOoPI+rQtxlv4fmOm4u+dLdQLqpOk=; b=s91hp0AA43ut0Kn2BptfWuP3P4wL1KnmQF8X11/yEqcrqjjlVoDVfj3LUpU5kgsGsX /agfFRjTgPjoJ4U48oFwOkChxiUabvkhODbJfYOOZbnTHoFCmLaem8TaEwKBkjVqm0BH /Kxxrsb0Oj8NXjhm0MgarTH9gd+AHm0ldIFptONO0LIBsoJuYCZMwmj42yZ4ANxJ7mOv 7rN9yfmO2yLlqwe5q79Gzt/Up1Ni4eVVjQ7mR0Y+3rTe3eRzwOHTqHPLSNcyIW0MXJF7 +MW4Zk7/YHIprW/6uEswyBP7XAEJyHt5ODuo4oiQGK6ZY+dPrVu3obY1NDXjgwfR95Ap Fx4g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=RXz1t7WK; 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 i7-20020a05620a0a0700b00775907603f0si1785136qka.470.2023.10.20.13.51.34 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 20 Oct 2023 13:51:34 -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=RXz1t7WK; 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 1qtwOp-0001kY-3H; Fri, 20 Oct 2023 16:47:15 -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 1qtwOn-0001fh-0X for qemu-devel@nongnu.org; Fri, 20 Oct 2023 16:47:13 -0400 Received: from mail-pf1-x42d.google.com ([2607:f8b0:4864:20::42d]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qtwOl-0001A1-7r for qemu-devel@nongnu.org; Fri, 20 Oct 2023 16:47:12 -0400 Received: by mail-pf1-x42d.google.com with SMTP id d2e1a72fcca58-6b3c2607d9bso1166278b3a.1 for ; Fri, 20 Oct 2023 13:47:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1697834830; x=1698439630; 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=HnFt0Jqc97RoWbYAH0MygVjhqU7llo2mciBhZg9UKaQ=; b=RXz1t7WK/hFdf9lZ3aSXcjOsYUoY7Ez5fCNp3N7+dk6lhG+Oneh2EFuooIueXWDYQ3 7nw6jcJENJHJBGfFG6bSSZQa7FljLckijEDpEO35eOQlpE+zx8bRJ5y7hZ3Hjzu8jSjs IC8gB3Wk04gweH+P+LLGWbd7xxiychoNjU7yDCAvuRf1s2EHX/1lf8cEG0mlxG8lJKAS K7AmNLFudXDTde8sJsOvsBZ0NDhT5ArsL7gr1qiXpRiaOszenlrLGinz4lb14RBGY4Ms 3avkj2ACv3oHepU+FRD6iNMgQ7WxbWxEsCvV9dWHwmXwodhbbTUW87SVCCJYYUAeEmkv xcNg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697834830; x=1698439630; 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=HnFt0Jqc97RoWbYAH0MygVjhqU7llo2mciBhZg9UKaQ=; b=dh5GLyD3P5qopi6JutlQMysNbfJFLh0Qptji3dlHmkJqNWT73IKBx5ZmSW0HkUi42l 0CSDMY/Pb5fD6rrZ+E7p85izg8MS5gWJmqAqj6jtM0wfm0Q3Y3KtgutFtokyiDtfFHdE ucZPeQ002s91t3i6ygi9ZDuw9+sAH8v34fM2T/88Iah/e/G9ji6jVQV+Z+/txCtvizPa LQzCuOm7hYYeOEzZwlPDA0/vVI+5T11SghAVhrXZc95UGj6vqf8YCNwRpOMQ5qRjpCpU 9TeG2k606jLVUABwrLve5RZRO9ZH3UwPj2+mjGJS8vJatrzqPB05AuPC3L9mG8B64Ela xNRw== X-Gm-Message-State: AOJu0YyJ3+/B3GSVoKgSg44JcFlMX393QoYBDzejUymlHs/6/KqwzAYh 0HAGJm3JoN3fT5enRjemFtQv1IzNHZ2FQrC9saQ= X-Received: by 2002:a05:6a00:194a:b0:690:bdda:7c35 with SMTP id s10-20020a056a00194a00b00690bdda7c35mr2914314pfk.1.1697834829946; Fri, 20 Oct 2023 13:47:09 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id u7-20020aa78487000000b00694fee1011asm1946775pfn.208.2023.10.20.13.47.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 20 Oct 2023 13:47:09 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: deller@gmx.de Subject: [PATCH v2 41/65] target/hppa: Implement EXTRD Date: Fri, 20 Oct 2023 13:43:07 -0700 Message-Id: <20231020204331.139847-42-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231020204331.139847-1-richard.henderson@linaro.org> References: <20231020204331.139847-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::42d; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x42d.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 5d07d0d890..99b7622841 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); }