From patchwork Tue Dec 27 06:30:12 2022 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: 36778 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4e01:0:0:0:0:0 with SMTP id p1csp1250800wrt; Mon, 26 Dec 2022 22:31:18 -0800 (PST) X-Google-Smtp-Source: AMrXdXteG8RQE4Rat2+DV5xF0ibCJ/2uEMwRLpQbozt7khBq+fL5HLbCHVPzf7c+O9PZeOQwImE0 X-Received: by 2002:a17:907:86a6:b0:7c0:fd1a:79f0 with SMTP id qa38-20020a17090786a600b007c0fd1a79f0mr26474200ejc.21.1672122677978; Mon, 26 Dec 2022 22:31:17 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1672122677; cv=none; d=google.com; s=arc-20160816; b=Pj3qvcC0S/3W6agRz9M7+DfKNheuPJdLDEhn/dqm4L4ZssWr37ITwHe1nCdE3TQFK2 vVVR2oLQG2wEm55pM3kn2DS956Sb1U1U4Bde/pIAqrXeo+T2KC46gEZFrDz/5H6e/YHh ekQWhBI+xz9buBzHHkjeS0JU8dEmskPI7FLvH6m3AUTmSiF80yuUh5KAeA/zBRqTkd76 m8La2bOajed7j1e0lKOnA/2tIbp65xUTJCrgTHDXtdmL8Go9L0cS2l0THby3GMabczS/ N9mLbedJ2x6DyOiDuwRDIIkUzLBNibr6DHT8rsO0S2Y+YIU1O5h9VElSDreETRZsbBxJ PIoQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:reply-to:from:list-subscribe:list-help:list-post :list-archive:list-unsubscribe:list-id:precedence:references :content-transfer-encoding:subject:cc:to:user-agent:mime-version :date:message-id:dmarc-filter:delivered-to:dkim-signature :dkim-filter; bh=J7+2AqVHQE0GcSu31RbCGsLV7HXWQa41dg7fHvQ0vU8=; b=FLaDI20dKoVQTEa0yRZlZPzJdhQ8ZMAI/hGZmJnyRwePshmPFH03njRWpngSxLWGko mZadTL5we+pIyoJeG/P+D3VWfu6DqUP3NTfThb1mra+O0w32Ne2WVK+bjB3Kw14Mn0re FmizNwIDlVt/VRcKK+qhSFDRYQJMSoxTbxxii+V59DN32GM1pDKsS+mLK60vKAlbC3r3 LTO2OrI7ocZrJrwHAGLeTIeLIIh6rWowBAjd3HB/ZhMGELB40LkKZhhY8TRkIjHch56o OdkFQO6STbFLYVlPX/gjDQYcpG61Oc4gJzSWIbdiDwaSOZJ3fyNGtHun33Yw4hwMK3am ikkg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=YgUicyPw; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gnu.org Received: from sourceware.org (ip-8-43-85-97.sourceware.org. [8.43.85.97]) by mx.google.com with ESMTPS id t13-20020a170906178d00b007c00323cc16si8892652eje.973.2022.12.26.22.31.17 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 26 Dec 2022 22:31:17 -0800 (PST) Received-SPF: pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) client-ip=8.43.85.97; Authentication-Results: mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=YgUicyPw; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gnu.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id B49C03858413 for ; Tue, 27 Dec 2022 06:31:16 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org B49C03858413 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1672122676; bh=J7+2AqVHQE0GcSu31RbCGsLV7HXWQa41dg7fHvQ0vU8=; h=Date:To:Cc:Subject:References:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=YgUicyPwUNyIqYJ1mYitmkaddbmkJL/zypRCJWI/Ag376zP/EzgHwlDtBbZbjKvx0 kQC3zimONAVHvsSKG1RDLJjyqFegqF3r4fWcHyl1XQNQm9++ihM3laYSYyItJT4lgg nEg5hbnifQy7nzihlRLa1IcsiMB0gDBzwZcLsmo0= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from sonicconh5003-vm0.mail.kks.yahoo.co.jp (sonicconh5003-vm0.mail.kks.yahoo.co.jp [114.110.61.43]) by sourceware.org (Postfix) with ESMTPS id 81BB83858D32 for ; Tue, 27 Dec 2022 06:30:28 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 81BB83858D32 X-YMail-OSG: R0vCdUEVM1k4FYiyEHfmrcMiYr2Hj3Eb64_gkkWnm5ow7Bam1a2rGQz3R3N5hWw Y1dvQKYGhDEB35OVrUw3cg9yJLcHaZXYQNurzTbKAbAWOviQQaqEHXUSRapH1N9k3IRWMSOP3ZVw bi23UabtMoMYwvmxrJmc1sEXgN14CCeTo.67ZPW_QgrAp_Ks9vYFMoOV9q2mkos5UJi6td3FFMAw XRqs9eZXof6sfp_D0FO46XEq_E2LWivEJuPAVRsmIY8h0JY9ofKnEQmOOXboH4iys5ANyWPfsMw7 z7C3D1WGjmiRUvoVv2xgPPmzYtqnRMLvQX0QpqxN8E.2Y7vMmiwt4_k8GOoSWJ_SZKEbGHR7A5Lj 9G6_ZLA2gU7W9Vvvr5P3DnJDimHbE8Upm3AYXPAn1cIjFQqcYJBs5v4LB0ErYlIBH1I2dl8RbI4u R4ZHb3.dTZYzbc9CSGEOh2QTY0dDNx6NP_9V24gLvtjSfFqsnLyfM2_QltRtKzQHHjCiC.mZ.tHy GNdCSaSduCJfFolxAbyJ00YO1NMf0UCr_r_a5DFetfQ5iJqUKKpFZ79OoV9yMxw4RrAuHMYE.mV9 soLgA7Bmnv5.lk1KP8li9xh0qKGGJbxR1V.d6ENzn6bBytvsd1qRoHq3JvoA3uzWp4QUDZ9iyqFn lnvga3FNySZp3LRJTw1X3aQU9ZHhhsh5yZ0OwRoYurQD4FNUqv_LvTfrEL9OwmEz2eJHHdQxB_qx hyhhCdGe3rQuNechpmzGiiVPRIx.hYL8GOd051GvAcp2bWCvyfzoX3xcJ4Lvph9XRomvxCFlN5Py dw5lfgcowHovy9vGf9bq8N3eiwibfdKEXXWENxdlgk.EZrnB4y_Ddtvx3i3MhXuWdgpQusWOjCIj e9cGssXZIlSrVsAghFbO4OOANKCmREA3pMmcJuOt4DMWXBiq9m9OgLKMPDOS4ZvWoeAh1T3ubb1f 8ycAshlWhng-- Received: from sonicgw.mail.yahoo.co.jp by sonicconh5003.mail.kks.yahoo.co.jp with HTTP; Tue, 27 Dec 2022 06:30:24 +0000 Received: by smtphe5009.mail.kks.ynwp.yahoo.co.jp (YJ Hermes SMTP Server) with ESMTPA ID 2381f578ced87c1f5e9420e9fdddb411; Tue, 27 Dec 2022 15:30:21 +0900 (JST) Message-ID: Date: Tue, 27 Dec 2022 15:30:12 +0900 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:102.0) Gecko/20100101 Thunderbird/102.6.1 To: GCC Patches Cc: Max Filippov Subject: [PATCH] xtensa: Apply a few minor fixes References: X-Spam-Status: No, score=-11.8 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_ENVFROM_END_DIGIT, FREEMAIL_FROM, GIT_PATCH_0, KAM_STOCKGEN, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, 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 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: , X-Patchwork-Original-From: Takayuki 'January June' Suwa via Gcc-patches From: Takayuki 'January June' Suwa Reply-To: Takayuki 'January June' Suwa Errors-To: gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org Sender: "Gcc-patches" X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1753347709141906847?= X-GMAIL-MSGID: =?utf-8?q?1753347709141906847?= Almost cosmetic and no functional changes. gcc/ChangeLog: * config/xtensa/*: Tabify, and trim trailing spaces. * config/xtensa/xtensa.h (GP_RETURN, GP_RETURN_REG_COUNT): Change to GP_RETURN_FIRST and GP_RETURN_LAST, respectively. * config/xtensa/xtensa.cc (xtensa_function_value, xtensa_libcall_value, xtensa_function_value_regno_p): Ditto. (xtensa_expand_prologue): Modify to exit the inspection loops as soon as the necessity of stack pointer is found. (xtensa_set_return_address): Change the style of brackets. * config/xtensa/xtensa.md (set_frame_ptr): Fix to reflect TARGET_DENSITY. --- gcc/config/xtensa/elf.h | 32 ++++---- gcc/config/xtensa/linux.h | 1 - gcc/config/xtensa/uclinux.h | 1 - gcc/config/xtensa/xtensa-dynconfig.c | 6 +- gcc/config/xtensa/xtensa.cc | 105 ++++++++++++++------------- gcc/config/xtensa/xtensa.h | 10 +-- gcc/config/xtensa/xtensa.md | 105 ++++++++++++++------------- 7 files changed, 133 insertions(+), 127 deletions(-) diff --git a/gcc/config/xtensa/elf.h b/gcc/config/xtensa/elf.h index fbdccc49c9b..1edc1761d74 100644 --- a/gcc/config/xtensa/elf.h +++ b/gcc/config/xtensa/elf.h @@ -59,7 +59,7 @@ along with GCC; see the file COPYING3. If not see "crt1-sim%O%s crt0%O%s crti%O%s crtbegin%O%s _vectors%O%s" #undef ENDFILE_SPEC -#define ENDFILE_SPEC "crtend%O%s crtn%O%s" +#define ENDFILE_SPEC "crtend%O%s crtn%O%s" #undef LINK_SPEC #define LINK_SPEC \ @@ -86,19 +86,17 @@ along with GCC; see the file COPYING3. If not see /* Search for headers in $tooldir/arch/include and for libraries and startfiles in $tooldir/arch/lib. */ #define GCC_DRIVER_HOST_INITIALIZATION \ -do \ -{ \ - char *tooldir, *archdir; \ - tooldir = concat (tooldir_base_prefix, spec_machine, \ - dir_separator_str, NULL); \ - if (!IS_ABSOLUTE_PATH (tooldir)) \ - tooldir = concat (standard_exec_prefix, spec_machine, dir_separator_str, \ - spec_version, dir_separator_str, tooldir, NULL); \ - archdir = concat (tooldir, "arch", dir_separator_str, NULL); \ - add_prefix (&startfile_prefixes, \ - concat (archdir, "lib", dir_separator_str, NULL), \ - "GCC", PREFIX_PRIORITY_LAST, 0, 1); \ - add_prefix (&include_prefixes, archdir, \ - "GCC", PREFIX_PRIORITY_LAST, 0, 0); \ - } \ -while (0) + do { \ + char *tooldir, *archdir; \ + tooldir = concat (tooldir_base_prefix, spec_machine, \ + dir_separator_str, NULL); \ + if (!IS_ABSOLUTE_PATH (tooldir)) \ + tooldir = concat (standard_exec_prefix, spec_machine, dir_separator_str, \ + spec_version, dir_separator_str, tooldir, NULL); \ + archdir = concat (tooldir, "arch", dir_separator_str, NULL); \ + add_prefix (&startfile_prefixes, \ + concat (archdir, "lib", dir_separator_str, NULL), \ + "GCC", PREFIX_PRIORITY_LAST, 0, 1); \ + add_prefix (&include_prefixes, archdir, \ + "GCC", PREFIX_PRIORITY_LAST, 0, 0); \ + } while (0) diff --git a/gcc/config/xtensa/linux.h b/gcc/config/xtensa/linux.h index bc7bee71517..198edfe0553 100644 --- a/gcc/config/xtensa/linux.h +++ b/gcc/config/xtensa/linux.h @@ -69,4 +69,3 @@ along with GCC; see the file COPYING3. If not see #define XTENSA_ALWAYS_PIC 1 #undef DEBUGGER_REGNO - diff --git a/gcc/config/xtensa/uclinux.h b/gcc/config/xtensa/uclinux.h index 5fcf639ccff..5787b2f1ab9 100644 --- a/gcc/config/xtensa/uclinux.h +++ b/gcc/config/xtensa/uclinux.h @@ -71,4 +71,3 @@ along with GCC; see the file COPYING3. If not see #define TARGET_LIBC_HAS_FUNCTION no_c99_libc_has_function #undef DEBUGGER_REGNO - diff --git a/gcc/config/xtensa/xtensa-dynconfig.c b/gcc/config/xtensa/xtensa-dynconfig.c index 056204ae946..0a611fd14b0 100644 --- a/gcc/config/xtensa/xtensa-dynconfig.c +++ b/gcc/config/xtensa/xtensa-dynconfig.c @@ -35,7 +35,7 @@ #if !defined (HAVE_DLFCN_H) && defined (_WIN32) -#define RTLD_LAZY 0 /* Dummy value. */ +#define RTLD_LAZY 0 /* Dummy value. */ static void * dlopen (const char *file, int mode ATTRIBUTE_UNUSED) @@ -142,8 +142,8 @@ XTENSA_CONFIG_INSTANCE_LIST; #define XTENSA_CONFIG_ENTRY(a) "__" #a "=" STRINGIFY(a) static const char * const xtensa_config_strings[] = { - XTENSA_CONFIG_ENTRY_LIST, - NULL, + XTENSA_CONFIG_ENTRY_LIST, + NULL, }; const struct xtensa_config_v1 *xtensa_get_config_v1 (void) diff --git a/gcc/config/xtensa/xtensa.cc b/gcc/config/xtensa/xtensa.cc index 94a98c25f8c..66e25349521 100644 --- a/gcc/config/xtensa/xtensa.cc +++ b/gcc/config/xtensa/xtensa.cc @@ -176,7 +176,7 @@ static bool constantpool_address_p (const_rtx addr); static bool xtensa_legitimate_constant_p (machine_mode, rtx); static void xtensa_reorg (void); static bool xtensa_can_use_doloop_p (const widest_int &, const widest_int &, - unsigned int, bool); + unsigned int, bool); static const char *xtensa_invalid_within_doloop (const rtx_insn *); static bool xtensa_member_type_forces_blk (const_tree, @@ -2115,7 +2115,7 @@ xtensa_emit_loop_end (rtx_insn *insn, rtx *operands) done = 1; } break; - } + } } output_asm_insn ("%1_LEND:", operands); @@ -2314,7 +2314,7 @@ xtensa_tls_module_base (void) xtensa_tls_module_base_symbol = gen_rtx_SYMBOL_REF (Pmode, "_TLS_MODULE_BASE_"); SYMBOL_REF_FLAGS (xtensa_tls_module_base_symbol) - |= TLS_MODEL_GLOBAL_DYNAMIC << SYMBOL_FLAG_TLS_SHIFT; + |= TLS_MODEL_GLOBAL_DYNAMIC << SYMBOL_FLAG_TLS_SHIFT; } return xtensa_tls_module_base_symbol; @@ -3327,12 +3327,18 @@ xtensa_expand_prologue (void) ref; ref = DF_REF_NEXT_REG (ref)) if (DF_REF_CLASS (ref) == DF_REF_REGULAR && NONJUMP_INSN_P (DF_REF_INSN (ref))) - stack_pointer_needed = true; + { + stack_pointer_needed = true; + break; + } /* Check if callee-saved registers really need saving to the stack. */ if (!stack_pointer_needed) for (regno = 0; regno < FIRST_PSEUDO_REGISTER; ++regno) if (xtensa_call_save_reg (regno)) - stack_pointer_needed = true; + { + stack_pointer_needed = true; + break; + } cfun->machine->inhibit_logues_a1_adjusts = !stack_pointer_needed; @@ -3409,7 +3415,7 @@ xtensa_expand_prologue (void) } } else - { + { insn = emit_insn (gen_movsi (hard_frame_pointer_rtx, stack_pointer_rtx)); if (!TARGET_WINDOWED_ABI) @@ -3532,11 +3538,12 @@ xtensa_set_return_address (rtx address, rtx scratch) gen_rtx_REG (SImode, A0_REG)); rtx insn; - if (total_size > 1024) { - emit_move_insn (scratch, GEN_INT (total_size - UNITS_PER_WORD)); - emit_insn (gen_addsi3 (scratch, frame, scratch)); - a0_addr = scratch; - } + if (total_size > 1024) + { + emit_move_insn (scratch, GEN_INT (total_size - UNITS_PER_WORD)); + emit_insn (gen_addsi3 (scratch, frame, scratch)); + a0_addr = scratch; + } insn = emit_move_insn (gen_frame_mem (SImode, a0_addr), address); RTX_FRAME_RELATED_P (insn) = 1; @@ -3818,8 +3825,8 @@ xtensa_gimplify_va_arg_expr (tree valist, tree type, gimple_seq *pre_p, /* Check if the argument is in registers: if ((AP).__va_ndx <= __MAX_ARGS_IN_REGISTERS * 4 - && !must_pass_in_stack (type)) - __array = (AP).__va_reg; */ + && !must_pass_in_stack (type)) + __array = (AP).__va_reg; */ array = create_tmp_var (ptr_type_node); @@ -4515,13 +4522,13 @@ xtensa_return_in_memory (const_tree type, const_tree fntype ATTRIBUTE_UNUSED) /* Worker function for TARGET_FUNCTION_VALUE. */ rtx -xtensa_function_value (const_tree valtype, const_tree func ATTRIBUTE_UNUSED, - bool outgoing) +xtensa_function_value (const_tree valtype, const_tree func ATTRIBUTE_UNUSED, + bool outgoing) { return gen_rtx_REG ((INTEGRAL_TYPE_P (valtype) - && TYPE_PRECISION (valtype) < BITS_PER_WORD) - ? SImode : TYPE_MODE (valtype), - outgoing ? GP_OUTGOING_RETURN : GP_RETURN); + && TYPE_PRECISION (valtype) < BITS_PER_WORD) + ? SImode : TYPE_MODE (valtype), + outgoing ? GP_OUTGOING_RETURN : GP_RETURN_FIRST); } /* Worker function for TARGET_LIBCALL_VALUE. */ @@ -4531,7 +4538,7 @@ xtensa_libcall_value (machine_mode mode, const_rtx fun ATTRIBUTE_UNUSED) { return gen_rtx_REG ((GET_MODE_CLASS (mode) == MODE_INT && GET_MODE_SIZE (mode) < UNITS_PER_WORD) - ? SImode : mode, GP_RETURN); + ? SImode : mode, GP_RETURN_FIRST); } /* Worker function TARGET_FUNCTION_VALUE_REGNO_P. */ @@ -4539,7 +4546,7 @@ xtensa_libcall_value (machine_mode mode, const_rtx fun ATTRIBUTE_UNUSED) static bool xtensa_function_value_regno_p (const unsigned int regno) { - return (regno >= GP_RETURN && regno < GP_RETURN + GP_RETURN_REG_COUNT); + return IN_RANGE (regno, GP_RETURN_FIRST, GP_RETURN_LAST); } /* The static chain is passed in memory. Provide rtx giving 'mem' @@ -4719,7 +4726,7 @@ xtensa_legitimate_constant_p (machine_mode mode ATTRIBUTE_UNUSED, rtx x) static bool xtensa_can_use_doloop_p (const widest_int &, const widest_int &, - unsigned int loop_depth, bool entered_at_top) + unsigned int loop_depth, bool entered_at_top) { /* Considering limitations in the hardware, only use doloop for innermost loops which must be entered from the top. */ @@ -4758,32 +4765,32 @@ hwloop_optimize (hwloop_info loop) if (loop->depth > 1) { if (dump_file) - fprintf (dump_file, ";; loop %d is not innermost\n", - loop->loop_no); + fprintf (dump_file, ";; loop %d is not innermost\n", + loop->loop_no); return false; } if (!loop->incoming_dest) { if (dump_file) - fprintf (dump_file, ";; loop %d has more than one entry\n", - loop->loop_no); + fprintf (dump_file, ";; loop %d has more than one entry\n", + loop->loop_no); return false; } if (loop->incoming_dest != loop->head) { if (dump_file) - fprintf (dump_file, ";; loop %d is not entered from head\n", - loop->loop_no); + fprintf (dump_file, ";; loop %d is not entered from head\n", + loop->loop_no); return false; } if (loop->has_call || loop->has_asm) { if (dump_file) - fprintf (dump_file, ";; loop %d has invalid insn\n", - loop->loop_no); + fprintf (dump_file, ";; loop %d has invalid insn\n", + loop->loop_no); return false; } @@ -4791,8 +4798,8 @@ hwloop_optimize (hwloop_info loop) if (loop->iter_reg_used || loop->iter_reg_used_outside) { if (dump_file) - fprintf (dump_file, ";; loop %d uses iterator\n", - loop->loop_no); + fprintf (dump_file, ";; loop %d uses iterator\n", + loop->loop_no); return false; } @@ -4804,8 +4811,8 @@ hwloop_optimize (hwloop_info loop) if (!insn) { if (dump_file) - fprintf (dump_file, ";; loop %d start_label not before loop_end\n", - loop->loop_no); + fprintf (dump_file, ";; loop %d start_label not before loop_end\n", + loop->loop_no); return false; } @@ -4829,8 +4836,8 @@ hwloop_optimize (hwloop_info loop) start_sequence (); insn = emit_insn (gen_zero_cost_loop_start (loop->iter_reg, - loop->start_label, - loop->iter_reg)); + loop->start_label, + loop->iter_reg)); seq = get_insns (); @@ -4846,21 +4853,21 @@ hwloop_optimize (hwloop_info loop) seq = emit_label_before (gen_label_rtx (), seq); new_bb = create_basic_block (seq, insn, entry_bb); FOR_EACH_EDGE (e, ei, loop->incoming) - { - if (!(e->flags & EDGE_FALLTHRU)) - redirect_edge_and_branch_force (e, new_bb); - else - redirect_edge_succ (e, new_bb); - } + { + if (!(e->flags & EDGE_FALLTHRU)) + redirect_edge_and_branch_force (e, new_bb); + else + redirect_edge_succ (e, new_bb); + } make_edge (new_bb, loop->head, 0); } else { while (DEBUG_INSN_P (entry_after) - || (NOTE_P (entry_after) + || (NOTE_P (entry_after) && NOTE_KIND (entry_after) != NOTE_INSN_BASIC_BLOCK)) - entry_after = PREV_INSN (entry_after); + entry_after = PREV_INSN (entry_after); emit_insn_after (seq, entry_after); } @@ -4881,15 +4888,15 @@ hwloop_fail (hwloop_info loop) rtx_insn *insn = loop->loop_end; emit_insn_before (gen_addsi3 (loop->iter_reg, - loop->iter_reg, - constm1_rtx), - loop->loop_end); + loop->iter_reg, + constm1_rtx), + loop->loop_end); test = gen_rtx_NE (VOIDmode, loop->iter_reg, const0_rtx); insn = emit_jump_insn_before (gen_cbranchsi4 (test, - loop->iter_reg, const0_rtx, - loop->start_label), - loop->loop_end); + loop->iter_reg, const0_rtx, + loop->start_label), + loop->loop_end); JUMP_LABEL (insn) = loop->start_label; LABEL_NUSES (loop->start_label)++; diff --git a/gcc/config/xtensa/xtensa.h b/gcc/config/xtensa/xtensa.h index 7e193068431..a7c112b8753 100644 --- a/gcc/config/xtensa/xtensa.h +++ b/gcc/config/xtensa/xtensa.h @@ -48,7 +48,7 @@ along with GCC; see the file COPYING3. If not see #define TARGET_S32C1I XCHAL_HAVE_S32C1I #define TARGET_ABSOLUTE_LITERALS XSHAL_USE_ABSOLUTE_LITERALS #define TARGET_THREADPTR XCHAL_HAVE_THREADPTR -#define TARGET_LOOPS XCHAL_HAVE_LOOPS +#define TARGET_LOOPS XCHAL_HAVE_LOOPS #define TARGET_WINDOWED_ABI_DEFAULT (XSHAL_ABI == XTHAL_ABI_WINDOWED) #define TARGET_WINDOWED_ABI xtensa_windowed_abi #define TARGET_DEBUG XCHAL_HAVE_DEBUG @@ -286,7 +286,7 @@ extern int leaf_function; /* Coprocessor registers */ #define BR_REG_FIRST 18 -#define BR_REG_LAST 18 +#define BR_REG_LAST 18 #define BR_REG_NUM (BR_REG_LAST - BR_REG_FIRST + 1) /* 16 floating-point registers */ @@ -474,9 +474,9 @@ enum reg_class /* Symbolic macros for the registers used to return integer, floating point, and values of coprocessor and user-defined modes. */ -#define GP_RETURN (GP_REG_FIRST + 2 + WINDOW_SIZE) +#define GP_RETURN_FIRST (GP_REG_FIRST + 2 + WINDOW_SIZE) +#define GP_RETURN_LAST (GP_RETURN_FIRST + 3) #define GP_OUTGOING_RETURN (GP_REG_FIRST + 2) -#define GP_RETURN_REG_COUNT 4 /* Symbolic macros for the first/last argument registers. */ #define GP_ARG_FIRST (GP_REG_FIRST + 2) @@ -742,7 +742,7 @@ typedef struct xtensa_args /* Define output to appear before the constant pool. */ -#define ASM_OUTPUT_POOL_PROLOGUE(FILE, FUNNAME, FUNDECL, SIZE) \ +#define ASM_OUTPUT_POOL_PROLOGUE(FILE, FUNNAME, FUNDECL, SIZE) \ do { \ if ((SIZE) > 0 || !TARGET_WINDOWED_ABI) \ { \ diff --git a/gcc/config/xtensa/xtensa.md b/gcc/config/xtensa/xtensa.md index de9bcbf24f7..e72fd9ac3f6 100644 --- a/gcc/config/xtensa/xtensa.md +++ b/gcc/config/xtensa/xtensa.md @@ -70,13 +70,13 @@ ;; This code iterator is for floating-point comparisons. (define_code_iterator any_scc_sf [eq lt le uneq unlt unle unordered]) -(define_code_attr scc_sf [(eq "oeq") (lt "olt") (le "ole") +(define_code_attr scc_sf [(eq "oeq") (lt "olt") (le "ole") (uneq "ueq") (unlt "ult") (unle "ule") (unordered "un")]) ;; This iterator and attribute allow to combine most atomic operations. (define_code_iterator ATOMIC [and ior xor plus minus mult]) -(define_code_attr atomic [(and "and") (ior "ior") (xor "xor") +(define_code_attr atomic [(and "and") (ior "ior") (xor "xor") (plus "add") (minus "sub") (mult "nand")]) ;; This mode iterator allows the HI and QI patterns to be defined from @@ -195,7 +195,7 @@ (define_insn "subsi3" [(set (match_operand:SI 0 "register_operand" "=a") - (minus:SI (match_operand:SI 1 "register_operand" "r") + (minus:SI (match_operand:SI 1 "register_operand" "r") (match_operand:SI 2 "register_operand" "r")))] "" "sub\t%0, %1, %2" @@ -434,7 +434,7 @@ (define_insn "si3" [(set (match_operand:SI 0 "register_operand" "=a") - (any_minmax:SI (match_operand:SI 1 "register_operand" "%r") + (any_minmax:SI (match_operand:SI 1 "register_operand" "%r") (match_operand:SI 2 "register_operand" "r")))] "TARGET_MINMAX" "\t%0, %1, %2" @@ -507,7 +507,7 @@ (define_expand "bswapsi2" [(set (match_operand:SI 0 "register_operand" "") - (bswap:SI (match_operand:SI 1 "register_operand" "")))] + (bswap:SI (match_operand:SI 1 "register_operand" "")))] "!optimize_debug && optimize > 1" { /* GIMPLE manual byte-swapping recognition is now activated. @@ -1022,7 +1022,7 @@ %v0s32i\t%1, %0 rsr\t%0, ACCLO wsr\t%1, ACCLO" - [(set_attr "type" "move,move,move,load,store,store,move,move,move,move,move,load,load,store,rsr,wsr") + [(set_attr "type" "move,move,move,load,store,store,move,move,move,move,move,load,load,store,rsr,wsr") (set_attr "mode" "SI") (set_attr "length" "2,2,2,2,2,2,3,3,3,3,6,3,3,3,3,3")]) @@ -1170,7 +1170,7 @@ "((register_operand (operands[0], SFmode) || register_operand (operands[1], SFmode)) && !(FP_REG_P (xt_true_regnum (operands[0])) - && (constantpool_mem_p (operands[1]) || CONSTANT_P (operands[1]))))" + && (constantpool_mem_p (operands[1]) || CONSTANT_P (operands[1]))))" "@ mov.s\t%0, %1 %v1lsi\t%0, %1 @@ -1355,7 +1355,7 @@ [(set (match_operand:SI 0 "register_operand" "=a,a") (ashift:SI (match_operand:SI 1 "register_operand" "r,r") (match_operand:SI 2 "arith_operand" "J,r")))] - "" + "" "@ slli\t%0, %1, %R2 ssl\t%2\;sll\t%0, %1" @@ -1941,13 +1941,13 @@ (define_insn "zero_cost_loop_start" [(set (pc) - (if_then_else (ne (match_operand:SI 2 "register_operand" "0") - (const_int 1)) - (label_ref (match_operand 1 "" "")) - (pc))) + (if_then_else (ne (match_operand:SI 2 "register_operand" "0") + (const_int 1)) + (label_ref (match_operand 1 "" "")) + (pc))) (set (match_operand:SI 0 "register_operand" "=a") - (plus (match_dup 0) - (const_int -1))) + (plus (match_dup 0) + (const_int -1))) (unspec [(const_int 0)] UNSPEC_LSETUP_START)] "TARGET_LOOPS && optimize" "loop\t%0, %l1_LEND" @@ -1957,13 +1957,13 @@ (define_insn "zero_cost_loop_end" [(set (pc) - (if_then_else (ne (match_operand:SI 2 "nonimmediate_operand" "0,0") - (const_int 1)) - (label_ref (match_operand 1 "" "")) - (pc))) + (if_then_else (ne (match_operand:SI 2 "nonimmediate_operand" "0,0") + (const_int 1)) + (label_ref (match_operand 1 "" "")) + (pc))) (set (match_operand:SI 0 "nonimmediate_operand" "=a,m") - (plus (match_dup 0) - (const_int -1))) + (plus (match_dup 0) + (const_int -1))) (unspec [(const_int 0)] UNSPEC_LSETUP_END) (clobber (match_scratch:SI 3 "=X,&r"))] "TARGET_LOOPS && optimize" @@ -1974,13 +1974,13 @@ (define_insn "loop_end" [(set (pc) - (if_then_else (ne (match_operand:SI 2 "register_operand" "0") - (const_int 1)) - (label_ref (match_operand 1 "" "")) - (pc))) + (if_then_else (ne (match_operand:SI 2 "register_operand" "0") + (const_int 1)) + (label_ref (match_operand 1 "" "")) + (pc))) (set (match_operand:SI 0 "register_operand" "=a") - (plus (match_dup 0) - (const_int -1))) + (plus (match_dup 0) + (const_int -1))) (unspec [(const_int 0)] UNSPEC_LSETUP_END)] "TARGET_LOOPS && optimize" { @@ -1993,13 +1993,13 @@ (define_split [(set (pc) - (if_then_else (ne (match_operand:SI 0 "nonimmediate_operand" "") - (const_int 1)) - (label_ref (match_operand 1 "" "")) - (pc))) + (if_then_else (ne (match_operand:SI 0 "nonimmediate_operand" "") + (const_int 1)) + (label_ref (match_operand 1 "" "")) + (pc))) (set (match_operand:SI 2 "nonimmediate_operand" "") - (plus:SI (match_dup 0) - (const_int -1))) + (plus:SI (match_dup 0) + (const_int -1))) (unspec [(const_int 0)] UNSPEC_LSETUP_END) (clobber (match_scratch 3))] "TARGET_LOOPS && optimize && reload_completed" @@ -2015,7 +2015,7 @@ emit_move_insn (operands[0], operands[3]); test = gen_rtx_NE (VOIDmode, operands[3], const0_rtx); emit_jump_insn (gen_cbranchsi4 (test, operands[3], - const0_rtx, operands[1])); + const0_rtx, operands[1])); } else { @@ -2029,15 +2029,15 @@ ; operand 1 is the label to jump to at the top of the loop (define_expand "doloop_end" [(parallel [(set (pc) (if_then_else - (ne (match_operand:SI 0 "" "") - (const_int 1)) - (label_ref (match_operand 1 "" "")) - (pc))) - (set (match_dup 0) - (plus:SI (match_dup 0) - (const_int -1))) - (unspec [(const_int 0)] UNSPEC_LSETUP_END) - (clobber (match_dup 2))])] ; match_scratch + (ne (match_operand:SI 0 "" "") + (const_int 1)) + (label_ref (match_operand 1 "" "")) + (pc))) + (set (match_dup 0) + (plus:SI (match_dup 0) + (const_int -1))) + (unspec [(const_int 0)] UNSPEC_LSETUP_END) + (clobber (match_dup 2))])] ; match_scratch "TARGET_LOOPS && optimize" { /* The loop optimizer doesn't check the predicates... */ @@ -2276,8 +2276,8 @@ (define_insn "call_value_internal" [(set (match_operand 0 "register_operand" "=a") - (call (mem (match_operand:SI 1 "call_insn_operand" "nir")) - (match_operand 2 "" "i")))] + (call (mem (match_operand:SI 1 "call_insn_operand" "nir")) + (match_operand 2 "" "i")))] "!SIBLING_CALL_P (insn)" { return xtensa_emit_call (1, operands); @@ -2382,9 +2382,9 @@ (define_expand "allocate_stack" [(set (match_operand 0 "nonimmed_operand") - (minus (reg A1_REG) (match_operand 1 "add_operand"))) + (minus (reg A1_REG) (match_operand 1 "add_operand"))) (set (reg A1_REG) - (minus (reg A1_REG) (match_dup 1)))] + (minus (reg A1_REG) (match_dup 1)))] "TARGET_WINDOWED_ABI" { if (CONST_INT_P (operands[1])) @@ -2509,7 +2509,7 @@ (define_expand "frame_blockage" [(set (match_dup 0) - (unspec:BLK [(match_dup 1)] UNSPEC_FRAME_BLOCKAGE))] + (unspec:BLK [(match_dup 1)] UNSPEC_FRAME_BLOCKAGE))] "" { operands[0] = gen_rtx_MEM (BLKmode, gen_rtx_SCRATCH (Pmode)); @@ -2519,7 +2519,7 @@ (define_insn "*frame_blockage" [(set (match_operand:BLK 0 "" "") - (unspec:BLK [(match_operand:SI 1 "" "")] UNSPEC_FRAME_BLOCKAGE))] + (unspec:BLK [(match_operand:SI 1 "" "")] UNSPEC_FRAME_BLOCKAGE))] "" "" [(set_attr "type" "nop") @@ -2562,12 +2562,15 @@ "" { if (frame_pointer_needed) - return "mov\ta7, sp"; + return (TARGET_DENSITY ? "mov.n\ta7, sp" : "mov\ta7, sp"); return ""; } [(set_attr "type" "move") (set_attr "mode" "SI") - (set_attr "length" "3")]) + (set (attr "length") + (if_then_else (match_test "TARGET_DENSITY") + (const_int 2) + (const_int 3)))]) ;; Post-reload splitter to remove fp assignment when it's not needed. (define_split @@ -2796,7 +2799,7 @@ (define_expand "sync_new_" [(set (match_operand:HQI 0 "register_operand") (ATOMIC:HQI (match_operand:HQI 1 "memory_operand") - (match_operand:HQI 2 "register_operand"))) + (match_operand:HQI 2 "register_operand"))) (set (match_dup 1) (ATOMIC:HQI (match_dup 1) (match_dup 2)))] "TARGET_S32C1I" {