From nobody Wed Nov 27 11:40:27 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=1699325634; cv=none; d=zohomail.com; s=zohoarc; b=kf+WDDE8IqGeWX1cytQnnzKFAUkUK9zYbzN8SZyi5b2XfkPwUvtzJ5OKYjJ2B1o32a/P/8gs+JMmAvCMGCDdp4+jgkWqFdnlB4HhBlSmRoWvupDll3oxKETTG52KrMU6K2N6QvlZNIcjGMaYIlDoCM7Vh2do3/YqPoleWaY0+4s= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1699325634; 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=yATrqhFa0XdJNCrDgxI0k8cWQsLoXGcnoV4EfIA9rFw=; b=PMiW8tO9jbGlHsaxB74Wo0VZ6RwlY7e/IPI7TnQXRtYS8ZpaKNuOIWo6/YSnF3wdi2p3MMkgcQPK6Co01H6AOZX9clBcVPXJHIs0c7NWorwfKw1fxazEwj29zWsK2aiS02H5cXGh5ZYpM94RDQ3DViKI0WeyTN/ZR9T3NxneOKU= 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 1699325634073550.6821169910196; Mon, 6 Nov 2023 18:53:54 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1r0C9R-0008R6-NQ; Mon, 06 Nov 2023 21:49:13 -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 1r0C9Q-0008QR-9K for qemu-devel@nongnu.org; Mon, 06 Nov 2023 21:49:12 -0500 Received: from mail-ot1-x335.google.com ([2607:f8b0:4864:20::335]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1r0C9O-0005wW-QF for qemu-devel@nongnu.org; Mon, 06 Nov 2023 21:49:12 -0500 Received: by mail-ot1-x335.google.com with SMTP id 46e09a7af769-6ce353df504so3030087a34.3 for ; Mon, 06 Nov 2023 18:49:10 -0800 (PST) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id fn11-20020a056a002fcb00b006bff7c36fb3sm6367478pfb.95.2023.11.06.18.49.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 06 Nov 2023 18:49:09 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1699325350; x=1699930150; 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=yATrqhFa0XdJNCrDgxI0k8cWQsLoXGcnoV4EfIA9rFw=; b=sybNyylZxTBDZsDb0WKHNor/sx+o/xaFAY/4VSp+D3K2cDePXifK7XlNG9gpd7Fcaf SKMd7iYpPYAoVjTk6OeffZtkMVU3+qIwLa6hoDJKoUBm9qvkx57XnBagNHbGO+yyMPTB 9eXjsiKZqgDd96vjvdEy6fCMopYwJV0EXD0OnDciDfzdFcVnWt8MuONlcmepW9QCuTOg Drpq5CZypst2ybaWFsFTfxNcvkIqwQ2Pjl/JLFwJs7JllyJm1WEE3AWlNXZTWb7+ddI1 6b4uLYOo70bpcMmsRudLI7RNA1Ty0Q3y8v5RDgozzTJ7CkGv3azZ2hUvztKHymr32NI0 0v7g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1699325350; x=1699930150; 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=yATrqhFa0XdJNCrDgxI0k8cWQsLoXGcnoV4EfIA9rFw=; b=UYlsDtmZ2LF6TSyWUi8oR0C5nMjYkf1KhHwpIwNuMaiXlpvCzUArUE7FOIQ5YiHukl aHOM0Uch3WTrNn/732fiI6+nNEEAAzgapNd+86DJEi8S1SX275jnWSSpjs1S+XKAdAkG zukzI5gTpvClBs5I2LLjzVpIWSVWs02r4cn/jpAcHOy2svMyHlyZcVd/m9jHbcNysWgY hDWiibvR2M9AR7r7iISpX01aAe9gkE18SWP45oG/3sIywAUluJg0wPMGBS1lIYEu241p E5x88Y+NsOJSlPiy+Serqj4A0axvBVUBBRR+CjGrA/vVgDgOMTYBTxkLqeuKCf2dg5GK pcJA== X-Gm-Message-State: AOJu0Yzv1ojyhhMlKrNF90FqDwFRjahOI3qtWcAa+C9rpbHkTfiCQUj8 EM6QQBCQuvekyqdOBvXaJQ2H8H1Z9d7FiS9o1tA= X-Google-Smtp-Source: AGHT+IFR8/hJtF7Xw9W3mz9i/FCSSPdsVnXnzY6TcBEhq5Y3M4M4yotKc5bkes+tIO1d78PJdWBmkA== X-Received: by 2002:a9d:7d90:0:b0:6bb:1036:46de with SMTP id j16-20020a9d7d90000000b006bb103646demr30751758otn.30.1699325349806; Mon, 06 Nov 2023 18:49:09 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Cc: Paolo Bonzini , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PATCH 32/35] tcg: Canonicalize subi to addi during opcode generation Date: Mon, 6 Nov 2023 18:48:39 -0800 Message-Id: <20231107024842.7650-33-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231107024842.7650-1-richard.henderson@linaro.org> References: <20231107024842.7650-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::335; envelope-from=richard.henderson@linaro.org; helo=mail-ot1-x335.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: 1699325634772100015 Suggested-by: Paolo Bonzini Signed-off-by: Richard Henderson Reviewed-by: Philippe Mathieu-Daud=C3=A9 Message-Id: <20231026013945.1152174-2-richard.henderson@linaro.org> --- tcg/tcg-op.c | 18 ++---------------- 1 file changed, 2 insertions(+), 16 deletions(-) diff --git a/tcg/tcg-op.c b/tcg/tcg-op.c index de096a6f93..aa6bc6f57d 100644 --- a/tcg/tcg-op.c +++ b/tcg/tcg-op.c @@ -372,12 +372,7 @@ void tcg_gen_subfi_i32(TCGv_i32 ret, int32_t arg1, TCG= v_i32 arg2) =20 void tcg_gen_subi_i32(TCGv_i32 ret, TCGv_i32 arg1, int32_t arg2) { - /* some cases can be optimized here */ - if (arg2 =3D=3D 0) { - tcg_gen_mov_i32(ret, arg1); - } else { - tcg_gen_sub_i32(ret, arg1, tcg_constant_i32(arg2)); - } + tcg_gen_addi_i32(ret, arg1, -arg2); } =20 void tcg_gen_neg_i32(TCGv_i32 ret, TCGv_i32 arg) @@ -1752,16 +1747,7 @@ void tcg_gen_subfi_i64(TCGv_i64 ret, int64_t arg1, T= CGv_i64 arg2) =20 void tcg_gen_subi_i64(TCGv_i64 ret, TCGv_i64 arg1, int64_t arg2) { - /* some cases can be optimized here */ - if (arg2 =3D=3D 0) { - tcg_gen_mov_i64(ret, arg1); - } else if (TCG_TARGET_REG_BITS =3D=3D 64) { - tcg_gen_sub_i64(ret, arg1, tcg_constant_i64(arg2)); - } else { - tcg_gen_sub2_i32(TCGV_LOW(ret), TCGV_HIGH(ret), - TCGV_LOW(arg1), TCGV_HIGH(arg1), - tcg_constant_i32(arg2), tcg_constant_i32(arg2 >> = 32)); - } + tcg_gen_addi_i64(ret, arg1, -arg2); } =20 void tcg_gen_neg_i64(TCGv_i64 ret, TCGv_i64 arg) --=20 2.34.1