From patchwork Sat Jan 14 02:04:14 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 642603 Delivered-To: patch@linaro.org Received: by 2002:a17:522:f3c4:b0:4b4:3859:abed with SMTP id in4csp42341pvb; Fri, 13 Jan 2023 18:04:54 -0800 (PST) X-Google-Smtp-Source: AMrXdXuQANofeanM44PCIaugV0JJ5lbFExyE64OF39hZMqOMG0f9DnaojmdAgAwUgL1AMqlyzRrx X-Received: by 2002:a05:622a:4d0c:b0:3ab:d932:6c4e with SMTP id fd12-20020a05622a4d0c00b003abd9326c4emr41986616qtb.18.1673661894461; Fri, 13 Jan 2023 18:04:54 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673661894; cv=none; d=google.com; s=arc-20160816; b=0eEMJJlZ2gfRoHUGD5bEpTqMuv/uUsoWYJhSxDZWcWe7cKjSG7Y7fWS+6LJvlCfmEw 6Ze0ndZMAsIJDL2qQo6C7zMpjVvscVoVioEHUT0nUd4W1SH1fyZZ/Rvb88V6mjnvjsJH 01398aM0wFaR/E+2O/oK1E8i+58R68+2dji2sFRJeNfHGLNjfS73GH8kbeZ9KGLa7SUw a2DgHPLL9yoSy/Xep/wYTlOg8/PiO+jSKLpXBt8pERQWeW6460WV9tP/T3JMR0H+wTv4 RDnoGQRvbT2nryb0a52qq0niC7gLXol85SGXnKVY40lP0xVlb025G4tDIaoE4yvLH0qn Ko9A== 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:message-id:date:subject:to:from:dkim-signature; bh=M3DcAkNdtcPsJzTckL53caY5u9NfdF8hEKyd5Zm5cog=; b=vkPCEcaS9YhdCjxAxa8OhW0SAIWBPF254Cfu1iDKUW6nxlVRkVZwLsEolMR4GxEUW/ /nbSzAUJ6BwhYx93U78Xvo72n+kiF2R9y6/obY8Z1OcRJpe0U4wlObAOv1CnKEhmaFVV Wl9vUaV6G8ACpa7ohJ/q7iL5blCWImrdHUUJbdDJuh9aL6PUYJ/BP/d8Sc4ygqfNLs5X dW4XO7ccGcFG72Sc/9SiXmyFkew7iNB6DK/vJnKI5bapNNsxCHemsmvEu0FXMLpFdN/c xcmam3Yi7ff+9VB8Rok8Z/YTT1iZmlkwQSHyRLI7a2wWweT/dNCCQk7tLcE08Pv8lfXq V53g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=rowkM0xo; 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 r7-20020ac84247000000b003b33fad101esi1989250qtm.599.2023.01.13.18.04.54 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 13 Jan 2023 18:04:54 -0800 (PST) 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=rowkM0xo; 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 1pGVu9-0005Jw-VK; Fri, 13 Jan 2023 21:04:21 -0500 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 1pGVu9-0005Jn-7v for qemu-devel@nongnu.org; Fri, 13 Jan 2023 21:04:21 -0500 Received: from mail-pj1-x102c.google.com ([2607:f8b0:4864:20::102c]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pGVu6-0003cF-Nf for qemu-devel@nongnu.org; Fri, 13 Jan 2023 21:04:20 -0500 Received: by mail-pj1-x102c.google.com with SMTP id bj3so20899322pjb.0 for ; Fri, 13 Jan 2023 18:04:18 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:message-id:date:subject:to :from:from:to:cc:subject:date:message-id:reply-to; bh=M3DcAkNdtcPsJzTckL53caY5u9NfdF8hEKyd5Zm5cog=; b=rowkM0xo8vBoq0lpassLg3MwaG8Gqo0UfwjycxaoJyfDGWXbSyABb22DBmydjE43vk 4nIOSLa9gl1fXJCAyMpRsCskf7X3l0a0L6erZ2pf0eJkLXIESvZKE5OXcVyUczoKu/OK 9totJu+dWTFEAS4zLSb1U/ykStuQcMJGXDkIGX4PngpntEkI3PpI3bf+A2iyizaaHhwO W5S8Gc6oo6U8UejAb1EULrwBo/XUFS54A7cDYN8v/15bPW3KbVcoiLy56LSxZDCCa0iN D6Z6KYe6hdY7Z0EI1uhEJsw4REUv8Le//SOKzzBJ1beLEwktsPyzndkdYJiS3YHgzw37 7nhg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:to :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=M3DcAkNdtcPsJzTckL53caY5u9NfdF8hEKyd5Zm5cog=; b=Ou0GNnTpCj9TPiETsK1hRLgIIrve3m6CWBeLAPd6rCSN/KJVQ/msnWrB0OX4fiw3eB j8l6IHgCxguRzY7BYqKrUIwd2vjFKEKVDFCHiRG2XkmshOgu9XpcXNEWAdxDevK44oP2 oL7ZF26RPyyemA2pyWRL2DyVjJFHoWqCBbzfRc/3hQ3UQvfuXDGmEMaeY+AAcIh0rsuv 27sQ0oWcZLDhVXNYR4VINi9pdktHxpnZS5pOsR6HLE2wFMiI7DxchBE8BrZdtJb2Y92F W9LyQbNHire+ZWhQeYuTA7c7ZYPqL6NvGaR8QBCAxEe9vcb+/RKYhnCb7wmotnMsU/w4 Nhfw== X-Gm-Message-State: AFqh2krrIipxAQCLPq9UQs4zoWu3QWFT7fu14NsSfiYU2Agppr/PeIOS VX0Vjgy1Iy21eq4GoeERgNhi2Itcbe6A2IEU X-Received: by 2002:a17:90a:5904:b0:227:e10:9a93 with SMTP id k4-20020a17090a590400b002270e109a93mr22108234pji.20.1673661857156; Fri, 13 Jan 2023 18:04:17 -0800 (PST) Received: from stoup.. (rrcs-173-198-77-218.west.biz.rr.com. [173.198.77.218]) by smtp.gmail.com with ESMTPSA id l14-20020a17090aec0e00b0022908f1398dsm3460327pjy.32.2023.01.13.18.04.15 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 13 Jan 2023 18:04:16 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH] tcg: Avoid recursion in tcg_gen_mulu2_i32 Date: Fri, 13 Jan 2023 16:04:14 -1000 Message-Id: <20230114020414.2839748-1-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::102c; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x102c.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 We have a test for one of TCG_TARGET_HAS_mulu2_i32 or TCG_TARGET_HAS_muluh_i32 being defined, but the test became non-functional when we changed to always define all of these macros. Replace this with a build-time test in tcg_gen_mulu2_i32. Fixes: 25c4d9cc845 ("tcg: Always define all of the TCGOpcode enum members.") Resolves: https://gitlab.com/qemu-project/qemu/-/issues/1435 Signed-off-by: Richard Henderson --- include/tcg/tcg.h | 7 ------- tcg/tcg-op.c | 4 +++- 2 files changed, 3 insertions(+), 8 deletions(-) diff --git a/include/tcg/tcg.h b/include/tcg/tcg.h index b949d75fdd..97429bdb89 100644 --- a/include/tcg/tcg.h +++ b/include/tcg/tcg.h @@ -155,13 +155,6 @@ typedef uint64_t TCGRegSet; #define TCG_TARGET_HAS_rem_i64 0 #endif -/* For 32-bit targets, some sort of unsigned widening multiply is required. */ -#if TCG_TARGET_REG_BITS == 32 \ - && !(defined(TCG_TARGET_HAS_mulu2_i32) \ - || defined(TCG_TARGET_HAS_muluh_i32)) -# error "Missing unsigned widening multiply" -#endif - #if !defined(TCG_TARGET_HAS_v64) \ && !defined(TCG_TARGET_HAS_v128) \ && !defined(TCG_TARGET_HAS_v256) diff --git a/tcg/tcg-op.c b/tcg/tcg-op.c index cd1cd4e736..d7e556fe0c 100644 --- a/tcg/tcg-op.c +++ b/tcg/tcg-op.c @@ -874,7 +874,7 @@ void tcg_gen_mulu2_i32(TCGv_i32 rl, TCGv_i32 rh, TCGv_i32 arg1, TCGv_i32 arg2) tcg_gen_op3_i32(INDEX_op_muluh_i32, rh, arg1, arg2); tcg_gen_mov_i32(rl, t); tcg_temp_free_i32(t); - } else { + } else if (TCG_TARGET_REG_BITS == 64) { TCGv_i64 t0 = tcg_temp_new_i64(); TCGv_i64 t1 = tcg_temp_new_i64(); tcg_gen_extu_i32_i64(t0, arg1); @@ -883,6 +883,8 @@ void tcg_gen_mulu2_i32(TCGv_i32 rl, TCGv_i32 rh, TCGv_i32 arg1, TCGv_i32 arg2) tcg_gen_extr_i64_i32(rl, rh, t0); tcg_temp_free_i64(t0); tcg_temp_free_i64(t1); + } else { + qemu_build_not_reached(); } }