From patchwork Tue Sep 28 20:54:49 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Philipp Tomsich X-Patchwork-Id: 1534078 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=vrull-eu.20210112.gappssmtp.com header.i=@vrull-eu.20210112.gappssmtp.com header.a=rsa-sha256 header.s=20210112 header.b=7ra+c0XO; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4HJsHL6h6Nz9t5G for ; Wed, 29 Sep 2021 06:56:13 +1000 (AEST) Received: from localhost ([::1]:37672 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mVK93-0006IW-My for incoming@patchwork.ozlabs.org; Tue, 28 Sep 2021 16:56:09 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:35168) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mVK7v-0006Hv-P4 for qemu-devel@nongnu.org; Tue, 28 Sep 2021 16:54:59 -0400 Received: from mail-lf1-x12e.google.com ([2a00:1450:4864:20::12e]:40594) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mVK7t-0003k0-Sm for qemu-devel@nongnu.org; Tue, 28 Sep 2021 16:54:59 -0400 Received: by mail-lf1-x12e.google.com with SMTP id b15so1439394lfe.7 for ; Tue, 28 Sep 2021 13:54:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=vrull-eu.20210112.gappssmtp.com; s=20210112; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=+/8a5g8ks8jgGNrjMXDP064TmRFSw6yw9mk8cFZ4RU0=; b=7ra+c0XOt/Pfia8QQWFY1vIa4bSIoqo7YkgjslGUYxESIcfn0o294nyCOcfOLzb8s6 D4PMYQTFrljKmgUN1xoG0sIAD7LHN2ZR1TunBWBGdI5xyiuSYRtFdw11QHWrXEWoJvd9 UXUAkNugcu5Yd6ufHZm0rMrpctjRW76vjhzY5B2wSlgYEdy1nGsW1s8SVM7YFVj1RzCv ZlyYJcxQFOAkCwEB+O9fGOyDaRxdOJYMcyExh3d/missZNKYS7g5Jb+v8GMHkq4eIZwh lLFOmElaEUhXRTIoQQRSb81RVZUKrhqG6Yv8iWPT5nFeSaIOl+aaGuWvaxfFu6xZEuKE BSXg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=+/8a5g8ks8jgGNrjMXDP064TmRFSw6yw9mk8cFZ4RU0=; b=C+Eq2mYMqc+BXP4VeXm+WY4mfDlrj4lbAnxbBWCnQT/Agh8Ta9MCp9eOR6YSQlwH15 tBWQOtqWLjhtrIZQPKbtBh/T7bqX2eUIyhR04gbqQE7AHXRzYz32qy1cEPrCX1nhzkdq nIp0HaiJm3xB8WN0R9IHqeg099ROBsIgNSySkoqqdRxysuyNXX67ToC0GZ53amGqPZYw d9JTVHimpQqB6FYn/DOYQG/q/p2BgJ4LU4LnmkO/+/sTF07cxZ/hsplWE7Yh+WMWHIDB vO1irszoisbHwSLtXQuU7d+GJ2I4F1w1Wwc2cqaN4+zIqsORMZEUCd0S6461jeOAfFpg tSsg== X-Gm-Message-State: AOAM5301bEjnzPxY/Gr6muCEgx5u/l7IlmFNM5Lm8ZzQ2id8/LiPeOsC Tpi5vTpA+95H705bIDxJ4Ffh7FcHEsJWJxw8 X-Google-Smtp-Source: ABdhPJxGV+kZ2Q/gwr4c3AwI6cExBVcqW+YOIoHEXKOsMN+1MLvFqUUnZCrDtJpqX+CKFoCJ2cgsWA== X-Received: by 2002:a05:6512:1294:: with SMTP id u20mr7479648lfs.1.1632862493954; Tue, 28 Sep 2021 13:54:53 -0700 (PDT) Received: from localhost.localdomain ([2a01:4f9:3a:1e26::2]) by smtp.gmail.com with ESMTPSA id l14sm24061lji.137.2021.09.28.13.54.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 28 Sep 2021 13:54:53 -0700 (PDT) From: Philipp Tomsich To: qemu-devel@nongnu.org Subject: [PATCH 1/2] tcg: add dup_const_tl wrapper Date: Tue, 28 Sep 2021 22:54:49 +0200 Message-Id: <20210928205450.4121269-1-philipp.tomsich@vrull.eu> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::12e; envelope-from=philipp.tomsich@vrull.eu; helo=mail-lf1-x12e.google.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-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 , Richard Henderson , Philipp Tomsich Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" dup_const always generates a uint64_t, which may exceed the size of a target_long (generating warnings with recent-enough compilers). To ensure that we can use dup_const both for 64bit and 32bit targets, this adds dup_const_tl, which wraps dup_const and legalises the truncation to target_long by casting it to target_long. Signed-off-by: Philipp Tomsich --- include/tcg/tcg.h | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/include/tcg/tcg.h b/include/tcg/tcg.h index 44ccd86f3e..8f8a209600 100644 --- a/include/tcg/tcg.h +++ b/include/tcg/tcg.h @@ -1272,6 +1272,11 @@ uint64_t dup_const(unsigned vece, uint64_t c); : (qemu_build_not_reached_always(), 0)) \ : dup_const(VECE, C)) +static inline target_long dup_const_tl(unsigned vece, uint64_t c) +{ + return (target_long)dup_const(vece, c); +} + /* * Memory helpers that will be used by TCG generated code. */ From patchwork Tue Sep 28 20:54:50 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Philipp Tomsich X-Patchwork-Id: 1534077 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=vrull-eu.20210112.gappssmtp.com header.i=@vrull-eu.20210112.gappssmtp.com header.a=rsa-sha256 header.s=20210112 header.b=RMI/7ux6; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4HJsHL6dvbz9t0T for ; Wed, 29 Sep 2021 06:56:13 +1000 (AEST) Received: from localhost ([::1]:37670 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mVK93-0006II-Qm for incoming@patchwork.ozlabs.org; Tue, 28 Sep 2021 16:56:09 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:35170) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mVK7w-0006I2-NE for qemu-devel@nongnu.org; Tue, 28 Sep 2021 16:55:01 -0400 Received: from mail-lf1-x12b.google.com ([2a00:1450:4864:20::12b]:39431) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mVK7t-0003jq-NO for qemu-devel@nongnu.org; Tue, 28 Sep 2021 16:55:00 -0400 Received: by mail-lf1-x12b.google.com with SMTP id i25so1458760lfg.6 for ; Tue, 28 Sep 2021 13:54:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=vrull-eu.20210112.gappssmtp.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=l7NwyCsKPg2tcKPnQR9UCjBUtzzDWMcHY9Hzri/9k5g=; b=RMI/7ux6jw6mliUVMWEajoun6rOyeVM8RMxvuqljNJkYATsEyIq41agKma9UeNvOD2 Ip81Uxu/P6UXIkViWzGwBPLTm+8wYKd2Ob2TBgrZOUlD0+jQckXGPcPiz/eSc490J3ki ww4vgpTVny7jxCAiK2Ebl+azPLOMzYoAoOmze7LXJ9N9yFm6rbT6cWLou5iTv/fql7Ys lIOH7ajORqjArcvTKZylzxBvSVH5IDc9Qz/IKdZf9797onc0LnV5TXBYKQxZ04kP7r4V D0C4aATKlf43UzU/p4GhcMYowA6juXs44z9q2TX1rqvSRuoUotYRhCA4x4CCOJfgFDJA z7GA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=l7NwyCsKPg2tcKPnQR9UCjBUtzzDWMcHY9Hzri/9k5g=; b=zKhJy+Z8Pt3Tw97hMinmxNlI4LFsC7ZK3CLa169Em00OgWPTZglg6eO7xJ12g/eWBV Vkf67uBzZBWJeI3iSLt0fd3fAp8npF3zyZScs0Da4E12d65i81z/kj3chsjiuE6KLsPL Ar21O5xBhSIHjiuyudiSaKdScB+/XMHVW5FqTosCAmsp6NqUHm2DqKdJH1qXyICJJTLs ExsEU8vP0DKkgZmH+1N2IzlRQYLchmWJd+9IxDJjo0O1QVRmpOk6UXuwwMs8n/QR0413 I99ARgErXj9Zm6i9LB+rhJleId6mh/hJoMax0NeW4GI3fFRX0BhxZRJwVA9Q2B/9WX6m BPgA== X-Gm-Message-State: AOAM530YuOd0zdAYMDRhe9FD2+tvUlow/3Z3HgRJ5ogwy8SHE2hQ2zEV 9QhyspA+W9MlvmuWss4uqxRgGW4hAewPBf97 X-Google-Smtp-Source: ABdhPJxNS+1PoloHoudw53QSAfrcv99nLGSoJ/XrNPN1kIxuQeOYbogODc2Xxc7ZZ0WyRqMoaPBc3g== X-Received: by 2002:a2e:b707:: with SMTP id j7mr1946889ljo.297.1632862494715; Tue, 28 Sep 2021 13:54:54 -0700 (PDT) Received: from localhost.localdomain ([2a01:4f9:3a:1e26::2]) by smtp.gmail.com with ESMTPSA id l14sm24061lji.137.2021.09.28.13.54.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 28 Sep 2021 13:54:54 -0700 (PDT) From: Philipp Tomsich To: qemu-devel@nongnu.org Subject: [PATCH 2/2] target/riscv: Use dup_const_tl in orc.b to legalise truncation of constant Date: Tue, 28 Sep 2021 22:54:50 +0200 Message-Id: <20210928205450.4121269-2-philipp.tomsich@vrull.eu> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210928205450.4121269-1-philipp.tomsich@vrull.eu> References: <20210928205450.4121269-1-philipp.tomsich@vrull.eu> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::12b; envelope-from=philipp.tomsich@vrull.eu; helo=mail-lf1-x12b.google.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-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 , Richard Henderson , Philipp Tomsich Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" We need to use the newly introduced dup_const_tl in orc.b to legalise the truncation (to target_long) of the constant generated with dup_const. Signed-off-by: Philipp Tomsich Reviewed-by: Richard Henderson --- target/riscv/insn_trans/trans_rvb.c.inc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/target/riscv/insn_trans/trans_rvb.c.inc b/target/riscv/insn_trans/trans_rvb.c.inc index 2927353d9b..185c3e9a60 100644 --- a/target/riscv/insn_trans/trans_rvb.c.inc +++ b/target/riscv/insn_trans/trans_rvb.c.inc @@ -249,7 +249,7 @@ static bool trans_rev8_64(DisasContext *ctx, arg_rev8_64 *a) static void gen_orc_b(TCGv ret, TCGv source1) { TCGv tmp = tcg_temp_new(); - TCGv ones = tcg_constant_tl(dup_const(MO_8, 0x01)); + TCGv ones = tcg_constant_tl(dup_const_tl(MO_8, 0x01)); /* Set lsb in each byte if the byte was zero. */ tcg_gen_sub_tl(tmp, source1, ones);