From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-lf1-x129.google.com (mail-lf1-x129.google.com [IPv6:2a00:1450:4864:20::129]) by sourceware.org (Postfix) with ESMTPS id 05A613858404 for ; Tue, 23 Apr 2024 10:47:46 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 05A613858404 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=vrull.eu Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=vrull.eu ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 05A613858404 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2a00:1450:4864:20::129 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1713869268; cv=none; b=YXsSAuYqsUTzYUnlEDeg/azFK8R5LO94wyHCMW2LCxi5n3vp7dTxKsb1PeJTXzMor5LCfaxaYHG79PEXhYpxpbEVn9n8RwT3Tdap9yNmDdQnpLaOmWzgoFgoO6sDNYyS4nAVRHeqa+WurO6UW9oWkdIpnANhqXBpxXf0btTKuPQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1713869268; c=relaxed/simple; bh=iBdFzTTVy5/Lc2yq2dmHsplA57Uiod6BfdHt5KBbVh4=; h=DKIM-Signature:From:To:Subject:Date:Message-Id:MIME-Version; b=imiGkqEAI9qm6WX1YjWgDdq2Gg/BtrFJ8HMqXSWNEoTiRWTKRTvee72YWe8FfV2t8g641M8vRpyVRyavK74YTsy8awvOh9X7SVu5gY5dM5bVNyiwoAgp/ebiQ8ZBNIIcpTHfX8Nys3ImkcExoCYOd4t9dRMnMFaYfg9z9QFVArc= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-lf1-x129.google.com with SMTP id 2adb3069b0e04-5194cebd6caso6584951e87.0 for ; Tue, 23 Apr 2024 03:47:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=vrull.eu; s=google; t=1713869264; x=1714474064; darn=gcc.gnu.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=vUXict6G3ZCXUgMlBVVwVmdV57OkTK5/nORf09b+llA=; b=JydjHQnkF/x8Ti+8oAwXjMY4aJcFuxIuorOyOQ5y+RduLqXgWbvDTFIrj3o9zZ+Vfa T6bBGFwbTuRlR9A5z8Ft2fWaerCiSnV99jOQmMEK8mbsutOUOyD2k0cO/cstbgg1fcs8 3lhpg6LkkShyyXsCd45RO/znryi8mQDLIL4Qs/DMOK44XYEqPXpziekUkoPF7OhfbDZ3 ktuwQqylAnopVA9gf7uPPdA7y6USbbBrZRF2viNLf7OP9UfwsKntSD9GA11YWMp1Yroy VTuuCZgCeWtyKlN0qIX4lTt3Cs37yuDT3JR96ekRc9uuKaKn5Xwm7AjXxNoaX+KiH2Wm E68w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1713869264; x=1714474064; 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=vUXict6G3ZCXUgMlBVVwVmdV57OkTK5/nORf09b+llA=; b=liz/wNMfx5m/GMXPhgyEhv5tCQFqRit11ojPVSVzQPF8svW/YZUuSW9rYECkmXV/NA +HZS1ld/u2cSX8Jz1y8r56TjXCbB97+RXXdreqVfOlYZjCJ2bVeqi7Kwohe17qKWOgdv T2lMT+u46WHdZnCztHUL5vfpO+k1wut90KJEhBvSiIhc1GG491P/yOrDGnoMOF7cp04K RB6XbYtTr+Pr0Qi98wm36Yos7fKHSaNw1cupsYmNWQ7uDRzPccBeWeI0QVWZ+HAj6n5e hNptcoYJZtjiryHlMI1YeiOumUMNHtCZ3iHKfkIMEdXcVv/O0uCXM8Q/adxU79wOtxXH 3dnA== X-Gm-Message-State: AOJu0YxusFsqoVW30ytr1CMAO7nS4l+zynryFwaE9GSfa3OGmRGW78Rr 4V9tYK8GRYWRGYvT8RfWsqoEoqBXamITTWo/omfVKa3AwMp/8qWmgbpXA13gTWB8OtOM+7pGTli yc4I= X-Google-Smtp-Source: AGHT+IEafXj88dpiSV7atILxNEMoM2ggohQ/E7fGNCt4Mi5Wfa1s7EFsOTZ2rjdni6vptr61cjOYIQ== X-Received: by 2002:a05:6512:6f:b0:518:c5bd:cf78 with SMTP id i15-20020a056512006f00b00518c5bdcf78mr7467839lfo.31.1713869263934; Tue, 23 Apr 2024 03:47:43 -0700 (PDT) Received: from helsinki-03.engr ([2a01:4f9:6b:2a47::2]) by smtp.gmail.com with ESMTPSA id cf14-20020a056512280e00b00515cb94af43sm1995785lfb.16.2024.04.23.03.47.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 23 Apr 2024 03:47:43 -0700 (PDT) From: Manolis Tsamis To: gcc-patches@gcc.gnu.org Cc: Robin Dapp , Jiangning Liu , Philipp Tomsich , Richard Sandiford , Jakub Jelinek , Manolis Tsamis Subject: [PATCH v4 0/3] ifcvt: Allow if conversion of arithmetic in basic blocks with multiple sets Date: Tue, 23 Apr 2024 12:47:37 +0200 Message-Id: <20240423104740.4027243-1-manolis.tsamis@vrull.eu> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-5.5 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,KAM_SHORT,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: noce_convert_multiple_sets has been introduced and extended over time to handle if conversion for blocks with multiple sets. Currently this is focused on register moves and rejects any sort of arithmetic operations. This series is an extension to allow more sequences to take part in if conversion. The first patch is a required change to emit correct code and the second patch whitelists a larger number of operations through bb_ok_for_noce_convert_multiple_sets. The third patch adds support to rewire multiple registers in noce_convert_multiple_sets_1 and refactors the code with a new helper info struct. The fourth patch removes some old code that should not be needed anymore. For targets that have a rich selection of conditional instructions, like aarch64, I have seen an ~5x increase of profitable if conversions for multiple set blocks in SPEC benchmarks. Also tested with a wide variety of benchmarks and I have not seen performance regressions on either x64 / aarch64. Some samples that previously resulted in a branch but now better use these instructions can be seen in the provided test cases. Bootstrapped and tested on AArch64 and x86-64. Changes in v4: - Remove unnecessary hardcoded list of allowed ops in bb_ok_for_noce_convert_multiple_sets. - Set need_cmov based on BB live_out instead of REG_DEAD notes. - Fix preexisting issues and improve the code that sets read_comparison. Manolis Tsamis (3): [RFC] ifcvt: handle sequences that clobber flags in noce_convert_multiple_sets [RFC] ifcvt: Allow more operations in multiple set if conversion [RFC] ifcvt: Handle multiple rewired regs and refactor noce_convert_multiple_sets gcc/ifcvt.cc | 383 ++++++++---------- gcc/ifcvt.h | 16 + .../aarch64/ifcvt_multiple_sets_arithm.c | 79 ++++ .../aarch64/ifcvt_multiple_sets_rewire.c | 20 + 4 files changed, 292 insertions(+), 206 deletions(-) create mode 100644 gcc/testsuite/gcc.target/aarch64/ifcvt_multiple_sets_arithm.c create mode 100644 gcc/testsuite/gcc.target/aarch64/ifcvt_multiple_sets_rewire.c -- 2.34.1