From patchwork Tue Sep 10 21:23:50 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 827044 Delivered-To: patch@linaro.org Received: by 2002:adf:ab1c:0:b0:367:895a:4699 with SMTP id q28csp512737wrc; Tue, 10 Sep 2024 14:24:41 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCU/POlbA51e2nKcHmLB2AlKQwe7vUEH/Z+RlNl9dPJyg79wzSvj/KldtyAfmsDFrAUl8KNpGw==@linaro.org X-Google-Smtp-Source: AGHT+IHl1LRjbSx9Lq9Tdts2gG2wPm4XtBx3aJn7T5PhtBA/iobF7nb3ObKCG+UZhUUgcXi5YvNG X-Received: by 2002:ac8:5947:0:b0:458:3399:5177 with SMTP id d75a77b69052e-458339954fbmr106793561cf.27.1726003481429; Tue, 10 Sep 2024 14:24:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1726003481; cv=none; d=google.com; s=arc-20240605; b=Oi9uIR8NOlRAi7ceV5qLPIC/dzs8ss2RaO8opBwv50N2R4q27k7+Q4gnq4LZtqYoox +0Lf2p7LxEud1L1WaXtK0+zOBil+xsZ094ZC7IW80UraYCPUTaGTZ7XB0ICKDRGsLyZL P3/E7Md0zVbdKIwXLODMgwYb4mS5so276hmgH/B3+E9o6zmae6X4+NnTt7vTy8uNDNb+ R0SiKQRArJ6CAlKW7hwX7LIZxvSuu4rr3RHpYxpws75knBfXZXI8Iv7wdj32g0XDfkAN U3OKLAiYbD4cgAlMULDoqmT88ZzWVW8kKnrZfYxVn4RgNm4nSoJmeKnpIPUOMNObF2xs 4QUw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=sender:errors-to: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:cc:to :from:dkim-signature; bh=01lwJ9Gr+H9sJT+0AX6EZ1yccgfrQ4/iKAP835gU7Qo=; fh=F+xgrd1ht63kc5fxqFABYqQkRp8zxi1zdTlIodjTtn4=; b=dy8e9MH+rjn+cgpES04jjcN6H6DtSMe8hEvHFtkf86ab7olXoaoNWDmwcXmGSSUiy3 pKCvlykAnwY5TKcmowXmAeJn7bY05Rroer/2p13R2lmJYLi1DEaO4+G68BtWtG3eOdw/ rAlh4BJZiU9ElCVk7KWoUaw63wQp+H9R6qb4LHGn4s1VmS8KA877ZiUT7aNv6VDv+N6W kg6wXfPIp/6sQFhO8w23sECFtJloZKRN3vF3EUpfgaPEee5sjXudBPcruHKHPL8YVRV3 dzeuqkRUSOdTDSFXwHLoAVO1qakaTkK/BWHmdJIatuRU7UHxDAIJqOmoy6ouEhqc8BlN BaFQ==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=CtmDFd6q; 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; dara=neutral header.i=@linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id d75a77b69052e-45822f3e0cfsi87652641cf.251.2024.09.10.14.24.41 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 10 Sep 2024 14:24:41 -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=pass header.i=@linaro.org header.s=google header.b=CtmDFd6q; 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; dara=neutral header.i=@linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1so8L8-0002Vi-EX; Tue, 10 Sep 2024 17:23:58 -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 1so8L6-0002OK-K4 for qemu-devel@nongnu.org; Tue, 10 Sep 2024 17:23:56 -0400 Received: from mail-pg1-x52b.google.com ([2607:f8b0:4864:20::52b]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1so8L4-0001w4-Vf for qemu-devel@nongnu.org; Tue, 10 Sep 2024 17:23:56 -0400 Received: by mail-pg1-x52b.google.com with SMTP id 41be03b00d2f7-7d50b3a924bso1829397a12.0 for ; Tue, 10 Sep 2024 14:23:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1726003433; x=1726608233; 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=01lwJ9Gr+H9sJT+0AX6EZ1yccgfrQ4/iKAP835gU7Qo=; b=CtmDFd6qjY1Mja0exxyRFH4UkugAF9rVC5oLiTERgDb8P71Wr1Ez0jQEIFvx4AL4eS QTi8TfEb1myi51AuHHMk+3UVhZnMfeJhWr5/GIi705qxkDGkEe+DQ7dp/Dbe2Eig2Yku MaB2wc/sGzC1c5Kf07PIc+JXoAkTGwxjJppHXsNX+lS6m3NeOu4GI+QlkgSs2vIycv1P emQ3KV0fmmX171qHZIaCIsezNifdKVPYFDD654c6XsTmshWpNzZLQJW7x5svFNsMIXio dhsk7QZ1n5pI0H+Xnfu1JNEt2EBV4IaCpp0xpcG5U+8u8JmhwafJz4wlwdBf0YWn0W5+ /eRw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1726003433; x=1726608233; 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=01lwJ9Gr+H9sJT+0AX6EZ1yccgfrQ4/iKAP835gU7Qo=; b=brFBfx99thdCm21//E+u5fm1ZrCmGPc37helRRa0EEQM2Wvtqx6Ippiy8tnz6bCJj4 NoIcqCy9x5s7L1nq/g+R8OlDOQJYcKS6bQnK3KFZtg3RiajqOnGTcj1blAYdXZARPqz0 Xl3N8uZFX6f1ziNjbnVECl03o2NduJ+4boeSY3fBt0S6ZAKQoCcoN9x/DivQxuLV2/Eb 6jWNYHi/HbtDcRtyJbpj7eFyweQPjXYEYxz9TXY2S6jnbupWsT+ocpnKxbdmWZC7v6p2 f8OtXUTGWZHlToiRxEp2hwxGsRG2lhusKjpcGs/kSVpjFxOMAhfrUAtsXTc/IvN2q3F8 VHAw== X-Gm-Message-State: AOJu0YwgEnxWH91/ijAxfszw44s7YIJyt8AHFp1X9MK2qYwKuiUhS01J S7l9JaHZ7qkD7Vd3M39QvhX2/b+xT1RgeFvU27erigBmN5Pcgn/Lm5OYcz6J5Fj/MP+9e5LMiVz e X-Received: by 2002:a05:6a21:4581:b0:1cf:287a:414e with SMTP id adf61e73a8af0-1cf5e0322f5mr2888823637.1.1726003433453; Tue, 10 Sep 2024 14:23:53 -0700 (PDT) Received: from stoup.. (174-21-81-121.tukw.qwest.net. [174.21.81.121]) by smtp.gmail.com with ESMTPSA id 41be03b00d2f7-7d825ba616bsm6089661a12.93.2024.09.10.14.23.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 Sep 2024 14:23:53 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: alex.bennee@linaro.org, pierrick.bouvier@linaro.org Subject: [PATCH 1/2] tcg: Return TCGOp from tcg_gen_op[1-6] Date: Tue, 10 Sep 2024 14:23:50 -0700 Message-ID: <20240910212351.977753-2-richard.henderson@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240910212351.977753-1-richard.henderson@linaro.org> References: <20240910212351.977753-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::52b; envelope-from=richard.henderson@linaro.org; helo=mail-pg1-x52b.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 Signed-off-by: Richard Henderson Reviewed-by: Pierrick Bouvier Reviewed-by: Alex Bennée --- tcg/tcg-internal.h | 12 ++++++------ tcg/tcg-op.c | 23 +++++++++++++++-------- 2 files changed, 21 insertions(+), 14 deletions(-) diff --git a/tcg/tcg-internal.h b/tcg/tcg-internal.h index 52103f4164..8099248076 100644 --- a/tcg/tcg-internal.h +++ b/tcg/tcg-internal.h @@ -92,12 +92,12 @@ TCGTemp *tcg_temp_new_internal(TCGType type, TCGTempKind kind); */ TCGTemp *tcg_constant_internal(TCGType type, int64_t val); -void tcg_gen_op1(TCGOpcode, TCGArg); -void tcg_gen_op2(TCGOpcode, TCGArg, TCGArg); -void tcg_gen_op3(TCGOpcode, TCGArg, TCGArg, TCGArg); -void tcg_gen_op4(TCGOpcode, TCGArg, TCGArg, TCGArg, TCGArg); -void tcg_gen_op5(TCGOpcode, TCGArg, TCGArg, TCGArg, TCGArg, TCGArg); -void tcg_gen_op6(TCGOpcode, TCGArg, TCGArg, TCGArg, TCGArg, TCGArg, TCGArg); +TCGOp *tcg_gen_op1(TCGOpcode, TCGArg); +TCGOp *tcg_gen_op2(TCGOpcode, TCGArg, TCGArg); +TCGOp *tcg_gen_op3(TCGOpcode, TCGArg, TCGArg, TCGArg); +TCGOp *tcg_gen_op4(TCGOpcode, TCGArg, TCGArg, TCGArg, TCGArg); +TCGOp *tcg_gen_op5(TCGOpcode, TCGArg, TCGArg, TCGArg, TCGArg, TCGArg); +TCGOp *tcg_gen_op6(TCGOpcode, TCGArg, TCGArg, TCGArg, TCGArg, TCGArg, TCGArg); void vec_gen_2(TCGOpcode, TCGType, unsigned, TCGArg, TCGArg); void vec_gen_3(TCGOpcode, TCGType, unsigned, TCGArg, TCGArg, TCGArg); diff --git a/tcg/tcg-op.c b/tcg/tcg-op.c index eff3728622..28c41b37a4 100644 --- a/tcg/tcg-op.c +++ b/tcg/tcg-op.c @@ -37,38 +37,43 @@ */ #define NI __attribute__((noinline)) -void NI tcg_gen_op1(TCGOpcode opc, TCGArg a1) +TCGOp * NI tcg_gen_op1(TCGOpcode opc, TCGArg a1) { TCGOp *op = tcg_emit_op(opc, 1); op->args[0] = a1; + return op; } -void NI tcg_gen_op2(TCGOpcode opc, TCGArg a1, TCGArg a2) +TCGOp * NI tcg_gen_op2(TCGOpcode opc, TCGArg a1, TCGArg a2) { TCGOp *op = tcg_emit_op(opc, 2); op->args[0] = a1; op->args[1] = a2; + return op; } -void NI tcg_gen_op3(TCGOpcode opc, TCGArg a1, TCGArg a2, TCGArg a3) +TCGOp * NI tcg_gen_op3(TCGOpcode opc, TCGArg a1, TCGArg a2, TCGArg a3) { TCGOp *op = tcg_emit_op(opc, 3); op->args[0] = a1; op->args[1] = a2; op->args[2] = a3; + return op; } -void NI tcg_gen_op4(TCGOpcode opc, TCGArg a1, TCGArg a2, TCGArg a3, TCGArg a4) +TCGOp * NI tcg_gen_op4(TCGOpcode opc, TCGArg a1, TCGArg a2, + TCGArg a3, TCGArg a4) { TCGOp *op = tcg_emit_op(opc, 4); op->args[0] = a1; op->args[1] = a2; op->args[2] = a3; op->args[3] = a4; + return op; } -void NI tcg_gen_op5(TCGOpcode opc, TCGArg a1, TCGArg a2, TCGArg a3, - TCGArg a4, TCGArg a5) +TCGOp * NI tcg_gen_op5(TCGOpcode opc, TCGArg a1, TCGArg a2, + TCGArg a3, TCGArg a4, TCGArg a5) { TCGOp *op = tcg_emit_op(opc, 5); op->args[0] = a1; @@ -76,10 +81,11 @@ void NI tcg_gen_op5(TCGOpcode opc, TCGArg a1, TCGArg a2, TCGArg a3, op->args[2] = a3; op->args[3] = a4; op->args[4] = a5; + return op; } -void NI tcg_gen_op6(TCGOpcode opc, TCGArg a1, TCGArg a2, TCGArg a3, - TCGArg a4, TCGArg a5, TCGArg a6) +TCGOp * NI tcg_gen_op6(TCGOpcode opc, TCGArg a1, TCGArg a2, TCGArg a3, + TCGArg a4, TCGArg a5, TCGArg a6) { TCGOp *op = tcg_emit_op(opc, 6); op->args[0] = a1; @@ -88,6 +94,7 @@ void NI tcg_gen_op6(TCGOpcode opc, TCGArg a1, TCGArg a2, TCGArg a3, op->args[3] = a4; op->args[4] = a5; op->args[5] = a6; + return op; } /* From patchwork Tue Sep 10 21:23:51 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 827043 Delivered-To: patch@linaro.org Received: by 2002:adf:ab1c:0:b0:367:895a:4699 with SMTP id q28csp512692wrc; Tue, 10 Sep 2024 14:24:35 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCWcTHHskNdnO0RfbE/vs1kAQedvV/oUs/8sc3WKSqHfiGq9T/Rqfb8U9Y+JQkCYyUIybKIrQQ==@linaro.org X-Google-Smtp-Source: AGHT+IFYnjpwg5DCG2cTfMpsSNsYsXrxwDZGRBd6RIjyb3SEKQWnTDIGNRYMZYJ66ElO1MzmRFbU X-Received: by 2002:a05:620a:172b:b0:79f:73d:d2e with SMTP id af79cd13be357-7a9d3a60d7bmr145030585a.24.1726003474808; Tue, 10 Sep 2024 14:24:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1726003474; cv=none; d=google.com; s=arc-20240605; b=T8x6ukZjVPla2EPdrWth4LJtd9PCJSAIzgqeeALenaBteVQsTT3yEz/Q0lGkeazixu OpIPDu9Vni8w/zvZ8QeHSne5KD2+GiO860P+PAoogiuUWBTtAVo+NbiGhcriGHtVvzhW b+ktFwMZLr9s/rZbwJkCuE15z910OBAYxERxv6R16zBXerCH8WFd1Z8GtEsfG5KRGNDP PA2NAoHMYT5Rxft/Bv/fJebjtHH3fOV1BvBU2qegCDnDlrPaE7kCyt4V9qHN4fd85Axd rnKE3D+Eyaq3odDJTjoevhywekGT7A0pdI3UvdrvcOUqnaEN7SDNZEweTDvyzTEk1ZKg 0D+g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=sender:errors-to: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:cc:to :from:dkim-signature; bh=JrrQrwkjzFljgzMx/X6RMiMfxp4p6p9uhxYwZvInmsY=; fh=+2fi32IU3s1l+iOHD/C2uVGEO4vX2D0yOiHvVOBPCg0=; b=NkB2DjYcqJxiPOZiz/Qi65xG25H7QgPuanCrpbyJ/csDTf3LupEZXjLYOnD4ugSXDr 0RVDV28Ck1ftAKmO0p7mE3LqfBMNMFbERLody6U9W+g9K2FzFh1fO7lmLKGFzKR7CND3 tfqSorUPYg9tWkHMXFk+SesIfJRPVFpb7GD7XsstkwYqbGQ7ff3NxSf6Zd8RHIHTUy2e ISbQvkR3lqPt04l+GyghXw5fGg8WXoDiF/gUKAYDVHmgrBjqO/gDzNEM5dbBZy5cRKs2 iaewfLeYg5RM0J7VnVB+k7+c8lVrlybhNZVG5dB2hVF7njP1z0F3rAR1Ubse0uo9RC2c Tqbw==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=mesJ0H4f; 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; dara=neutral header.i=@linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id af79cd13be357-7a9a79c63e0si845798085a.155.2024.09.10.14.24.34 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 10 Sep 2024 14:24:34 -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=pass header.i=@linaro.org header.s=google header.b=mesJ0H4f; 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; dara=neutral header.i=@linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1so8L8-0002WR-Jx; Tue, 10 Sep 2024 17:23:58 -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 1so8L7-0002SX-LM for qemu-devel@nongnu.org; Tue, 10 Sep 2024 17:23:57 -0400 Received: from mail-pg1-x530.google.com ([2607:f8b0:4864:20::530]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1so8L5-0001wB-Sy for qemu-devel@nongnu.org; Tue, 10 Sep 2024 17:23:57 -0400 Received: by mail-pg1-x530.google.com with SMTP id 41be03b00d2f7-7ae3d7222d4so1020998a12.3 for ; Tue, 10 Sep 2024 14:23:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1726003434; x=1726608234; 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=JrrQrwkjzFljgzMx/X6RMiMfxp4p6p9uhxYwZvInmsY=; b=mesJ0H4fE+YHkaCCOpSY34nSsIQFWw6yvMHDPm6ts/f4UjSKaVEoYtjWGl+E6njLa3 XE6E3CX6xkSnTwy8pjhgSEvI/MBse9pFSnyK7m53kKtQft0l9FnaZANWuFhcqocXo9GS Uic1IJvYGCuRQcIgGhyd9BYBWiiZgUQjrMDGZO+1g2mdl+XXblHbjaA/k1gB3+R8n6XX ee5/87p+Ncwg0pyZ5StpQz5ntrFwKrksqdpS1R9nGAhCRzrJKT2DNXT8nk7lNibZ9Vq0 lJzvH+G1VbIzE/loYGjvIuiCIkSP+R4TJMBEn8qGH/ZwzkEpoxM0K625bcK1BAJBTl5x Cw0A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1726003434; x=1726608234; 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=JrrQrwkjzFljgzMx/X6RMiMfxp4p6p9uhxYwZvInmsY=; b=bhcklF8GA078O041USadDwPpYxNp48Leh6YNBeWE0czdb25bHsuaz0utVGSHN5IZ6V 6mNnAecWpxAj+5hlHzYc927FIqmfpvy+j/xdeBSDrB/krKfRTwY/2JX/w3TrlFyu7Hy5 n4fUPXe4NC+kRFTB2hWj4rQP8sMX1ymxstjI8oDhlHd8QK1JucUncyiw2+g/Z+qpBQpL o1byeyWoAjh95YtMin2xQzCNK4L8UI7Ryn4Ew/m91z7LSaG+YoRN/O8PeSXaMT/8K6Xu ogm8TDFg7XiZAoJsQCHXe/amIjKcChKLzgQZI6E/dSJqzCZxriyretqUAdk6UMgGQe39 jrrA== X-Gm-Message-State: AOJu0YyEdlH92GQeT6VheUaVJtZ440P+vEsf5dCIceUYnxetJdDSKJ8S rLmKZYxtsTnN4r3OTOTlvpCijvgDn5c5SOrwOANEXDJb+zWe1lsXGqWrPMduGpqaXWmqFmdrYUf f X-Received: by 2002:a05:6a21:168b:b0:1c4:23f0:9665 with SMTP id adf61e73a8af0-1cf62cea105mr1956098637.29.1726003434289; Tue, 10 Sep 2024 14:23:54 -0700 (PDT) Received: from stoup.. (174-21-81-121.tukw.qwest.net. [174.21.81.121]) by smtp.gmail.com with ESMTPSA id 41be03b00d2f7-7d825ba616bsm6089661a12.93.2024.09.10.14.23.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 Sep 2024 14:23:53 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: alex.bennee@linaro.org, pierrick.bouvier@linaro.org, Elisha Hollander Subject: [PATCH 2/2] tcg: Propagate new TCGOp to add_as_label_use Date: Tue, 10 Sep 2024 14:23:51 -0700 Message-ID: <20240910212351.977753-3-richard.henderson@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240910212351.977753-1-richard.henderson@linaro.org> References: <20240910212351.977753-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::530; envelope-from=richard.henderson@linaro.org; helo=mail-pg1-x530.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 The use of tcg_last_op does not interact well with TCGContext.emit_before_op, resulting in the label being linked to something other than the branch op. In this case it is easier to simply collect the emitted branch op and pass it directly to add_as_label_use. Reported-by: Elisha Hollander Signed-off-by: Richard Henderson Reviewed-by: Pierrick Bouvier --- tcg/tcg-op.c | 63 ++++++++++++++++++++++++++-------------------------- 1 file changed, 32 insertions(+), 31 deletions(-) diff --git a/tcg/tcg-op.c b/tcg/tcg-op.c index 28c41b37a4..4a7e705367 100644 --- a/tcg/tcg-op.c +++ b/tcg/tcg-op.c @@ -117,9 +117,9 @@ static void DNI tcg_gen_op1_i64(TCGOpcode opc, TCGv_i64 a1) tcg_gen_op1(opc, tcgv_i64_arg(a1)); } -static void DNI tcg_gen_op1i(TCGOpcode opc, TCGArg a1) +static TCGOp * DNI tcg_gen_op1i(TCGOpcode opc, TCGArg a1) { - tcg_gen_op1(opc, a1); + return tcg_gen_op1(opc, a1); } static void DNI tcg_gen_op2_i32(TCGOpcode opc, TCGv_i32 a1, TCGv_i32 a2) @@ -196,16 +196,16 @@ static void DNI tcg_gen_op4i_i64(TCGOpcode opc, TCGv_i64 a1, TCGv_i64 a2, tcgv_i64_arg(a3), a4); } -static void DNI tcg_gen_op4ii_i32(TCGOpcode opc, TCGv_i32 a1, TCGv_i32 a2, - TCGArg a3, TCGArg a4) +static TCGOp * DNI tcg_gen_op4ii_i32(TCGOpcode opc, TCGv_i32 a1, TCGv_i32 a2, + TCGArg a3, TCGArg a4) { - tcg_gen_op4(opc, tcgv_i32_arg(a1), tcgv_i32_arg(a2), a3, a4); + return tcg_gen_op4(opc, tcgv_i32_arg(a1), tcgv_i32_arg(a2), a3, a4); } -static void DNI tcg_gen_op4ii_i64(TCGOpcode opc, TCGv_i64 a1, TCGv_i64 a2, - TCGArg a3, TCGArg a4) +static TCGOp * DNI tcg_gen_op4ii_i64(TCGOpcode opc, TCGv_i64 a1, TCGv_i64 a2, + TCGArg a3, TCGArg a4) { - tcg_gen_op4(opc, tcgv_i64_arg(a1), tcgv_i64_arg(a2), a3, a4); + return tcg_gen_op4(opc, tcgv_i64_arg(a1), tcgv_i64_arg(a2), a3, a4); } static void DNI tcg_gen_op5_i32(TCGOpcode opc, TCGv_i32 a1, TCGv_i32 a2, @@ -270,12 +270,12 @@ static void DNI tcg_gen_op6i_i64(TCGOpcode opc, TCGv_i64 a1, TCGv_i64 a2, tcgv_i64_arg(a3), tcgv_i64_arg(a4), tcgv_i64_arg(a5), a6); } -static void DNI tcg_gen_op6ii_i32(TCGOpcode opc, TCGv_i32 a1, TCGv_i32 a2, - TCGv_i32 a3, TCGv_i32 a4, - TCGArg a5, TCGArg a6) +static TCGOp * DNI tcg_gen_op6ii_i32(TCGOpcode opc, TCGv_i32 a1, TCGv_i32 a2, + TCGv_i32 a3, TCGv_i32 a4, + TCGArg a5, TCGArg a6) { - tcg_gen_op6(opc, tcgv_i32_arg(a1), tcgv_i32_arg(a2), - tcgv_i32_arg(a3), tcgv_i32_arg(a4), a5, a6); + return tcg_gen_op6(opc, tcgv_i32_arg(a1), tcgv_i32_arg(a2), + tcgv_i32_arg(a3), tcgv_i32_arg(a4), a5, a6); } /* Generic ops. */ @@ -286,18 +286,17 @@ void gen_set_label(TCGLabel *l) tcg_gen_op1(INDEX_op_set_label, label_arg(l)); } -static void add_last_as_label_use(TCGLabel *l) +static void add_as_label_use(TCGLabel *l, TCGOp *op) { TCGLabelUse *u = tcg_malloc(sizeof(TCGLabelUse)); - u->op = tcg_last_op(); + u->op = op; QSIMPLEQ_INSERT_TAIL(&l->branches, u, next); } void tcg_gen_br(TCGLabel *l) { - tcg_gen_op1(INDEX_op_br, label_arg(l)); - add_last_as_label_use(l); + add_as_label_use(l, tcg_gen_op1(INDEX_op_br, label_arg(l))); } void tcg_gen_mb(TCGBar mb_type) @@ -514,8 +513,9 @@ void tcg_gen_brcond_i32(TCGCond cond, TCGv_i32 arg1, TCGv_i32 arg2, TCGLabel *l) if (cond == TCG_COND_ALWAYS) { tcg_gen_br(l); } else if (cond != TCG_COND_NEVER) { - tcg_gen_op4ii_i32(INDEX_op_brcond_i32, arg1, arg2, cond, label_arg(l)); - add_last_as_label_use(l); + TCGOp *op = tcg_gen_op4ii_i32(INDEX_op_brcond_i32, + arg1, arg2, cond, label_arg(l)); + add_as_label_use(l, op); } } @@ -1934,15 +1934,16 @@ void tcg_gen_brcond_i64(TCGCond cond, TCGv_i64 arg1, TCGv_i64 arg2, TCGLabel *l) if (cond == TCG_COND_ALWAYS) { tcg_gen_br(l); } else if (cond != TCG_COND_NEVER) { + TCGOp *op; if (TCG_TARGET_REG_BITS == 32) { - tcg_gen_op6ii_i32(INDEX_op_brcond2_i32, TCGV_LOW(arg1), - TCGV_HIGH(arg1), TCGV_LOW(arg2), - TCGV_HIGH(arg2), cond, label_arg(l)); + op = tcg_gen_op6ii_i32(INDEX_op_brcond2_i32, TCGV_LOW(arg1), + TCGV_HIGH(arg1), TCGV_LOW(arg2), + TCGV_HIGH(arg2), cond, label_arg(l)); } else { - tcg_gen_op4ii_i64(INDEX_op_brcond_i64, arg1, arg2, cond, - label_arg(l)); + op = tcg_gen_op4ii_i64(INDEX_op_brcond_i64, arg1, arg2, cond, + label_arg(l)); } - add_last_as_label_use(l); + add_as_label_use(l, op); } } @@ -1953,12 +1954,12 @@ void tcg_gen_brcondi_i64(TCGCond cond, TCGv_i64 arg1, int64_t arg2, TCGLabel *l) } else if (cond == TCG_COND_ALWAYS) { tcg_gen_br(l); } else if (cond != TCG_COND_NEVER) { - tcg_gen_op6ii_i32(INDEX_op_brcond2_i32, - TCGV_LOW(arg1), TCGV_HIGH(arg1), - tcg_constant_i32(arg2), - tcg_constant_i32(arg2 >> 32), - cond, label_arg(l)); - add_last_as_label_use(l); + TCGOp *op = tcg_gen_op6ii_i32(INDEX_op_brcond2_i32, + TCGV_LOW(arg1), TCGV_HIGH(arg1), + tcg_constant_i32(arg2), + tcg_constant_i32(arg2 >> 32), + cond, label_arg(l)); + add_as_label_use(l, op); } }