From patchwork Thu Oct 26 01:39:41 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 738309 Delivered-To: patch@linaro.org Received: by 2002:adf:f842:0:b0:32d:baff:b0ca with SMTP id d2csp577258wrq; Wed, 25 Oct 2023 18:41:00 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEdcN/MtsfX2sQPzTNBJspSVaHeIGI/aTGyO2kNMLqQLlTp1uDuoD+Q4yx/rQwhUeFP43ao X-Received: by 2002:a05:600c:a01:b0:406:53c0:3c71 with SMTP id z1-20020a05600c0a0100b0040653c03c71mr13668925wmp.37.1698284460706; Wed, 25 Oct 2023 18:41:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698284460; cv=none; d=google.com; s=arc-20160816; b=aPMh1+WBqvWWulyvKk4hn2JUpjXWHDomfcjrBnUi5JEZy+VQvTJu0V1XwJMYboj1JY 4sD9BDQUiAYdoeLJn4wGE67ypgSTPCI2CQpmZjAVC2o6XiF/2e8tIc8SIK4+HqXwcy0i Tu1ZLd0hwS6MjAc24lg7csiLWNjmmFCyL3LisZGfgng9otufw1jx2NCj5vefqAeljH98 Y6P/8IjQzn4YhbBvWx6+QDX6lVSQ3JjQhIkwgjI4zcCRQumIP0LHX4ojVA2lb+ZwXJIz KHOdKPRaCGgwxgmZzUoNJxkHqnqujeDSmZOFbev0M8m51rHmCq0rk+/qb+wkE5bub+ps F5Xw== 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=3Ac4bKXSMeM5uVC6CTO1z9nXWFNWqWVCu3/+uN4eO3k=; fh=3mEp7FusppN5Drq2PN08R8D/9xXM9YdbtG5TkJxJBiE=; b=cHpiBEQOfJ0yEWrFLB+g51Vvwzp78LQjgqSEQIT77l5uo9qig2EzJUADx8uT65/p1n Q0d6yU6LcD6lOymfVH4gYp4JUHNh8M11UpivWvbWbe92RNe+cF/570O7vsq8HEmUVNJH h149dYlKLoYODcS7BXJbevdywtElZl81LDKitp6SucGfP2nVt/EkaawP92CM99rw2kKI yN2ELk5AzDh2eLNX1/9DH2GNxadctC9O3O2zjPKZqsHGAoCo4eLAoAfFN92Sh6upvV0I ouEjCFhmf3yxtqQhUETx9LDquW6AmFeBcIFYXGKJHjsBlTJkC97dE8JOw8x9x4xvyude bTJA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=DzFNjuPU; 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 r4-20020a5d6944000000b0032ddf8de915si8359814wrw.608.2023.10.25.18.41.00 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 25 Oct 2023 18:41:00 -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=DzFNjuPU; 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 1qvpLl-0001sR-8y; Wed, 25 Oct 2023 21:39:53 -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 1qvpLi-0001rH-54 for qemu-devel@nongnu.org; Wed, 25 Oct 2023 21:39:50 -0400 Received: from mail-pl1-x62b.google.com ([2607:f8b0:4864:20::62b]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qvpLg-00033z-2T for qemu-devel@nongnu.org; Wed, 25 Oct 2023 21:39:49 -0400 Received: by mail-pl1-x62b.google.com with SMTP id d9443c01a7336-1c9b7c234a7so2757735ad.3 for ; Wed, 25 Oct 2023 18:39:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1698284386; x=1698889186; 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=3Ac4bKXSMeM5uVC6CTO1z9nXWFNWqWVCu3/+uN4eO3k=; b=DzFNjuPUMbz0C3nEzorNxI4kK9c3OTBnDDfzdz5Vqie2dF+6UVBncDL774MH5fwgEW 5nmuq/OIgbc+Y9WLi3RIG7zFyH99T99YXT3V027SGQZEaSNIzOyIWJUkmSfeFBT+0RWZ RRvW+kdPt83eH0SIAqU8DVN7uFy4TSDO6ho4YFMw8s5rt0B4/yNfJa8iDsbRqs+7+AJs /pRvoEtv5csIU6QYng5LZsPAyYZnnogB2G78X7XU/GnEIdEPGMNyfQ6S7WryIHHhNR+4 DYSYT6E4GV9NwKttd9BkCYz2p2DHLvPbaSivLzQC8qpeX1rspB4wNT77D2ihDcDmv5j5 mpcg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698284386; x=1698889186; 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=3Ac4bKXSMeM5uVC6CTO1z9nXWFNWqWVCu3/+uN4eO3k=; b=Bkh4srVEIhfVzly5jRfOwUVMJrUCtn1QYURbvCYfS8U5o63bFhFR43xLwDzHJtXzeD lZSCS+wJVipHIBNMGlFvxvgs1H4WZmncJ02JF3BSFhd6LEVkMqX2S6hyn0fmCMsyQNkN z/HkILos22MwrnZxVwGyo/7k+VuhqUY7hvas+Wmn2gWab1lJpe9ftshYNv373eW2ePCq HnSjakSSfQbtzGnib9shY0Yz7SxEidQK6L0uRBENOlPDV+aYeW4TPXSavba3/8bo+SzA tCgciumhh8FN/SBbLSR1dGWxBezdAJtz+B1lljC+j4svZg/qH+paY9yulOKBLyJUArqd 6vuA== X-Gm-Message-State: AOJu0Yw6RYWORmaitKCI1rINiFdFpWA89lUMyZr/AoHK0Ei8Y1bNsNe5 I77pQsU9b/hjgznraSFaId6TUOFA9hY4Rl0+O8g= X-Received: by 2002:a17:90a:d407:b0:27d:7ebe:2e8 with SMTP id r7-20020a17090ad40700b0027d7ebe02e8mr17986103pju.9.1698284386512; Wed, 25 Oct 2023 18:39:46 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id y6-20020a170902864600b001c0c86a5415sm9817032plt.154.2023.10.25.18.39.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 25 Oct 2023 18:39:46 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: pbonzini@redhat.com Subject: [PATCH 0/4] tcg: Canonicalize SUBI to ANDI Date: Wed, 25 Oct 2023 18:39:41 -0700 Message-Id: <20231026013945.1152174-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::62b; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x62b.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 Supercedes: 20231025185956.72677-1-pbonzini@redhat.com ("tcg: allow a target to request canonicalization of SUBI to ADDI") Based-on: 20231025072707.833943-1-richard.henderson@linaro.org ("tcg: Introduce TCG_COND_TST{EQ,NE}") There a couple of optimize.c routines introduced which I use here. The final NOTFORMERGE patch suggests that I've caught all of the cases, but I certainly wouldn't want to merge the assert without a lot more testing. r~ Richard Henderson (4): tcg: Canonicalize subi to addi during opcode generation tcg/optimize: Canonicalize subi to addi during optimization tcg/optimize: Canonicalize sub2 with constants to add2 NOTFORMERGE tcg/i386: Assert sub of immediate has been folded tcg/optimize.c | 35 +++++++++++++++++++++++++--- tcg/tcg-op.c | 25 +++++++------------- tcg/tcg.c | 49 ++++++++++++++++++++++++++------------- tcg/i386/tcg-target.c.inc | 13 ++++++++--- 4 files changed, 84 insertions(+), 38 deletions(-)