From patchwork Wed Aug 31 15:53:52 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Botcazou X-Patchwork-Id: 664574 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org 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 3sPVLB0cv3z9sDk for ; Thu, 1 Sep 2016 01:53:52 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b=kdrHrzgS; dkim-atps=neutral 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:subject:date:message-id:mime-version:content-type :content-transfer-encoding; q=dns; s=default; b=pRn9TpkKxltdd2ny zVEpNDdFlm3RtD2IRxDeKgfP6VxSciXilWgcm9ube42JceVLsMJI0oa+oQ+Y4tV+ MelRQ0JLyRdEH+QBKzmT83HgjaOV+S0iJugPERY2Zj4OQvsdP+Oo3jJcyBHw29jp BFrQhWtiaDmnkLJ2eWRWsRw1W1k= 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:subject:date:message-id:mime-version:content-type :content-transfer-encoding; s=default; bh=8BOEum8ncCpPgHlpgytX9/ 0fp/w=; b=kdrHrzgSsom8zfFYy80+H1BbVCheYy9qVfL/wVcTxQ4KL/oCfXH4ly WkquOj3nEsuHHKU/LRyDE4kL8y8RuLbA84xbdxS0fsasB6WceFg59IIWLpa4GNj5 7qLytoythYRJAW7p1O3tgZPFPAJlIJtvu9sfI4/UC9vPI++JAs9ic= Received: (qmail 612 invoked by alias); 31 Aug 2016 15:53:45 -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 599 invoked by uid 89); 31 Aug 2016 15:53:44 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_NONE, SPF_PASS autolearn=ham version=3.3.2 spammy=Hx-languages-length:1727, HContent-Transfer-Encoding:7Bit, late 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 ESMTP; Wed, 31 Aug 2016 15:53:34 +0000 Received: from localhost (localhost [127.0.0.1]) by filtered-smtp.eu.adacore.com (Postfix) with ESMTP id 8E357812E7 for ; Wed, 31 Aug 2016 17:53:32 +0200 (CEST) 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 TWI6t40WX_Eb for ; Wed, 31 Aug 2016 17:53:32 +0200 (CEST) Received: from arcturus.home (ADijon-653-1-219-32.w83-196.abo.wanadoo.fr [83.196.118.32]) (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 678E9812CD for ; Wed, 31 Aug 2016 17:53:32 +0200 (CEST) From: Eric Botcazou To: gcc-patches@gcc.gnu.org Subject: [x86] Disable STV pass if -mstackrealign is enabled. Date: Wed, 31 Aug 2016 17:53:52 +0200 Message-ID: <3807001.SkNshUrUcD@arcturus.home> User-Agent: KMail/4.14.10 (Linux/3.16.7-42-desktop; KDE/4.14.9; x86_64; ; ) MIME-Version: 1.0 Hi, the new STV pass generates SSE instructions in 32-bit mode very late in the pipeline and doesn't bother about realigning the stack, so it wreaks havoc on OSes where you need to realign the stack, e.g. Windows, but I guess Solaris is equally affected. Therefore the attached patch disables it if -mstackrealign is enabled (the option is automatically enabled on Windows and Solaris when SSE support is enabled), as already done for -mpreferred-stack-boundary={2,3} and -mincoming-stack-boundary={2,3}. Tested on x86/Windows, OK for mainline and 6 branch? 2016-08-31 Eric Botcazou * config/i386/i386.c (ix86_option_override_internal): Also disable the STV pass if -mstackrealign is enabled. Index: config/i386/i386.c =================================================================== --- config/i386/i386.c (revision 239842) +++ config/i386/i386.c (working copy) @@ -5957,11 +5957,12 @@ ix86_option_override_internal (bool main_args_p, if (!(opts_set->x_target_flags & MASK_STV)) opts->x_target_flags |= MASK_STV; /* Disable STV if -mpreferred-stack-boundary={2,3} or - -mincoming-stack-boundary={2,3} - the needed + -mincoming-stack-boundary={2,3} or -mstackrealign - the needed stack realignment will be extra cost the pass doesn't take into account and the pass can't realign the stack. */ if (ix86_preferred_stack_boundary < 128 - || ix86_incoming_stack_boundary < 128) + || ix86_incoming_stack_boundary < 128 + || opts->x_ix86_force_align_arg_pointer) opts->x_target_flags &= ~MASK_STV; if (!ix86_tune_features[X86_TUNE_AVX256_UNALIGNED_LOAD_OPTIMAL] && !(opts_set->x_target_flags & MASK_AVX256_SPLIT_UNALIGNED_LOAD))