From patchwork Wed Jan 10 22:43:30 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 761465 Delivered-To: patch@linaro.org Received: by 2002:a5d:6e02:0:b0:337:62d3:c6d5 with SMTP id h2csp2111989wrz; Wed, 10 Jan 2024 14:45:13 -0800 (PST) X-Google-Smtp-Source: AGHT+IEOmd5GpkjUEnJ/PWiqRRJnzR0aHLx333MHApEEh+UTBGwfx7YAp2P7ftcRB+JC3X0Uxwu0 X-Received: by 2002:a05:620a:8c8:b0:783:29b3:bf1a with SMTP id z8-20020a05620a08c800b0078329b3bf1amr353073qkz.107.1704926713439; Wed, 10 Jan 2024 14:45:13 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1704926713; cv=none; d=google.com; s=arc-20160816; b=A1B4spKCY6cP3GpR6BProNhHhmKpZWcBWSM+gcUSZZcCZIqQlYv5Y6+EBbP0ZImYlI fTisS25XWqhoRLLeAq1dTUu9dwgMUUn9C/Uk+HwEhnF3O5KVYf8/z+Q3R/Jjjm4NBdFR +HXQZ7Fk4ZVcZNRFMqxH67mSETB2fJckIGykNsPRdAfCFO/4PCd2G28lVvr7d4b279Bc SRfnezdpz7wuOy2syddFxMyjApYKHgVn9gA3lXNAQaveTGgaOYM+Vk3McbwEhg6G/kFv CjLSmyZ4cThwYd+Q1CcYy7ES5CKGOuAGa2IQDYHqsC8PNg8qPW/KhVaf2LIH1lsm6py1 Fu4g== 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:cc:to:from:dkim-signature; bh=sDLkiIiuMWJLnnYxUs/vsP2E2v2LV+NUnxs22kj9jnQ=; fh=GbSB792CRg76qyQfASHmg380JBauy2gTuYi49sbOwBU=; b=0SvFM5yhoMzSqGq6zk5F3zZ/RWG9cFA6Q2am1FpDXM2yBRPTfshYA6OutAgbR/aKRh Hak8Nfkx8BQ2x7XEZ/qcmk0MQn1j1XU+ETacym06mciL+PNAdl+a5diOz2rmrK40KhBa 8QwIncEcd6fx86iv6aeRMMNhRp6MnnjzTbnxv25gJ0lbDhZvoeQJZVtvZapXPURAE9nY WFrHIzM7qeMDqPAsBOaOQFyPZ+tQXE2hCwP9II9UNjzjKigvecN+1Lug73PyIsA79JQs +rMUKgvw6Bw3ge75b0LUd9SYE9MgHC9fsU8c7zKPilY/sM6uisbfel+Omd1yy0voN6Tn azdg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=tlCDzn6q; 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 i13-20020a05620a404d00b007832edea049si4247400qko.373.2024.01.10.14.45.13 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 10 Jan 2024 14:45:13 -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=tlCDzn6q; 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 1rNhJI-0004QX-6N; Wed, 10 Jan 2024 17:44:32 -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 1rNhJG-0004Q6-1q for qemu-devel@nongnu.org; Wed, 10 Jan 2024 17:44:30 -0500 Received: from mail-yb1-xb2e.google.com ([2607:f8b0:4864:20::b2e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rNhJE-0002Og-82 for qemu-devel@nongnu.org; Wed, 10 Jan 2024 17:44:29 -0500 Received: by mail-yb1-xb2e.google.com with SMTP id 3f1490d57ef6-dbed0710c74so3834076276.1 for ; Wed, 10 Jan 2024 14:44:27 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1704926666; x=1705531466; darn=nongnu.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=sDLkiIiuMWJLnnYxUs/vsP2E2v2LV+NUnxs22kj9jnQ=; b=tlCDzn6q8zsjXDCxtHLwrWRHADV+bDBPtZaczBxgllKJbzNJX/eZHdW0urNyoFDYqE Y2v4i9QKoZxuAe2wq8GVK2YaJQDRds4zo9MwJ+OtQQnUPinbLt2H4lJOsARdK4qDOH9A 4CHTRPpCooOIVWtXJFclxngGpoZUeFk6SOkQ+6ABB8kh9Tk9CPWSMyD8yIBAimGNYQuT 1wufd6QmYN1dqAvqKMgVhx6NXNOYHMHOC/ltRmIRwpIPuwoFFf9o6TzSzxwlSzEO5GeD x7Cf5WShfySuhc9PUSd/0u0HP6bRFxnnpC6ZnVbUSmIW4jFruPZXx+8EpIdiadAnv+cS Vl6Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1704926666; x=1705531466; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=sDLkiIiuMWJLnnYxUs/vsP2E2v2LV+NUnxs22kj9jnQ=; b=ee1TuTrpbv/8cT55HrxnA//Tb1IDFgQfI12eGN7gG5s2rEI1qVIb71gBKIpBc1ULhn dLZdiUVYys6XmxjohHL9m3qCt29D0GyspXhl7deP4cgY40fC9XsDEiMc+9KwMssIp/7w KP8aXQ3SV+jH0wugz4Gusxb0vtgWONwhqv6LtQS/EMszkFXhgW1nFU6vUqa7UC4EI3Wu GEQVFtBUXhmo8cALJdGBzjX7CuGwurekzENst3uWH+fYtLkAA068MLH1S6mO8Y71s7fJ WK1j+fqmIgcRmKnP+tu7T3HXzRZDDZl2aAiXDrVbCd+1f4Mc4EF3L5Rf8t4dERAJ4he4 iwuA== X-Gm-Message-State: AOJu0YzIFnrXsI+wu8vbBrwUPbzHKikvbpfzjDcpQYLeZEUPXVQ9/1uk QoPsicTflhdv54nkC3E9nrXLQSRhc89nEN2SfHIK/45gq8Rwe1d3 X-Received: by 2002:a25:4fd7:0:b0:dbe:3abd:3e7c with SMTP id d206-20020a254fd7000000b00dbe3abd3e7cmr320766ybb.83.1704926666545; Wed, 10 Jan 2024 14:44:26 -0800 (PST) Received: from stoup.. ([172.58.27.160]) by smtp.gmail.com with ESMTPSA id ks23-20020ac86217000000b0042987f6874bsm2092281qtb.92.2024.01.10.14.44.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 10 Jan 2024 14:44:26 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Cc: philmd@linaro.org, pbonzini@redhat.com Subject: [PATCH v3 00/38] tcg: Introduce TCG_COND_TST{EQ,NE} Date: Thu, 11 Jan 2024 09:43:30 +1100 Message-Id: <20240110224408.10444-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::b2e; envelope-from=richard.henderson@linaro.org; helo=mail-yb1-xb2e.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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org Expose a pair of comparison operators that map to the "test" comparison that is available on many architectures. Changes for v3: * Make support for TCG_COND_TST* optional (paolo) * Drop riscv, loongarch64 and (unposted) mips backend changes. * Incorporate Paolo's tcg/i386 TEST improvements * Convert some target/s390x cases for even more testing. * Probably some bug fixes in there too... r~ Paolo Bonzini (1): tcg/i386: Use TEST r,r to test 8/16/32 bits Richard Henderson (37): tcg: Introduce TCG_COND_TST{EQ,NE} tcg: Introduce TCG_TARGET_HAS_tst tcg/optimize: Split out arg_is_const_val tcg/optimize: Split out do_constant_folding_cond1 tcg/optimize: Do swap_commutative2 in do_constant_folding_cond2 tcg/optimize: Handle TCG_COND_TST{EQ,NE} tcg/optimize: Lower TCG_COND_TST{EQ,NE} if unsupported target/alpha: Pass immediate value to gen_bcond_internal() target/alpha: Use TCG_COND_TST{EQ,NE} for BLB{C,S} target/alpha: Use TCG_COND_TST{EQ,NE} for CMOVLB{C,S} target/alpha: Use TCG_COND_TSTNE for gen_fold_mzero target/m68k: Use TCG_COND_TST{EQ,NE} in gen_fcc_cond target/sparc: Use TCG_COND_TSTEQ in gen_op_mulscc target/s390x: Use TCG_COND_TSTNE for CC_OP_{TM,ICM} target/s390x: Improve general case of disas_jcc tcg: Add TCGConst argument to tcg_target_const_match tcg/aarch64: Support TCG_COND_TST{EQ,NE} tcg/aarch64: Generate TBZ, TBNZ tcg/aarch64: Generate CBNZ for TSTNE of UINT32_MAX tcg/arm: Factor tcg_out_cmp() out tcg/arm: Support TCG_COND_TST{EQ,NE} tcg/i386: Pass x86 condition codes to tcg_out_cmov tcg/i386: Move tcg_cond_to_jcc[] into tcg_out_cmp tcg/i386: Support TCG_COND_TST{EQ,NE} tcg/i386: Improve TSTNE/TESTEQ vs powers of two tcg/sparc64: Hoist read of tcg_cond_to_rcond tcg/sparc64: Pass TCGCond to tcg_out_cmp tcg/sparc64: Support TCG_COND_TST{EQ,NE} tcg/ppc: Sink tcg_to_bc usage into tcg_out_bc tcg/ppc: Use cr0 in tcg_to_bc and tcg_to_isel tcg/ppc: Tidy up tcg_target_const_match tcg/ppc: Add TCG_CT_CONST_CMP tcg/ppc: Support TCG_COND_TST{EQ,NE} tcg/s390x: Split constraint A into J+U tcg/s390x: Add TCG_CT_CONST_CMP tcg/s390x: Support TCG_COND_TST{EQ,NE} tcg/tci: Support TCG_COND_TST{EQ,NE} docs/devel/tcg-ops.rst | 2 + include/tcg/tcg-cond.h | 74 +++-- tcg/aarch64/tcg-target-con-set.h | 5 +- tcg/aarch64/tcg-target-con-str.h | 1 + tcg/aarch64/tcg-target.h | 2 + tcg/arm/tcg-target.h | 2 + tcg/i386/tcg-target-con-set.h | 6 +- tcg/i386/tcg-target-con-str.h | 1 + tcg/i386/tcg-target.h | 2 + tcg/loongarch64/tcg-target.h | 2 + tcg/mips/tcg-target.h | 2 + tcg/ppc/tcg-target-con-set.h | 5 +- tcg/ppc/tcg-target-con-str.h | 1 + tcg/ppc/tcg-target.h | 2 + tcg/riscv/tcg-target.h | 2 + tcg/s390x/tcg-target-con-set.h | 8 +- tcg/s390x/tcg-target-con-str.h | 3 +- tcg/s390x/tcg-target.h | 2 + tcg/sparc64/tcg-target.h | 2 + tcg/tcg-internal.h | 2 + tcg/tci/tcg-target.h | 2 + target/alpha/translate.c | 94 +++--- target/m68k/translate.c | 74 +++-- target/s390x/tcg/translate.c | 100 +++---- target/sparc/translate.c | 4 +- tcg/optimize.c | 474 +++++++++++++++++++++++-------- tcg/tcg.c | 40 ++- tcg/tci.c | 14 + tcg/aarch64/tcg-target.c.inc | 165 ++++++++--- tcg/arm/tcg-target.c.inc | 62 ++-- tcg/i386/tcg-target.c.inc | 201 +++++++++---- tcg/loongarch64/tcg-target.c.inc | 3 +- tcg/mips/tcg-target.c.inc | 3 +- tcg/ppc/tcg-target.c.inc | 294 ++++++++++++++----- tcg/riscv/tcg-target.c.inc | 3 +- tcg/s390x/tcg-target.c.inc | 246 +++++++++++----- tcg/sparc64/tcg-target.c.inc | 65 +++-- tcg/tci/tcg-target.c.inc | 3 +- 38 files changed, 1378 insertions(+), 595 deletions(-)