From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 35816 invoked by alias); 12 Nov 2015 21:52:24 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Received: (qmail 35763 invoked by uid 89); 12 Nov 2015 21:52:23 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-0.8 required=5.0 tests=AWL,BAYES_40,KAM_LAZY_DOMAIN_SECURITY,RCVD_IN_DNSWL_LOW autolearn=no version=3.3.2 X-HELO: smtp.eu.adacore.com Received: from mel.act-europe.fr (HELO smtp.eu.adacore.com) (194.98.77.210) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-GCM-SHA384 encrypted) ESMTPS; Thu, 12 Nov 2015 21:52:22 +0000 Received: from localhost (localhost [127.0.0.1]) by filtered-smtp.eu.adacore.com (Postfix) with ESMTP id 9396B330DB98 for ; Thu, 12 Nov 2015 22:52:19 +0100 (CET) Received: from smtp.eu.adacore.com ([127.0.0.1]) by localhost (smtp.eu.adacore.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 2n9nmIsCeKHf for ; Thu, 12 Nov 2015 22:52:19 +0100 (CET) Received: from polaris.localnet (bon31-6-88-161-99-133.fbx.proxad.net [88.161.99.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.eu.adacore.com (Postfix) with ESMTPSA id 6FD25330DB94 for ; Thu, 12 Nov 2015 22:52:19 +0100 (CET) From: Eric Botcazou To: gcc-patches@gcc.gnu.org Subject: [mips] Rotate stack checking loop Date: Thu, 12 Nov 2015 21:52:00 -0000 Message-ID: <1772089.OR2LVoZBqb@polaris> User-Agent: KMail/4.14.9 (Linux/3.16.7-29-desktop; KDE/4.14.9; x86_64; ; ) MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="nextPart6927886.Nmy3F6D6Sm" Content-Transfer-Encoding: 7Bit X-SW-Source: 2015-11/txt/msg01602.txt.bz2 This is a multi-part message in MIME format. --nextPart6927886.Nmy3F6D6Sm Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" Content-length: 744 Hi, this patch rotates the loop generated in the prologue to do stack checking when -fstack-check is specified, thereby saving one branch instruction. It was initially implemented as a WHILE loop to match the generic implementation but can be turned into a DO-WHILE loop because the amount of stack to be checked is known at compile time (since it's the static part of the frame). Unfortunately I don't have access to MIPS hardware any more so I only verified that the assembly code is as expected and can be assembled. OK for mainline? 2015-11-12 Eric Botcazou * config/mips/mips.c (mips_emit_probe_stack_range): Adjust. (mips_output_probe_stack_range): Rotate the loop and simplify. -- Eric Botcazou --nextPart6927886.Nmy3F6D6Sm Content-Disposition: attachment; filename="rotate_mips.diff" Content-Transfer-Encoding: 7Bit Content-Type: text/x-patch; charset="utf-8"; name="rotate_mips.diff" Content-length: 1981 Index: config/mips/mips.c =================================================================== --- config/mips/mips.c (revision 230204) +++ config/mips/mips.c (working copy) @@ -11335,11 +11335,12 @@ mips_emit_probe_stack_range (HOST_WIDE_I /* Step 3: the loop - while (TEST_ADDR != LAST_ADDR) + do { TEST_ADDR = TEST_ADDR + PROBE_INTERVAL probe at TEST_ADDR } + while (TEST_ADDR != LAST_ADDR) probes at FIRST + N * PROBE_INTERVAL for values of N from 1 until it is equal to ROUNDED_SIZE. */ @@ -11365,38 +11366,31 @@ const char * mips_output_probe_stack_range (rtx reg1, rtx reg2) { static int labelno = 0; - char loop_lab[32], end_lab[32], tmp[64]; + char loop_lab[32], tmp[64]; rtx xops[2]; - ASM_GENERATE_INTERNAL_LABEL (loop_lab, "LPSRL", labelno); - ASM_GENERATE_INTERNAL_LABEL (end_lab, "LPSRE", labelno++); + ASM_GENERATE_INTERNAL_LABEL (loop_lab, "LPSRL", labelno++); + /* Loop. */ ASM_OUTPUT_INTERNAL_LABEL (asm_out_file, loop_lab); - /* Jump to END_LAB if TEST_ADDR == LAST_ADDR. */ - xops[0] = reg1; - xops[1] = reg2; - strcpy (tmp, "%(%