From patchwork Tue Oct 31 09:41:28 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Segher Boessenkool X-Patchwork-Id: 832303 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=gcc.gnu.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=gcc-patches-return-465568-incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="P0gXenKM"; dkim-atps=neutral Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3yR5wd14CYz9t3C for ; Tue, 31 Oct 2017 20:41:51 +1100 (AEDT) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:from :to:cc:subject:date:message-id; q=dns; s=default; b=AV1ZpZgU1aNk YtoHhLvhhBAH9FLLoon3Femh4mgdwRPZ9Y9qAOp0WqAOLDHeFO0wMlHvb4wAJX4+ nSf9CkJ4rtvNU1bS5rEsNr17W9lekag9Rvbqeg0RaBmLySQYZtaWTNgGlZwveq7c p18Llx5a7XvdlFkhU8ejniAWzpcmIG4= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:from :to:cc:subject:date:message-id; s=default; bh=IaOYwM+mTqPTJvDxKd YQl0JDLmQ=; b=P0gXenKMdiRC4H2wBOFGafB41eXZa32++ff08pHiapv2PsXUAQ aX36MSnRdqaM6dbcukqy8LvkGTU87KRITn88WhXveTHB8XZ6NevHTmLkgVmpViAU We8kt4Tej9M1PhXAD7fuQKLstTbtaDpDA/jyw9s16qNZqxb57nCIXzd8A= Received: (qmail 46909 invoked by alias); 31 Oct 2017 09:41:43 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Received: (qmail 46081 invoked by uid 89); 31 Oct 2017 09:41:41 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-24.2 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, KAM_LAZY_DOMAIN_SECURITY, RP_MATCHES_RCVD autolearn=ham version=3.3.2 spammy=asks X-HELO: gcc1-power7.osuosl.org Received: from gcc1-power7.osuosl.org (HELO gcc1-power7.osuosl.org) (140.211.15.137) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 31 Oct 2017 09:41:35 +0000 Received: by gcc1-power7.osuosl.org (Postfix, from userid 10019) id 6AB4012402AD; Tue, 31 Oct 2017 09:41:34 +0000 (UTC) From: Segher Boessenkool To: gcc-patches@gcc.gnu.org Cc: dje.gcc@gmail.com, law@redhat.com, Segher Boessenkool Subject: [PATCH] rs6000: Fix crash with big stack clash interval (PR82674) Date: Tue, 31 Oct 2017 09:41:28 +0000 Message-Id: X-IsSubscribed: yes If the user asks for a stack clash probe interval of 64kB, we currently generate a "stdu rX,-65536(r1)" instruction. That instruction does not exist (the offset is a 16-bit signed number). If the offset is too big we should force it into a register and generate a "stdux rX,rY,r1" instruction, instead. Bootstrapped and regression checked on powerpc64-linux {-m32,-m64}; committing to trunk. Segher 2017-10-31 Segher Boessenkool PR target/82674 * config/rs6000/rs6000.md (allocate_stack): Force update interval into a register if it does not fit into an immediate offset field. --- gcc/config/rs6000/rs6000.md | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/gcc/config/rs6000/rs6000.md b/gcc/config/rs6000/rs6000.md index 62bd19b..18ebe8f 100644 --- a/gcc/config/rs6000/rs6000.md +++ b/gcc/config/rs6000/rs6000.md @@ -10333,6 +10333,9 @@ (define_expand "allocate_stack" { rtx loop_lab, end_loop; bool rotated = CONST_INT_P (rounded_size); + rtx update = GEN_INT (-probe_interval); + if (probe_interval > 32768) + update = force_reg (Pmode, update); emit_stack_clash_protection_probe_loop_start (&loop_lab, &end_loop, last_addr, rotated); @@ -10340,13 +10343,11 @@ (define_expand "allocate_stack" if (Pmode == SImode) emit_insn (gen_movsi_update_stack (stack_pointer_rtx, stack_pointer_rtx, - GEN_INT (-probe_interval), - chain)); + update, chain)); else emit_insn (gen_movdi_di_update_stack (stack_pointer_rtx, stack_pointer_rtx, - GEN_INT (-probe_interval), - chain)); + update, chain)); emit_stack_clash_protection_probe_loop_end (loop_lab, end_loop, last_addr, rotated); }