From nobody Mon Nov 25 11:54:40 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1716752633; cv=none; d=zohomail.com; s=zohoarc; b=C5DLB6tqIBlkwC4D8H9heQzEDQ/JWIhXwM8Bgt/FzGRRgw7fK/DOqZ6lrYscD8/xkFq6qzYKLYBLCuD0oV5jKhyppHT6MIb+oZAlhROZZjRn6JEgF6cynPiDkx497i5uzRJuHks+UacK9LALV242o1QvlXA2kLp015lEyrVRifw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1716752633; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=yXW/Ltrfsx0MGgRbMt9NN8XXyTF3WwZ3uL7yZtfeN4I=; b=bW+xZsday4MRQoLBpiV2DV1SpC0GMLJDCYA6TUOWOaxPUycMnoAPc7qYFnjNecxKNqwPYLVbu1pJ+DS2zHiT201/NCmQOKrS3+lYjoFr8T8/0QF6OIoNtvUTnWaN5/+JWQE1xO+Oms9vpzguuzq2LSMiFhaTDjoARMZUwGOyBDE= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1716752633870857.8889373299959; Sun, 26 May 2024 12:43:53 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sBJm1-0008Rk-2M; Sun, 26 May 2024 15:43:17 -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 1sBJlz-0008Nw-VM for qemu-devel@nongnu.org; Sun, 26 May 2024 15:43:15 -0400 Received: from mail-pl1-x62f.google.com ([2607:f8b0:4864:20::62f]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sBJly-0007hv-AY for qemu-devel@nongnu.org; Sun, 26 May 2024 15:43:15 -0400 Received: by mail-pl1-x62f.google.com with SMTP id d9443c01a7336-1f4a5344ec7so323505ad.1 for ; Sun, 26 May 2024 12:43:13 -0700 (PDT) Received: from stoup.. (174-21-72-5.tukw.qwest.net. [174.21.72.5]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-1f46ad93c2esm28165935ad.263.2024.05.26.12.43.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 26 May 2024 12:43:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1716752593; x=1717357393; 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=yXW/Ltrfsx0MGgRbMt9NN8XXyTF3WwZ3uL7yZtfeN4I=; b=g+OLwYBo2tLsJQ1aOxPH26rsvioRlluZ3EsXEQnXV34kUT+q8Z6WuMWrX2s32mlPN8 wrHWI02oqGUnE4PcxtQmbnQvw4TfjThOqTPrlsFInSFBPjqHVLOXmxqzxEudwsKWi5nV GycDdb9ZQqadak+7MWTKT1vnixTiD4Hwh8hygXe/SbnH4ScMdwZGSiOyDCU45QBTpy7B uNfHsMxQPJkWG0JGguU3WuZM+yMzbdD6SuBRGnnlrJDUAfaIWlBQ3lajFKmttHKQJ6gW J4TTMwHg2EQApjX4RsHKL4Dj7AW8TyyiQBj45Zwo+Pol2kxJ8jDme7eM6PA0hgv7dIDc ihWA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1716752593; x=1717357393; 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=yXW/Ltrfsx0MGgRbMt9NN8XXyTF3WwZ3uL7yZtfeN4I=; b=VkHPobZJl/V8gYXoTIQbbLLo376Nz9cGVZ0P+XjH4aYdV+CjRglBJj+lS+LRCP7T2+ DTnC7pI0Y0JocQ5OnHnT1IMKTIbKFoiCqDj3ImbXJ+oukOgQlbwnz9G4G6StOylrLer+ w3mdHR1tlEuJMVoT3mhhyvEAFgZXeD+ITbeT8JN53P1q0ClXb4zaDqKssAqK8lI5bGrd lkzSIYJ6PBvsURacayww9Ay2HIKxOMK5nSoe8rc87kApB4IUx87LKmUQ3ODXI8D+YFsu IDtZrKn8xtdWFwDGV771Ern/wrFDkKCAWaELH6dgieuPNVDMRBShwQAG/ZOhXNqg98mv BYJw== X-Gm-Message-State: AOJu0Yw+YXSg03+SiddtrJZwpyXWjDbjduZXh6ARZ5/nVBwlaOpwMCxl QpWqZwYV37VRjEVicNH/Ua/OwuDxzXexypk8mL02Y26otFaST9y8LKDN2CJyTcIXh/sR9fLVWnd 6 X-Google-Smtp-Source: AGHT+IGiOe3UDjGAF6aU9HOz3dIxwov5y1Hsp7B73IGobxjOKI6RQu13cO+bgmWxZqxw2E8nYjpOgQ== X-Received: by 2002:a17:903:188:b0:1f4:9139:e0ff with SMTP id d9443c01a7336-1f49139e34dmr17100255ad.10.1716752593012; Sun, 26 May 2024 12:43:13 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: mark.cave-ayland@ilande.co.uk, =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PATCH v2 22/37] target/sparc: Implement LZCNT Date: Sun, 26 May 2024 12:42:39 -0700 Message-Id: <20240526194254.459395-23-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240526194254.459395-1-richard.henderson@linaro.org> References: <20240526194254.459395-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; 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, 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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1716752636144100007 Reviewed-by: Philippe Mathieu-Daud=C3=A9 Signed-off-by: Richard Henderson --- target/sparc/insns.decode | 1 + target/sparc/translate.c | 18 ++++++++++++++++++ 2 files changed, 19 insertions(+) diff --git a/target/sparc/insns.decode b/target/sparc/insns.decode index fec055910e..4766964893 100644 --- a/target/sparc/insns.decode +++ b/target/sparc/insns.decode @@ -389,6 +389,7 @@ FCMPEq 10 000 cc:2 110101 ..... 0 0101 0111 .....= \ =20 ADDXC 10 ..... 110110 ..... 0 0001 0001 ..... @r_r_r ADDXCcc 10 ..... 110110 ..... 0 0001 0011 ..... @r_r_r + LZCNT 10 ..... 110110 00000 0 0001 0111 ..... @r_r2 =20 ALIGNADDR 10 ..... 110110 ..... 0 0001 1000 ..... @r_r_r ALIGNADDRL 10 ..... 110110 ..... 0 0001 1010 ..... @r_r_r diff --git a/target/sparc/translate.c b/target/sparc/translate.c index e3059f32bb..705fcb028a 100644 --- a/target/sparc/translate.c +++ b/target/sparc/translate.c @@ -658,6 +658,11 @@ static void gen_op_popc(TCGv dst, TCGv src1, TCGv src2) tcg_gen_ctpop_tl(dst, src2); } =20 +static void gen_op_lzcnt(TCGv dst, TCGv src) +{ + tcg_gen_clzi_tl(dst, src, TARGET_LONG_BITS); +} + #ifndef TARGET_SPARC64 static void gen_helper_array8(TCGv dst, TCGv src1, TCGv src2) { @@ -3873,6 +3878,19 @@ TRANS(EDGE16LN, VIS2, gen_edge, a, 16, 0, 1) TRANS(EDGE32N, VIS2, gen_edge, a, 32, 0, 0) TRANS(EDGE32LN, VIS2, gen_edge, a, 32, 0, 1) =20 +static bool do_rr(DisasContext *dc, arg_r_r *a, + void (*func)(TCGv, TCGv)) +{ + TCGv dst =3D gen_dest_gpr(dc, a->rd); + TCGv src =3D gen_load_gpr(dc, a->rs); + + func(dst, src); + gen_store_gpr(dc, a->rd, dst); + return advance_pc(dc); +} + +TRANS(LZCNT, VIS3, do_rr, a, gen_op_lzcnt) + static bool do_rrr(DisasContext *dc, arg_r_r_r *a, void (*func)(TCGv, TCGv, TCGv)) { --=20 2.34.1