From patchwork Sun Jun 16 03:18:25 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeff Law X-Patchwork-Id: 1948257 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20230601 header.b=IC45Mh7D; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=2620:52:3:1:0:246e:9693:128c; helo=server2.sourceware.org; envelope-from=gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=patchwork.ozlabs.org) Received: from server2.sourceware.org (server2.sourceware.org [IPv6:2620:52:3:1:0:246e:9693:128c]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4W1ysV4C3pz20Wb for ; Sun, 16 Jun 2024 13:18:52 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 976053858C33 for ; Sun, 16 Jun 2024 03:18:50 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-oi1-x22c.google.com (mail-oi1-x22c.google.com [IPv6:2607:f8b0:4864:20::22c]) by sourceware.org (Postfix) with ESMTPS id 6F77B3858C48 for ; Sun, 16 Jun 2024 03:18:29 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 6F77B3858C48 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 6F77B3858C48 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2607:f8b0:4864:20::22c ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1718507911; cv=none; b=g5XTWfKC7IFpaQnL/FvA0f2t4X65vcxKnj+uiMyBUNucMSeIzgtzY34ooxhfySUA2a3ltbYkP9MobckbfoqDbT550HxHrB2bpWZTvChouyLH10+zVtPVbJdHVqUQbloFPzUdtbEwR8W3DwX7pD/jJfPInuf7Ih685hXC5HINbzE= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1718507911; c=relaxed/simple; bh=1wvL1GhZqL1NpWr5JKq7hZyeE1zkULxntt6JZ6+GWeg=; h=DKIM-Signature:Message-ID:Date:MIME-Version:From:To:Subject; b=baY3R138WbXv2Eb01q4I4OrDKO5PYwc7M2xxeB+rltztTCjLXA+TC2vYOfG0UTmiWSKPaPH5ZEwk4vVK3gcvaAHEM2+DS4vtcVUKwDzxRcvQcZ0NfarLdJb5oFf8VBdsa4bA5wfMjBY0xahQW/1if9sxpn5jYOmxwx1IXdKuoRk= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-oi1-x22c.google.com with SMTP id 5614622812f47-3d227b1f4f0so1853726b6e.3 for ; Sat, 15 Jun 2024 20:18:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1718507908; x=1719112708; darn=gcc.gnu.org; h=subject:to:from:content-language:user-agent:mime-version:date :message-id:from:to:cc:subject:date:message-id:reply-to; bh=cfIKOmCDBjOKQ9Ns7hYGac9J8TG3t8/7/h2Wi/7W2eI=; b=IC45Mh7D/MxdWzAotIhvi4B0MPDp0LwAO3rzjzVArv+RsYk3BBPoNcnLgewfgrNwH7 9bOcYCZIfTJpG6FyG8tNDaV6IjUxjf3ki7GNmnZFE61OxKKFZopmgURHQ4eHVBAEDocW vDtyRPNyYPApKv1946u94Gxq6FXX2FXSzHeCRNVWM+Re96dvxjqkCRnCRSvuYiAQVE4D yZvjgVOxGszpkHLP17So5YJeWZyvbJ186Wbg6pTrzNb+6ZIPO2ZNjyvQJLv4Ze7qXUCE P2xO7U74FKXXAwYivD3CjjIGLKK4HOWOfK20PyLkHwJYD4VFGwQPrt06BlM6APU6BVZx 2YJA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1718507908; x=1719112708; h=subject:to:from:content-language:user-agent:mime-version:date :message-id:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=cfIKOmCDBjOKQ9Ns7hYGac9J8TG3t8/7/h2Wi/7W2eI=; b=verGBnuGLNqEPYGJyxS/H3s0DbKaMFURsrBQjmBsV6ieuH5BVwaHGTECt775eGQdSY TtWsyVw3ErhyUzqmaJxmyoemD8NakGfKs/4/NY+17Te3qAZTRPB79twQUgK96BHoteBt PPXWSYOLDUuptkpNWviL0SBdwrka1BJmSK1MfjBalbG5j+vGmPCcNGXernFa96ej9lEO l+1u8n/vHGaDYUIlUO+BsDGo8tvomuLKMb96qbqC/NlSqEsDtEl2pzKAJ1CF73BBAf/O nHU+FCrLQgO/0Bo7kbn6nVoW+O/G2mqk76MZlEhbb+AfVVxldRbK1Pqj8siwSBEG6NkY q2EQ== X-Gm-Message-State: AOJu0YzsuomNcBz6tKYzvRIJgv7yn5HPQMUpKxQ1RZjCfSOAcxvyVbXv TuuHlrDiK3+SfACH9LoT/xkBDxs0Fd7BxqgEPGuqlp5qhr/oyqz0sq2Q7A== X-Google-Smtp-Source: AGHT+IHvVoEfw3kdbwBePXRBxAEe2VtPOy/M//P+c8GdPVddVFJN/ASjmabZgozUrigEDuj6YuB5Hw== X-Received: by 2002:a05:6808:220b:b0:3d2:20e2:3695 with SMTP id 5614622812f47-3d24e9efa5dmr7216961b6e.56.1718507907871; Sat, 15 Jun 2024 20:18:27 -0700 (PDT) Received: from [172.31.1.103] ([172.56.168.219]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-705ccb8fc74sm5356197b3a.199.2024.06.15.20.18.26 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sat, 15 Jun 2024 20:18:27 -0700 (PDT) Message-ID: Date: Sat, 15 Jun 2024 21:18:25 -0600 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Beta Content-Language: en-US From: Jeff Law To: "gcc-patches@gcc.gnu.org" Subject: [committed] Fix minor SH scan-asm failure after recent IOR->ADD changes X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, RCVD_IN_SBL_CSS, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org This fixes minor fallout from the IOR->ADD change for rotates that I installed a little while ago. Basically the SH backend has a special pattern for setting the T register that has elements similar to a rotate. With the IOR->ADD change that pattern no longer matches and we get scan-asm failures. Fixing isn't a trivial case of just replacing IOR with ADD as the IOR->ADD change changes some of the simplifications/canonicalizations along the way. The net is we need a pattern with a slightly different structure. I've regression tested this on sh3[eb]-linux-gnu and bootstrapped sh4-linux-gnu (without a regression test). Pushing to the trunk, Jeff gcc/ * config/sh/sh.md (neg_zero_extract_4b): New pattern. diff --git a/gcc/config/sh/sh.md b/gcc/config/sh/sh.md index 19481c07db6..92a1efeb811 100644 --- a/gcc/config/sh/sh.md +++ b/gcc/config/sh/sh.md @@ -10093,6 +10093,25 @@ (define_insn_and_split "*neg_zero_extract_4" [(set (reg:SI T_REG) (zero_extract:SI (xor:SI (match_dup 0) (match_dup 1)) (const_int 1) (match_dup 2)))]) +;; Same thing, but when we use a PLUS rather than IOR/XOR for the rotation +;; which causes things to simplify somewhat differently. +(define_insn_and_split "*neg_zero_extract_4b" + [(set (reg:SI T_REG) + (and:SI (not:SI (plus:SI + (lshiftrt:SI (match_operand:SI 0 "arith_reg_operand") + (match_operand 1 "const_int_operand")) + (ashift:SI (match_operand:SI 2 "arith_reg_operand") + (match_operand 3 "const_int_operand")))) + (const_int 1)))] + "TARGET_SH1 && can_create_pseudo_p () + && INTVAL (operands[3]) > 0 + && INTVAL (operands[1]) + INTVAL (operands[3]) == 32" + "#" + "&& 1" + [(set (reg:SI T_REG) (zero_extract:SI (xor:SI (match_dup 0) (match_dup 4)) + (const_int 1) (match_dup 1)))] + { operands[4] = GEN_INT (1 << INTVAL (operands[1])); }) + (define_insn_and_split "*neg_zero_extract_5" [(set (reg:SI T_REG) (and:SI (not:SI (subreg:SI