From patchwork Mon Aug 23 19:55:18 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 501563 Delivered-To: patch@linaro.org Received: by 2002:a02:6f15:0:0:0:0:0 with SMTP id x21csp2497845jab; Mon, 23 Aug 2021 13:06:36 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzgBCpTyvtr2pjYOYBoT/2IiiE7dQDOwL4icy0flkvosPemH0Kq20hZbl4RuqyKtS3bp5Z2 X-Received: by 2002:a17:906:a0da:: with SMTP id bh26mr13554691ejb.505.1629749196098; Mon, 23 Aug 2021 13:06:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1629749196; cv=none; d=google.com; s=arc-20160816; b=PTh1a+cFeZMEawFH1yrBmOENaqQhCDUFAmzQzK6a4rLBOd48jyiB5UnBttEyq7oFsm ImpkNylIYXTAWAlY1PE1jDMh6RwjWW9JM36C07mPY+GP7PFE7mxVliBXyu4LmO5Gcsvh 0T5aaiL3XKuERpuJq6WYn7bu7fLro0X2Nt/eJQRDFMy6S/2fhg4NrwizLKYFgeGnTpIk ZEfLydK30wwNXNAViZbiqqwvPAHhJG684ZTI2/VRqV8VJH4W+YLxglEAYUj530CLD9En FJmmubzJ4bGNC2OzMuWlSl5ob+ayhA08pNPCsyRyD99v56N+cIUa4Ml/iiQaJArAdJVA dclg== 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=40H5/R04EummmzhsS/xa91Ypx0fRpPh7Qw4dLzf/bOY=; b=xRLYWteDCTgQXBbHz9e6wxh5vo+pudjN2sg0F/dcJa9IJ5FEVZWmAAbgNyrDKksnP7 uIT0XC1wcFzoW+Q0vzLeDnTIbWzZ7OnU2Zn6D9gv2KNqZhNH3XLx+y7xiTchOCEKQF0i G5QMMQP49/pvLzrvqM8Ghu333UfVYXTkD0XDALWeKZd4Z0S+iiudgexUuD1yABJlJAsn mfm5tv+9eHv6v2ZRXENlZ1Q1QYKIeOI0t5vSxoOEJZHpJL3QcyI21XkFrrcw0D8gIuRA 1eQ7bHdSlWRCS+86dGG68AYM0godme0aVVB1ujzuCNwkBGCsyMEctw6XBsEXkIHmdhFk 1mtg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=IOLviqNL; 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=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id gn9si1570653ejc.136.2021.08.23.13.06.35 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 23 Aug 2021 13:06:36 -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=@linaro.org header.s=google header.b=IOLviqNL; 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=linaro.org Received: from localhost ([::1]:49422 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mIGDL-0003uK-1Y for patch@linaro.org; Mon, 23 Aug 2021 16:06:35 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:59510) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mIG2w-0006MX-Kp for qemu-devel@nongnu.org; Mon, 23 Aug 2021 15:55:50 -0400 Received: from mail-pl1-x62f.google.com ([2607:f8b0:4864:20::62f]:46627) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mIG2o-000390-2x for qemu-devel@nongnu.org; Mon, 23 Aug 2021 15:55:50 -0400 Received: by mail-pl1-x62f.google.com with SMTP id u15so10781598plg.13 for ; Mon, 23 Aug 2021 12:55:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=40H5/R04EummmzhsS/xa91Ypx0fRpPh7Qw4dLzf/bOY=; b=IOLviqNLR/HtSko6IvikFv0I+2vNcAX6zuI4bLbcDaxLZOYRhyzfjv6spgR2qwqnUr gWYFg15T+ycaaP6sZZqm0TSwgOjwYicZfzrX/zwkcYRDnj8/i63m+cdPHfCXJHiv6ToV 0MWqQR+qLV4penTWjFXydhgEciwm70ub5dk/kv8CySNQ8LWlJq518mJwGMVhfkljmwJU Sq9u0srUbx5G97CRFucRog2f0VXvW+OEGxZajnnIhWH9jM0H+H7UmMa7UmDcCOH4pbff 2bPNsEuHgrPReVwbt/4HuC3feBlNu0DLgPaAU6Zbij/9M8dtxn5cWGOoHOlmXlAL2Eiz 5yfA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=40H5/R04EummmzhsS/xa91Ypx0fRpPh7Qw4dLzf/bOY=; b=Pu7bP4VVTJWKQHx/d0px3/uL0LPzemJLt6wABAGWjTs+Egko3lcyAQBc2VP8/bXGmT 1r7RM57k1kYPjl9wuZie3ljQMMy3ySDkd3ExeVZRUzms02qW2ap2lvmNV5A0m+Dtf60T oEoTfsUY0GR0ZUeSUi3PRyrbfo6b+ipM1BNeGumGlHTPfzkQBQlg8CjfWu5ptwwBYM1g 4Gn3pk2hrM/w7/NZPNIQef2RwGpK5C3NQPFyL4AXtlHXu2h4JTPP/eOtSQ99CO4v80sU 34BQ3IAm+5NyLrCuIv34cua6+8CHtUEzmsOJwG93v5/XX++P3ECGO36sWOn5BM6fWOR8 4qlA== X-Gm-Message-State: AOAM531B4cogXF/xTMfYIaLl2E4NCBkVP+IMhRYrvTohsXmFWCdKLZOo QpuiDnBdXGfdgariWY8z5pWTHwD7jkstnA== X-Received: by 2002:a17:90a:a104:: with SMTP id s4mr248034pjp.184.1629748540646; Mon, 23 Aug 2021 12:55:40 -0700 (PDT) Received: from localhost.localdomain ([71.212.149.176]) by smtp.gmail.com with ESMTPSA id v15sm16685078pff.105.2021.08.23.12.55.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 23 Aug 2021 12:55:40 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v5 13/24] target/riscv: Use extracts for sraiw and srliw Date: Mon, 23 Aug 2021 12:55:18 -0700 Message-Id: <20210823195529.560295-14-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210823195529.560295-1-richard.henderson@linaro.org> References: <20210823195529.560295-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::62f; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x62f.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.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: alistair.francis@wdc.com, bin.meng@windriver.com, qemu-riscv@nongnu.org Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" These operations can be done in one instruction on some hosts. Signed-off-by: Richard Henderson --- target/riscv/insn_trans/trans_rvi.c.inc | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) -- 2.25.1 Reviewed-by: Bin Meng Reviewed-by: Alistair Francis diff --git a/target/riscv/insn_trans/trans_rvi.c.inc b/target/riscv/insn_trans/trans_rvi.c.inc index e4726e618c..9e8d99be51 100644 --- a/target/riscv/insn_trans/trans_rvi.c.inc +++ b/target/riscv/insn_trans/trans_rvi.c.inc @@ -347,18 +347,28 @@ static bool trans_slliw(DisasContext *ctx, arg_slliw *a) return gen_shift_imm_fn(ctx, a, EXT_NONE, tcg_gen_shli_tl); } +static void gen_srliw(TCGv dst, TCGv src, target_long shamt) +{ + tcg_gen_extract_tl(dst, src, shamt, 32 - shamt); +} + static bool trans_srliw(DisasContext *ctx, arg_srliw *a) { REQUIRE_64BIT(ctx); ctx->w = true; - return gen_shift_imm_fn(ctx, a, EXT_ZERO, tcg_gen_shri_tl); + return gen_shift_imm_fn(ctx, a, EXT_NONE, gen_srliw); +} + +static void gen_sraiw(TCGv dst, TCGv src, target_long shamt) +{ + tcg_gen_sextract_tl(dst, src, shamt, 32 - shamt); } static bool trans_sraiw(DisasContext *ctx, arg_sraiw *a) { REQUIRE_64BIT(ctx); ctx->w = true; - return gen_shift_imm_fn(ctx, a, EXT_SIGN, tcg_gen_sari_tl); + return gen_shift_imm_fn(ctx, a, EXT_NONE, gen_sraiw); } static bool trans_addw(DisasContext *ctx, arg_addw *a)