From patchwork Thu May 30 13:30:45 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Takayuki 'January June' Suwa X-Patchwork-Id: 1941719 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=yahoo.co.jp header.i=@yahoo.co.jp header.a=rsa-sha256 header.s=yj20110701 header.b=Ppc7wkb2; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=8.43.85.97; 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 [8.43.85.97]) (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 4VqnKm5GCyz20Pr for ; Thu, 30 May 2024 23:34:36 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 46BF8385ED4A for ; Thu, 30 May 2024 13:34:34 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from omggw7002.mail.djm.yahoo.co.jp (omggw7002.mail.djm.yahoo.co.jp [183.79.54.29]) by sourceware.org (Postfix) with ESMTPS id 480173858C50 for ; Thu, 30 May 2024 13:33:15 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 480173858C50 Authentication-Results: sourceware.org; dmarc=pass (p=quarantine dis=none) header.from=yahoo.co.jp Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=yahoo.co.jp ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 480173858C50 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=183.79.54.29 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1717075998; cv=none; b=vE8QLmcZoUIBeYB/f0SecWmGDk39aiDndhu6eVhAbATu0+S+uYJzTSuBWXZoIT9JKvSFIQAiqM7TpIUZSN2zFSueIWxc7p+Qbay/0HRM2yQr9SFNz1bbctRJsvUjZTPWS6nPOqIZxnY59hC7/dzoOr9GdE03OfV4zPtefAfV8uo= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1717075998; c=relaxed/simple; bh=E0Kg9qlOa2TMu8nq/JW00qajeMRsaRNUvYQgFvjBrfE=; h=DKIM-Signature:Message-ID:Date:MIME-Version:To:From:Subject; b=jLJ5LxGtp0RO2Ba9O3ETjcPI/O2LPdKoTIdJoRIoIW2BweEnFW7kObztQcESgx+akLo+2AEEAb3PAINwUwAX5vS1ESsP2z5Qi5vTKuNqNjT9nwF4I4l/GWV2YXNxP3QGFtox+eRVn+IKNoDvhjPcosqhTmF8834E8XGkZDwK6C0= ARC-Authentication-Results: i=1; server2.sourceware.org X-YMail-OSG: 7GWPE9AVM1l.rOuJWOibnGDa9Wgmv0qzR6FGdCG1pwLeMvNIq.yzsOty5HEyL7R TFDENac0w50TOkdbX42w08JIr.fI64Ne4_6tN15FAOuGAAqmt.qDwLeFaypQOE3tGi_CR6LgjM2p DOGyQP7z7GwONIY4bnT9uzaTtwLMF3_jOG8NwR3Rz4wZ3JZjeyY6YFsQG3LrSBrlI.ySTvRguY0o h.cLPP_ywyTtCeppEOnovNdhwIRNya6zCI2x35lfP0wZBqKlB9lfUHHdWB8Nfp2M3gQIB0WvQGam 4lka1i6_EVOuYgs2VoNbmFXxtxtjCTEf.Gj9plvz.R2ky10OYdhZxnyWSgB05PsofOmRlSXMGI1s qdFHXqV3jX1FzleKRlhALfzWdyAQOkpQ9cXm.TwnrmU0tjkN0cfZAlDcmtowqUjoTgzucQ.8t_15 17RjI5XlADBDkqEcCp.VdNRzgnBwd0M9Xln6m9b1s_ksBSi4HY02Mda4FyxAlAD7piDCO.tRVPuI PpOkTBY.PTKyO2GZZNHv7yH_SGaEu1lep0C8g7IUDmZEIRQJDYclslazRCl4FT3dyqWqqb8N.H3O Mo1Nwg1i8_HiysQPWm8IshcfaNLd6x_NgaOJgIRh24VkEiDc_Hf.4in3tX1ahyFdBq_PgzAgoyVT be5P5.5JmB4DoKZNYVaVamx6XTPlej5a54foQbnUaWwm48WGsspul4xjU.lO7ufksQAbqgOU0cWm 5hejccKtEUMShC7uow.TFor6HfD90PsfsoWwdUUsuhGmPPCmT.4jNTFcdPM28w77CT_tfHdeKiS5 ihjOs_ivh3_aX2gAILyDY5AB5NXJNbkf1l8vt9n.TxcEtgyRzNazx2D.WcTnGmfwJLZQMBpZEB_H osIZlho76zFty_EJ2F6Sm663RHaaTeDnI1jBAqMjT4_2GlEA7crgc.Rg44TGTHEae0MW0r2zV1mA vDlLtn3BYPwErQ4mmepzfMhq1kpBbIhNcV8ftZE.rJyFl.wEkLj5OUkYklOMUbnM0dVBvVh3_ASo ZUPLDPNWTznI5qz1MuUgRoNtKJqV5ZQ_ihvAwVLNmsCceRH01GA6B5o9_WIA6dmuhPIEO0VuKqLL NuwJFeE_LsPJZoB_i08W8sylGmQ-- Received: from sonicgw.mail.yahoo.co.jp by sonicconh5001.mail.kks.yahoo.co.jp with HTTP; Thu, 30 May 2024 13:33:12 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; t=1717075845; s=yj20110701; d=yahoo.co.jp; h=References:Content-Transfer-Encoding:Content-Type:Subject:From:Cc:To:MIME-Version:Date:Message-ID; bh=2Kh6GiF3GaTt8jbPBtm8gepJK0zCMnJ20LMW2H8vkqA=; b=Ppc7wkb2E+5FtvuLWf+syKYd8qS4Mt0I5syYnqnjLnOBsGTHtSdVO0SxlsMWd/lf 32ZwcRjdd3/5+qX+1dQwMYVRSC1Nqyb6LGxyk78omY30QNaG7qhAsp4mQDe2Hz15uvf qHmjasQ7HoIKyOjV1w1SLwBWpy7iF0apeK+pq54w= DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=yj20110701; d=yahoo.co.jp; h=Message-ID:Date:MIME-Version:Cc:From:Content-Type:Content-Transfer-Encoding:References; b=MBtz8ggHz3rpaMgpqpeZc0VIMlEC855lzWkutWrCtVzYMq81eLb1P4/gFSfcy3pb geM5F2BbMVLHLuGM3ojJ67PCNqK+a39CqewGpwSCJrp4Qou+r42lVMe9JWJ0pA4ULBZ Z/lhhm52g/LOzNe6UQTzrxbIj0OpiuqeWuMREKsU=; Received: by smtphe5003.mail.kks.ynwp.yahoo.co.jp (YJ Hermes SMTP Server) with ESMTPA ID 91485c2307edba4c89b292f68f0ca6ce; Thu, 30 May 2024 22:33:07 +0900 (JST) Message-ID: Date: Thu, 30 May 2024 22:30:45 +0900 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Content-Language: en-US To: gcc-patches@gcc.gnu.org Cc: Max Filippov From: Takayuki 'January June' Suwa Subject: [PATCH 1/2] xtensa: Use REG_P(), MEM_P(), etc. instead of comparing GET_CODE() References: X-Spam-Status: No, score=-11.6 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_ENVFROM_END_DIGIT, FREEMAIL_FROM, FROM_FMBLA_NEWDOM28, GIT_PATCH_0, KAM_STOCKGEN, 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 Instead of comparing directly, this patch replaces as much as possible with macros that determine RTX code such as REG_P(), SUBREG_P() or MEM_P(), etc. gcc/ChangeLog: * config/xtensa/xtensa.cc (xtensa_valid_move, constantpool_address_p, xtensa_tls_symbol_p, gen_int_relational, xtensa_emit_move_sequence, xtensa_copy_incoming_a7, xtensa_expand_block_move, xtensa_expand_nonlocal_goto, xtensa_emit_call, xtensa_legitimate_address_p, xtensa_legitimize_address, xtensa_tls_referenced_p, print_operand, print_operand_address, xtensa_output_literal): Replace RTX code comparisons with their predicate macros such as REG_P(). * config/xtensa/xtensa.h (CONSTANT_ADDRESS_P, LEGITIMATE_PIC_OPERAND_P): Ditto. * config/xtensa/xtensa.md (reload_literal, indirect_jump): Ditto. --- gcc/config/xtensa/xtensa.cc | 90 ++++++++++++++++++------------------- gcc/config/xtensa/xtensa.h | 10 ++--- gcc/config/xtensa/xtensa.md | 4 +- 3 files changed, 51 insertions(+), 53 deletions(-) diff --git a/gcc/config/xtensa/xtensa.cc b/gcc/config/xtensa/xtensa.cc index 38c6966cc31..a356c1c22b0 100644 --- a/gcc/config/xtensa/xtensa.cc +++ b/gcc/config/xtensa/xtensa.cc @@ -563,18 +563,18 @@ xtensa_valid_move (machine_mode mode, rtx *operands) int smalloffset_mem_p (rtx op) { - if (GET_CODE (op) == MEM) + if (MEM_P (op)) { rtx addr = XEXP (op, 0); - if (GET_CODE (addr) == REG) + if (REG_P (addr)) return BASE_REG_P (addr, 0); if (GET_CODE (addr) == PLUS) { rtx offset = XEXP (addr, 0); HOST_WIDE_INT val; - if (GET_CODE (offset) != CONST_INT) + if (! CONST_INT_P (offset)) offset = XEXP (addr, 1); - if (GET_CODE (offset) != CONST_INT) + if (! CONST_INT_P (offset)) return FALSE; val = INTVAL (offset); @@ -608,7 +608,7 @@ constantpool_address_p (const_rtx addr) sym = XEXP (addr, 0); } - if ((GET_CODE (sym) == SYMBOL_REF) + if (SYMBOL_REF_P (sym) && CONSTANT_POOL_ADDRESS_P (sym)) return true; return false; @@ -618,9 +618,9 @@ constantpool_address_p (const_rtx addr) int constantpool_mem_p (rtx op) { - if (GET_CODE (op) == SUBREG) + if (SUBREG_P (op)) op = SUBREG_REG (op); - if (GET_CODE (op) == MEM) + if (MEM_P (op)) return constantpool_address_p (XEXP (op, 0)); return FALSE; } @@ -634,7 +634,7 @@ xtensa_tls_symbol_p (rtx x) if (! targetm.have_tls) return false; - return GET_CODE (x) == SYMBOL_REF && SYMBOL_REF_TLS_MODEL (x) != 0; + return SYMBOL_REF_P (x) && SYMBOL_REF_TLS_MODEL (x) != 0; } @@ -761,7 +761,7 @@ gen_int_relational (enum rtx_code test_code, /* relational test (EQ, etc) */ mode = GET_MODE (cmp1); /* Make sure we can handle any constants given to us. */ - if (GET_CODE (cmp1) == CONST_INT) + if (CONST_INT_P (cmp1)) { HOST_WIDE_INT value = INTVAL (cmp1); unsigned HOST_WIDE_INT uvalue = (unsigned HOST_WIDE_INT)value; @@ -780,7 +780,7 @@ gen_int_relational (enum rtx_code test_code, /* relational test (EQ, etc) */ cmp1 = force_reg (mode, cmp1); } } - else if ((GET_CODE (cmp1) != REG) && (GET_CODE (cmp1) != SUBREG)) + else if (! REG_P (cmp1) && ! SUBREG_P (cmp1)) { cmp1 = force_reg (mode, cmp1); } @@ -792,7 +792,7 @@ gen_int_relational (enum rtx_code test_code, /* relational test (EQ, etc) */ /* Comparison to constants, may involve adding 1 to change a LT into LE. Comparison between two registers, may involve switching operands. */ - if (GET_CODE (cmp1) == CONST_INT) + if (CONST_INT_P (cmp1)) { if (p_info->const_add != 0) cmp1 = GEN_INT (INTVAL (cmp1) + p_info->const_add); @@ -1275,7 +1275,7 @@ xtensa_emit_move_sequence (rtx *operands, machine_mode mode) rtx src = operands[1]; if (CONSTANT_P (src) - && (GET_CODE (src) != CONST_INT || ! xtensa_simm12b (INTVAL (src)))) + && (! CONST_INT_P (src) || ! xtensa_simm12b (INTVAL (src)))) { rtx dst = operands[0]; @@ -1372,12 +1372,12 @@ xtensa_copy_incoming_a7 (rtx opnd) /* The operand using a7 may come in a later instruction, so just return the original operand if it doesn't use a7. */ reg = opnd; - if (GET_CODE (reg) == SUBREG) + if (SUBREG_P (reg)) { gcc_assert (SUBREG_BYTE (reg) == 0); reg = SUBREG_REG (reg); } - if (GET_CODE (reg) != REG + if (! REG_P (reg) || REGNO (reg) > A7_REG || REGNO (reg) + hard_regno_nregs (A7_REG, mode) <= A7_REG) return opnd; @@ -1487,7 +1487,7 @@ xtensa_expand_block_move (rtx *operands) rtx x; /* If this is not a fixed size move, just call memcpy. */ - if (!optimize || (GET_CODE (operands[2]) != CONST_INT)) + if (!optimize || ! CONST_INT_P (operands[2])) return 0; bytes = INTVAL (operands[2]); @@ -1833,7 +1833,7 @@ xtensa_expand_nonlocal_goto (rtx *operands) /* Generate a call to "__xtensa_nonlocal_goto" (in libgcc); the code is too big to generate in-line. */ - if (GET_CODE (containing_fp) != REG) + if (! REG_P (containing_fp)) containing_fp = force_reg (Pmode, containing_fp); emit_library_call (gen_rtx_SYMBOL_REF (Pmode, "__xtensa_nonlocal_goto"), @@ -2295,7 +2295,7 @@ xtensa_emit_call (int callop, rtx *operands) static char result[64]; rtx tgt = operands[callop]; - if (GET_CODE (tgt) == CONST_INT) + if (CONST_INT_P (tgt)) sprintf (result, "call%d\t" HOST_WIDE_INT_PRINT_HEX, WINDOW_SIZE, INTVAL (tgt)); else if (register_operand (tgt, VOIDmode)) @@ -2334,11 +2334,11 @@ xtensa_legitimate_address_p (machine_mode mode, rtx addr, bool strict, && ! xtensa_tls_referenced_p (addr)) return true; - while (GET_CODE (addr) == SUBREG) + while (SUBREG_P (addr)) addr = SUBREG_REG (addr); /* Allow base registers. */ - if (GET_CODE (addr) == REG && BASE_REG_P (addr, strict)) + if (REG_P (addr) && BASE_REG_P (addr, strict)) return true; /* Check for "register + offset" addressing. */ @@ -2349,11 +2349,11 @@ xtensa_legitimate_address_p (machine_mode mode, rtx addr, bool strict, enum rtx_code code0; enum rtx_code code1; - while (GET_CODE (xplus0) == SUBREG) + while (SUBREG_P (xplus0)) xplus0 = SUBREG_REG (xplus0); code0 = GET_CODE (xplus0); - while (GET_CODE (xplus1) == SUBREG) + while (SUBREG_P (xplus1)) xplus1 = SUBREG_REG (xplus1); code1 = GET_CODE (xplus1); @@ -2472,15 +2472,14 @@ xtensa_legitimize_address (rtx x, rtx plus0 = XEXP (x, 0); rtx plus1 = XEXP (x, 1); - if (GET_CODE (plus0) != REG && GET_CODE (plus1) == REG) + if (! REG_P (plus0) && REG_P (plus1)) { plus0 = XEXP (x, 1); plus1 = XEXP (x, 0); } /* Try to split up the offset to use an ADDMI instruction. */ - if (GET_CODE (plus0) == REG - && GET_CODE (plus1) == CONST_INT + if (REG_P (plus0) && CONST_INT_P (plus1) && !xtensa_mem_offset (INTVAL (plus1), mode) && !xtensa_simm8 (INTVAL (plus1)) && xtensa_mem_offset (INTVAL (plus1) & 0xff, mode) @@ -2526,7 +2525,7 @@ xtensa_tls_referenced_p (rtx x) FOR_EACH_SUBRTX (iter, array, x, ALL) { const_rtx x = *iter; - if (GET_CODE (x) == SYMBOL_REF && SYMBOL_REF_TLS_MODEL (x) != 0) + if (SYMBOL_REF_P (x) && SYMBOL_REF_TLS_MODEL (x) != 0) return true; /* Ignore TLS references that have already been legitimized. */ @@ -3013,14 +3012,14 @@ print_operand (FILE *file, rtx x, int letter) switch (letter) { case 'D': - if (GET_CODE (x) == REG || GET_CODE (x) == SUBREG) + if (REG_P (x) || SUBREG_P (x)) fprintf (file, "%s", reg_names[xt_true_regnum (x) + 1]); else output_operand_lossage ("invalid %%D value"); break; case 'v': - if (GET_CODE (x) == MEM) + if (MEM_P (x)) { /* For a volatile memory reference, emit a MEMW before the load or store. */ @@ -3032,7 +3031,7 @@ print_operand (FILE *file, rtx x, int letter) break; case 'N': - if (GET_CODE (x) == MEM + if (MEM_P (x) && (GET_MODE (x) == DFmode || GET_MODE (x) == DImode)) { x = adjust_address (x, GET_MODE (x) == DFmode ? E_SFmode : E_SImode, @@ -3044,7 +3043,7 @@ print_operand (FILE *file, rtx x, int letter) break; case 'K': - if (GET_CODE (x) == CONST_INT) + if (CONST_INT_P (x)) { unsigned val = INTVAL (x); if (!xtensa_mask_immediate (val)) @@ -3057,28 +3056,28 @@ print_operand (FILE *file, rtx x, int letter) break; case 'L': - if (GET_CODE (x) == CONST_INT) + if (CONST_INT_P (x)) fprintf (file, HOST_WIDE_INT_PRINT_DEC, (32 - INTVAL (x)) & 0x1f); else output_operand_lossage ("invalid %%L value"); break; case 'R': - if (GET_CODE (x) == CONST_INT) + if (CONST_INT_P (x)) fprintf (file, HOST_WIDE_INT_PRINT_DEC, INTVAL (x) & 0x1f); else output_operand_lossage ("invalid %%R value"); break; case 'x': - if (GET_CODE (x) == CONST_INT) + if (CONST_INT_P (x)) printx (file, INTVAL (x)); else output_operand_lossage ("invalid %%x value"); break; case 'd': - if (GET_CODE (x) == CONST_INT) + if (CONST_INT_P (x)) fprintf (file, HOST_WIDE_INT_PRINT_DEC, INTVAL (x)); else output_operand_lossage ("invalid %%d value"); @@ -3086,12 +3085,12 @@ print_operand (FILE *file, rtx x, int letter) case 't': case 'b': - if (GET_CODE (x) == CONST_INT) + if (CONST_INT_P (x)) { printx (file, INTVAL (x)); fputs (letter == 't' ? "@h" : "@l", file); } - else if (GET_CODE (x) == CONST_DOUBLE) + else if (CONST_DOUBLE_P (x)) { if (GET_MODE (x) == SFmode) { @@ -3107,9 +3106,9 @@ print_operand (FILE *file, rtx x, int letter) /* X must be a symbolic constant on ELF. Write an expression suitable for 'const16' that sets the high or low 16 bits. */ if (GET_CODE (XEXP (x, 0)) != PLUS - || (GET_CODE (XEXP (XEXP (x, 0), 0)) != SYMBOL_REF - && GET_CODE (XEXP (XEXP (x, 0), 0)) != LABEL_REF) - || GET_CODE (XEXP (XEXP (x, 0), 1)) != CONST_INT) + || (! SYMBOL_REF_P (XEXP (XEXP (x, 0), 0)) + && ! LABEL_REF_P (XEXP (XEXP (x, 0), 0))) + || ! CONST_INT_P (XEXP (XEXP (x, 0), 1))) output_operand_lossage ("invalid %%t/%%b value"); print_operand (file, XEXP (XEXP (x, 0), 0), 0); fputs (letter == 't' ? "@h" : "@l", file); @@ -3127,8 +3126,7 @@ print_operand (FILE *file, rtx x, int letter) break; case 'y': - if (GET_CODE (x) == CONST_DOUBLE && - GET_MODE (x) == SFmode) + if (CONST_DOUBLE_P (x) && GET_MODE (x) == SFmode) { long l; REAL_VALUE_TO_TARGET_SINGLE (*CONST_DOUBLE_REAL_VALUE (x), l); @@ -3139,11 +3137,11 @@ print_operand (FILE *file, rtx x, int letter) /* fall through */ default: - if (GET_CODE (x) == REG || GET_CODE (x) == SUBREG) + if (REG_P (x) || SUBREG_P (x)) fprintf (file, "%s", reg_names[xt_true_regnum (x)]); - else if (GET_CODE (x) == MEM) + else if (MEM_P (x)) output_address (GET_MODE (x), XEXP (x, 0)); - else if (GET_CODE (x) == CONST_INT) + else if (CONST_INT_P (x)) fprintf (file, HOST_WIDE_INT_PRINT_DEC, INTVAL (x)); else output_addr_const (file, x); @@ -3178,12 +3176,12 @@ print_operand_address (FILE *file, rtx addr) rtx arg0 = XEXP (addr, 0); rtx arg1 = XEXP (addr, 1); - if (GET_CODE (arg0) == REG) + if (REG_P (arg0)) { reg = arg0; offset = arg1; } - else if (GET_CODE (arg1) == REG) + else if (REG_P (arg1)) { reg = arg1; offset = arg0; @@ -3274,7 +3272,7 @@ xtensa_output_literal (FILE *file, rtx x, machine_mode mode, int labelno) switch (GET_MODE_CLASS (mode)) { case MODE_FLOAT: - gcc_assert (GET_CODE (x) == CONST_DOUBLE); + gcc_assert (CONST_DOUBLE_P (x)); switch (mode) { diff --git a/gcc/config/xtensa/xtensa.h b/gcc/config/xtensa/xtensa.h index 835cb4bbf3b..c62a872eb60 100644 --- a/gcc/config/xtensa/xtensa.h +++ b/gcc/config/xtensa/xtensa.h @@ -627,17 +627,17 @@ typedef struct xtensa_args valid address. This is defined to be the same as 'CONSTANT_P (X)', but rejecting CONST_DOUBLE. */ #define CONSTANT_ADDRESS_P(X) \ - ((GET_CODE (X) == LABEL_REF || GET_CODE (X) == SYMBOL_REF \ - || GET_CODE (X) == CONST_INT || GET_CODE (X) == HIGH \ + ((LABEL_REF_P (X) || SYMBOL_REF_P (X) || CONST_INT_P (X) \ + || (GET_CODE (X) == HIGH) \ || (GET_CODE (X) == CONST))) /* A C expression that is nonzero if X is a legitimate immediate operand on the target machine when generating position independent code. */ #define LEGITIMATE_PIC_OPERAND_P(X) \ - ((GET_CODE (X) != SYMBOL_REF \ - || (SYMBOL_REF_LOCAL_P (X) && !SYMBOL_REF_EXTERNAL_P (X))) \ - && GET_CODE (X) != LABEL_REF \ + ((! SYMBOL_REF_P (X) \ + || (SYMBOL_REF_LOCAL_P (X) && ! SYMBOL_REF_EXTERNAL_P (X))) \ + && ! LABEL_REF_P (X) \ && GET_CODE (X) != CONST) /* Specify the machine mode that this machine uses diff --git a/gcc/config/xtensa/xtensa.md b/gcc/config/xtensa/xtensa.md index 93c3ee78a01..706e901e723 100644 --- a/gcc/config/xtensa/xtensa.md +++ b/gcc/config/xtensa/xtensa.md @@ -1412,7 +1412,7 @@ } else { - gcc_assert (GET_CODE (operands[1]) == SUBREG); + gcc_assert (SUBREG_P (operands[1])); lit = SUBREG_REG (operands[1]); word_off = SUBREG_BYTE (operands[1]) & ~(UNITS_PER_WORD - 1); byte_off = SUBREG_BYTE (operands[1]) - word_off; @@ -2563,7 +2563,7 @@ "" { rtx dest = operands[0]; - if (GET_CODE (dest) != REG || GET_MODE (dest) != Pmode) + if (! REG_P (dest) || GET_MODE (dest) != Pmode) operands[0] = copy_to_mode_reg (Pmode, dest); emit_jump_insn (gen_indirect_jump_internal (dest)); From patchwork Thu May 30 13:32:24 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Takayuki 'January June' Suwa X-Patchwork-Id: 1941718 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=yahoo.co.jp header.i=@yahoo.co.jp header.a=rsa-sha256 header.s=yj20110701 header.b=TkJKU4uE; 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 4VqnJk1TRcz20Pr for ; Thu, 30 May 2024 23:33:42 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 76114385ED69 for ; Thu, 30 May 2024 13:33:40 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from omggw7006.mail.djm.yahoo.co.jp (omggw7006.mail.djm.yahoo.co.jp [183.79.54.25]) by sourceware.org (Postfix) with ESMTPS id 5B4C1385840F for ; Thu, 30 May 2024 13:33:15 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 5B4C1385840F Authentication-Results: sourceware.org; dmarc=pass (p=quarantine dis=none) header.from=yahoo.co.jp Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=yahoo.co.jp ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 5B4C1385840F Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=183.79.54.25 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1717075998; cv=none; b=MoQfbYBfP3HanvS/Vn3/HTS7AYI4Q84zpCCebT7a1GiMJf+CQ/7kvk71b8Fbx6lpMshAFLlOSf7LNBqCbMwTxHcl3zvmFz1TtNehs1vsVwzKA/OzTT0HTV3+InA5o7o7CVWV4DL+0JR5JMdYtfMQL5IZ6f7uotY5oAthcHYfq1U= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1717075998; c=relaxed/simple; bh=XPP/IQOMxwHK1TCAknQukRzhjJ9faQIAoNplxIKOcGM=; h=DKIM-Signature:Message-ID:Date:MIME-Version:To:From:Subject; b=hTVUBJnfg0ZgemI1U2I0XJymfENQMwAMndGXW/2SoMK7isJSt+DUP32Ce3vdHkB6v/fLannlQNRPmypUqUnCj+JMIAm4dY50oECecHeTOKn+PElmOpYKcClR94I96elHNgu0Nr+KzJGddEovS3ZexSff4Zg4s0bORvTPfurLk08= ARC-Authentication-Results: i=1; server2.sourceware.org X-YMail-OSG: GBZn2p0VM1mGAlFLyIChrP2VggILKyiyGPdIPEkKbFBjjB3jcitEsAHsOYbFkIL VFbdFR93bO2QAmKYkrKF0P8mv_uYnkYfbM1YOCHtDEB5HrqBLgOW9TtUOJcK9ezXcMkFLUPfijcl T1n_5t9I8ben4lLVML9fav8OXkKgluZKnC6IP1TvmxRsiYVT_YTbvK4n6772ZjWp5obXadys9krl p2nAlBHhdZ56QXOV7d61LrM6wXZXFThRwO9fN4Hni4gLP3NCsMjbgJgysDWxv4Ycy.IQAhweLeo5 6SY6vf7WqXTLZSFd4hq2If7Cja_q8wvPDknf9auLMR.TlCRDKQ5LXPryNfMuQcH9l0K3_Ox_At14 DSxoDMiTF8TuF0IYhSD.Dc7pxvr2.DiXBtXLlFtJQ46cjcZODKYL6bgjMq1gu6yyBeE53quvZXon 354EiuaMnM5tIBVocXUW3nLFWjP2PiABnWlEd1yNo9FgNAFF2L9D36oKCgUmklLuuCd4AFEKm8WH 3bcGUvA3bkW5iJAgoMcUhTeqXQCnRjXCBasfVgCqnrchsVjEyyGTYr3wGOlZxkPB0Y85jdMO9TsB jk48UbLzk4X.K7ttIY7PW3V.aV53Zl.AaUpSPcYcVe3C5u7hpD1mCFDxfCUfqZ1JnWL1hdqMBhE3 jfnx3hSOm8rZNXTDiGvIW1FrlFoNniYS4tdqd7reaFLhIy.faBakD1Mv5xjC924aQLYhh4oRhVFw 072PoVNH49mh9Ra0uXJdQDO_14lYsV3ufblyI7IRY6Ir9BONeN4sAxw55R8HqRpetOVxfwN4B.Tg gWeWPYPoIs7JrH7jvjf2F.hWUzSWwUTZy8mtNMjdINhrlk6DdsA0Hx4Xw3t1g3X.azazct53ch0U 0P7ACqwSuuBLRZMOTOjSc3PdGSN0iAuV9uY_z_mNBsTRIMINhokWmAND19qyhEwdcS0qW3.fxq86 A_YkN1y5EvmBSx9izAgqpA4e0Yd7B3KosyJnCdYIcDD3NIRKM..8p9aUdB8RKlkZG__H6mARs4Je tGxD3kNZQFlP1GE75psAuUzxra5fp9yc7VDnq8y4S.Rgsxyf.3ygQtxNWj1pMSuMx.LYyDTrpVWN T8VZGvwhPTJyOpf8hbTfidg-- Received: from sonicgw.mail.yahoo.co.jp by sonicconh5001.mail.kks.yahoo.co.jp with HTTP; Thu, 30 May 2024 13:33:12 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; t=1717075944; s=yj20110701; d=yahoo.co.jp; h=References:Content-Transfer-Encoding:Content-Type:Subject:From:Cc:To:MIME-Version:Date:Message-ID; bh=rdSoGLlKk+TAM8Ue46J218mMPl8q2BwtwsJxIzpK48M=; b=TkJKU4uE+G0GaXmy+h4JSfNLe4I6wLk9/9NWZy04oljspivOERB/hHbN5M91pCOg dcq5/OQZyKnRdzbvOl/TtXvLBXKmNi7NN3iE5siDTzeFGjzD2PyXaS2QtV1M9ebiDu2 a8J29YfWU+J9zB2smEWklV7bKn2NmPiW+jxQk5tg= DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=yj20110701; d=yahoo.co.jp; h=Message-ID:Date:MIME-Version:Cc:From:Content-Type:Content-Transfer-Encoding:References; b=viRZU6rVBfsNCBhMex2Qosm7VLmu7xg3mTtnOi36Nc6cfzi6/NrojO710mRxpC9l VXyHwJGm+X3sqcXu9TjIF27UV3PXvskjpQ7OH5GSFXjq8OeaEXd5X24D1gDuTr3rYcL 3Yx4fz2GyVkSVz1ghkNgszb33eHKAFJyYxat8i60=; Received: by smtphe5003.mail.kks.ynwp.yahoo.co.jp (YJ Hermes SMTP Server) with ESMTPA ID 91485c2307edba4c89b292f68f0ca6ce; Thu, 30 May 2024 22:33:08 +0900 (JST) Message-ID: <800c919d-16ba-4c10-8cf7-742320d67eb2@yahoo.co.jp> Date: Thu, 30 May 2024 22:32:24 +0900 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Content-Language: en-US To: gcc-patches@gcc.gnu.org Cc: Max Filippov From: Takayuki 'January June' Suwa Subject: [PATCH 2/2] xtensa: Use epilogue_completed rather than cfun->machine->epilogue_done References: <800c919d-16ba-4c10-8cf7-742320d67eb2.ref@yahoo.co.jp> X-Spam-Status: No, score=-12.5 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_ENVFROM_END_DIGIT, FREEMAIL_FROM, FROM_FMBLA_NEWDOM28, GIT_PATCH_0, 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 In commit ad89d820bf, an "epilogue_done" member was added to the machine_function structure, but it is sufficient to use the existing "epilogue_completed" global variable. gcc/ChangeLog: * config/xtensa/xtensa-protos.h (xtensa_use_return_instruction_p): Remove. * config/xtensa/xtensa.cc (machine_function): Remove "epilogue_done" field. (xtensa_expand_epilogue): Remove "cfun->machine->epilogue_done" usage. (xtensa_use_return_instruction_p): Remove. * config/xtensa/xtensa.md ("return"): Replace calling "xtensa_use_return_instruction_p()" with inline code. --- gcc/config/xtensa/xtensa-protos.h | 1 - gcc/config/xtensa/xtensa.cc | 14 -------------- gcc/config/xtensa/xtensa.md | 5 ++++- 3 files changed, 4 insertions(+), 16 deletions(-) diff --git a/gcc/config/xtensa/xtensa-protos.h b/gcc/config/xtensa/xtensa-protos.h index 508d5b28aa2..b87b3e8ac48 100644 --- a/gcc/config/xtensa/xtensa-protos.h +++ b/gcc/config/xtensa/xtensa-protos.h @@ -76,7 +76,6 @@ extern rtx xtensa_return_addr (int, rtx); extern void xtensa_setup_frame_addresses (void); extern int xtensa_debugger_regno (int); extern long compute_frame_size (poly_int64); -extern bool xtensa_use_return_instruction_p (void); extern void xtensa_expand_prologue (void); extern void xtensa_expand_epilogue (bool); extern void xtensa_adjust_reg_alloc_order (void); diff --git a/gcc/config/xtensa/xtensa.cc b/gcc/config/xtensa/xtensa.cc index a356c1c22b0..a74da89d505 100644 --- a/gcc/config/xtensa/xtensa.cc +++ b/gcc/config/xtensa/xtensa.cc @@ -104,7 +104,6 @@ struct GTY(()) machine_function compute_frame_size. */ int callee_save_size; bool frame_laid_out; - bool epilogue_done; bool inhibit_logues_a1_adjusts; rtx last_logues_a9_content; HARD_REG_SET eliminated_callee_saved; @@ -3751,25 +3750,12 @@ xtensa_expand_epilogue (bool sibcall_p) stack_pointer_rtx, EH_RETURN_STACKADJ_RTX)); } - cfun->machine->epilogue_done = true; if (sibcall_p) emit_use (gen_rtx_REG (SImode, A0_REG)); else emit_jump_insn (gen_return ()); } -bool -xtensa_use_return_instruction_p (void) -{ - if (!reload_completed) - return false; - if (TARGET_WINDOWED_ABI) - return true; - if (compute_frame_size (get_frame_size ()) == 0) - return true; - return cfun->machine->epilogue_done; -} - void xtensa_set_return_address (rtx address, rtx scratch) { diff --git a/gcc/config/xtensa/xtensa.md b/gcc/config/xtensa/xtensa.md index 706e901e723..b575d7bd215 100644 --- a/gcc/config/xtensa/xtensa.md +++ b/gcc/config/xtensa/xtensa.md @@ -2733,7 +2733,10 @@ (define_insn "return" [(return) (use (reg:SI A0_REG))] - "xtensa_use_return_instruction_p ()" + "reload_completed + && (TARGET_WINDOWED_ABI + || compute_frame_size (get_frame_size ()) == 0 + || epilogue_completed)" { return TARGET_WINDOWED_ABI ? (TARGET_DENSITY ? "retw.n" : "retw") :