From patchwork Mon Aug 30 06:24:03 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 504286 Delivered-To: patch@linaro.org Received: by 2002:a02:8629:0:0:0:0:0 with SMTP id e38csp1510489jai; Sun, 29 Aug 2021 23:26:05 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwBtdDfaVPYcNVSQ07iUrMbprM/OKrKE+bkBenj4q34NQV29cBE858p6rxBNvEhOqmdJMak X-Received: by 2002:a25:cc49:: with SMTP id l70mr20426547ybf.370.1630304765231; Sun, 29 Aug 2021 23:26:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1630304765; cv=none; d=google.com; s=arc-20160816; b=GdjsS8Yu4ph32vLoc17dBFy0qzU4Sxsdh46p9lsGu45O0CGIOda8cRBZVSQyQCFEx5 I3/c7TIXQuWyctgVJsuNE/4kEsrVzmcV39LmHvToLgwaJz7d2rgXUJU5tlG/7FFE7Zsx EypgOa50gvghQahmANiRh35/uqktc5qrf3FkyiCat5NzHC+UJrHWiMVy/3o0FohxroHm 0vkkYYGXcGzsWzw25f27sFaJFCkff9a37xsp6lg1Y3LtygSllH8hIodRFY/YLEOYzkkY F2toOpUZIWlrMZGV1L49qjeQQP/B9Wb8tb5fb+aCQogyL1mf9CQ0rjmMi+TUSfstVNu5 /SfQ== 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=ELO8ldzR6uETqHFDoxmjf00JPNHufBQpShlXLq8y3W4=; b=dHzkUS2QTM1HKCLhaHZfbVYJB+M3nSsQfHnRQSTXx+2kL0hwun4qiWPhxYPVL2AxqR 5Vmx+4D/sjZJnUeavqN+JPr/KyVGJrS0gcYVgPHGQm34ndo2iRJrIR+ttHzYLNp2LgDO p26zLzjK4jq9r1MG9NTvu5xxlOt0tFxafJTFQmUAY3aWvMcqIoaX47qJfYd9j7e96ZB7 0j+n2rF9WjCbvm5J4v4WORzL6FNk1RLoO7y3+Z1zfmXNc050jc3uRkB9xDL+MaqWWQ2i 7xXCsz41fbI6U0ZMZ9T/oaznagf5zr3WqdipmrTNo4nmTPpJnyFMbk9wO4cG5OwSA2I5 J4JQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Tqbm0Iz7; 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 x17si12876944ybm.108.2021.08.29.23.26.05 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sun, 29 Aug 2021 23:26:05 -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=Tqbm0Iz7; 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]:59030 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mKak8-0003Xw-MZ for patch@linaro.org; Mon, 30 Aug 2021 02:26:04 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:46098) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mKaj3-0003XH-5O for qemu-devel@nongnu.org; Mon, 30 Aug 2021 02:24:57 -0400 Received: from mail-pg1-x52d.google.com ([2607:f8b0:4864:20::52d]:40619) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mKaj1-0007M7-AZ for qemu-devel@nongnu.org; Mon, 30 Aug 2021 02:24:56 -0400 Received: by mail-pg1-x52d.google.com with SMTP id y23so12413938pgi.7 for ; Sun, 29 Aug 2021 23:24:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:mime-version :content-transfer-encoding; bh=ELO8ldzR6uETqHFDoxmjf00JPNHufBQpShlXLq8y3W4=; b=Tqbm0Iz7VtSJ45AuyhvlmuSEqZWFxIABFEIOkZZmKbBgR3rabzHQRNJdPGWWBhtdWv JKmXB+MjSh/jhCXBVO1Y1EFf2yL+KDCCoht+KU7qmslus4dInFfmjwdy4XAUDh7ccuv/ aCc/jqqWTdDx/flMvN++soj2T8S43o10mlNnTeFzHKqFvGenTeJh6D4uZSGA9rFsFQ6p POvhRMzQcukjJriD8jTj92AvRHJYLUzyG2eoDEFuhL7iRA4fAyTJ8/irYEK1Hvkn15ye V7XlQM3UKCBFv50aEWVn6SPd7sWagvvVe3OUMFqYMFaYG1U0ok2DAEspxFDENZbszk4u nQ9A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:mime-version :content-transfer-encoding; bh=ELO8ldzR6uETqHFDoxmjf00JPNHufBQpShlXLq8y3W4=; b=oggzko4bIQTtnuinmQmRkBMJep0jPKIrvd3e+dh0UjdX011VYjHEMkJFfus++9GCdw MvP9r7mpU4Bz7SKV0Xm6i8lQzADijTcXEFRn4noImXjceyalqY3hHJr1IhPnV+/jPphR w6FD4f3OsjjCoj+ARG/HdOfSFFSIIoGejMF+bOSvEHRbps1XhV7zXL0EPzP7gj1Vv+CU 79zYeFtQCT8g8JZ8U1dnYGEeLe5qoXmPjQYjACYARr4dMRFeSvCPte4tchzDVG1MjlgE PDZ6Wn0hX/C3koR44cMP6QtnubRMummGGlH2bzkkVaNIPuvGu85lV4wf1Ls1+xqo75nT cJZA== X-Gm-Message-State: AOAM533MwjCoEl/PRbDa1agBe7aHFiwuAmS/Qp85sJc2sw4uIIM6D5dd Um/lfQDIhB7CXjBeCYeklocyln6SFeX+LA== X-Received: by 2002:a63:da49:: with SMTP id l9mr20163867pgj.277.1630304692908; Sun, 29 Aug 2021 23:24:52 -0700 (PDT) Received: from localhost.localdomain (174-21-72-39.tukw.qwest.net. [174.21.72.39]) by smtp.gmail.com with ESMTPSA id b12sm13942084pff.63.2021.08.29.23.24.52 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 29 Aug 2021 23:24:52 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH 00/48] tcg: optimize redundant sign extensions Date: Sun, 29 Aug 2021 23:24:03 -0700 Message-Id: <20210830062451.639572-1-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::52d; envelope-from=richard.henderson@linaro.org; helo=mail-pg1-x52d.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.23 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" Currently, we have support for optimizing redundant zero extensions, which I think was done with x86 and aarch64 in mind, which zero-extend all 32-bit operations into the 64-bit register. But targets like Alpha, MIPS, and RISC-V do sign-extensions instead. The last 5 patches address this. But before that, split the quite massive tcg_optimize function. r~ Richard Henderson (48): tcg/optimize: Rename "mask" to "z_mask" tcg/optimize: Split out OptContext tcg/optimize: Remove do_default label tcg/optimize: Change tcg_opt_gen_{mov,movi} interface tcg/optimize: Move prev_mb into OptContext tcg/optimize: Split out init_arguments tcg/optimize: Split out copy_propagate tcg/optimize: Split out fold_call tcg/optimize: Drop nb_oargs, nb_iargs locals tcg/optimize: Change fail return for do_constant_folding_cond* tcg/optimize: Return true from tcg_opt_gen_{mov,movi} tcg/optimize: Split out finish_folding tcg/optimize: Use a boolean to avoid a mass of continues tcg/optimize: Split out fold_mb, fold_qemu_{ld,st} tcg/optimize: Split out fold_const{1,2} tcg/optimize: Split out fold_setcond2 tcg/optimize: Split out fold_brcond2 tcg/optimize: Split out fold_brcond tcg/optimize: Split out fold_setcond tcg/optimize: Split out fold_mulu2_i32 tcg/optimize: Split out fold_addsub2_i32 tcg/optimize: Split out fold_movcond tcg/optimize: Split out fold_extract2 tcg/optimize: Split out fold_extract, fold_sextract tcg/optimize: Split out fold_deposit tcg/optimize: Split out fold_count_zeros tcg/optimize: Split out fold_bswap tcg/optimize: Split out fold_dup, fold_dup2 tcg/optimize: Split out fold_mov tcg/optimize: Split out fold_xx_to_i tcg/optimize: Split out fold_xx_to_x tcg/optimize: Split out fold_xi_to_i tcg/optimize: Add type to OptContext tcg/optimize: Split out fold_to_not tcg/optimize: Split out fold_sub_to_neg tcg/optimize: Split out fold_xi_to_x tcg/optimize: Split out fold_ix_to_i tcg/optimize: Split out fold_masks tcg/optimize: Expand fold_mulu2_i32 to all 4-arg multiplies tcg/optimize: Expand fold_addsub2_i32 to 64-bit ops tcg/optimize: Sink commutative operand swapping into fold functions tcg/optimize: Add more simplifications for orc tcg/optimize: Stop forcing z_mask to "garbage" for 32-bit values tcg/optimize: Optimize sign extensions tcg/optimize: Propagate sign info for logical operations tcg/optimize: Propagate sign info for setcond tcg/optimize: Propagate sign info for bit counting tcg/optimize: Propagate sign info for shifting tcg/optimize.c | 2594 +++++++++++++++++++++++++++++------------------- 1 file changed, 1577 insertions(+), 1017 deletions(-) -- 2.25.1