From patchwork Sat Nov 7 00:02:03 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Segher Boessenkool X-Patchwork-Id: 1396006 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=2620:52:3:1:0:246e:9693:128c; helo=sourceware.org; envelope-from=gcc-patches-bounces@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=kernel.crashing.org Received: from 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 RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4CScrP168tz9sRK for ; Sat, 7 Nov 2020 11:02:13 +1100 (AEDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id EC51F3A6FC21; Sat, 7 Nov 2020 00:02:10 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from gcc1-power7.osuosl.org (gcc1-power7.osuosl.org [140.211.15.137]) by sourceware.org (Postfix) with ESMTP id 029E63A59423 for ; Sat, 7 Nov 2020 00:02:09 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 029E63A59423 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=kernel.crashing.org Authentication-Results: sourceware.org; spf=none smtp.mailfrom=segher@gcc1-power7.osuosl.org Received: by gcc1-power7.osuosl.org (Postfix, from userid 10019) id 67F831240300; Sat, 7 Nov 2020 00:02:08 +0000 (UTC) From: Segher Boessenkool To: gcc-patches@gcc.gnu.org Subject: [PATCH] rs6000: Don't use operands[] for temporaries in define_expand Date: Sat, 7 Nov 2020 00:02:03 +0000 Message-Id: <2bf9d32c557d8ed305915c00c0850027dab2f640.1604706592.git.segher@kernel.crashing.org> X-Mailer: git-send-email 1.8.3.1 X-Spam-Status: No, score=-13.2 required=5.0 tests=BAYES_00, GIT_PATCH_0, HEADER_FROM_DIFFERENT_DOMAINS, KAM_DMARC_STATUS, KAM_LAZY_DOMAIN_SECURITY, SPF_HELO_NONE, SPF_NONE, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Segher Boessenkool , dje.gcc@gmail.com Errors-To: gcc-patches-bounces@gcc.gnu.org Sender: "Gcc-patches" In ac001f5ce604 Alan fixed my thinko using operands that do not refer to anything mentioned in the RTL pattern. Instead, it just uses fresh new local rtxes for those. This patch takes that a tiny bit further: it uses local rtx for all temporaries used in the expanders. As a bonus that simplifies the code a tiny bit as well. 2020-11-06 Segher Boessenkool * config/rs6000/rs6000.md (@tablejump_normal): Don't abuse operands[]. (@tablejump_nospec): Ditto. --- gcc/config/rs6000/rs6000.md | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/gcc/config/rs6000/rs6000.md b/gcc/config/rs6000/rs6000.md index acbf130..5e5ad9f 100644 --- a/gcc/config/rs6000/rs6000.md +++ b/gcc/config/rs6000/rs6000.md @@ -12732,14 +12732,11 @@ (define_expand "@tablejump_normal" (use (match_operand:P 1))] "rs6000_speculate_indirect_jumps" { - rtx off; - operands[0] = force_reg (SImode, operands[0]); - if (mode == SImode) - off = operands[0]; - else + rtx off = force_reg (SImode, operands[0]); + if (mode != SImode) { + rtx src = gen_rtx_fmt_e (SIGN_EXTEND, Pmode, off); off = gen_reg_rtx (Pmode); - rtx src = gen_rtx_fmt_e (SIGN_EXTEND, Pmode, operands[0]); emit_move_insn (off, src); } @@ -12757,14 +12754,11 @@ (define_expand "@tablejump_nospec" (use (match_operand:CC 2))] "!rs6000_speculate_indirect_jumps" { - rtx off; - operands[0] = force_reg (SImode, operands[0]); - if (mode == SImode) - off = operands[0]; - else + rtx off = force_reg (SImode, operands[0]); + if (mode != SImode) { + rtx src = gen_rtx_fmt_e (SIGN_EXTEND, Pmode, off); off = gen_reg_rtx (Pmode); - rtx src = gen_rtx_fmt_e (SIGN_EXTEND, Pmode, operands[0]); emit_move_insn (off, src); }