From patchwork Tue Mar 29 20:13:52 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "H.J. Lu" X-Patchwork-Id: 603138 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 3qZMS00V3xz9sBm for ; Wed, 30 Mar 2016 07:14:07 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b=cv/0C3wx; 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:date :from:to:cc:subject:message-id:reply-to:mime-version :content-type; q=dns; s=default; b=A5KnqxtRuuG8INVywDoDjWtL7MiP0 5yjotR2y15PdpeB60v5YRtkYaXQtQFX2CAR45t2w0kytFi58k2CqMg68W0Tk4R2d yyABgSHCfuEMlmDtgUsVJMQWcg4nywNswC9I92vaDK9+I9GGvzaMq5Qvu6TgnUS0 G6ERAqBnaQLNGw= 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:date :from:to:cc:subject:message-id:reply-to:mime-version :content-type; s=default; bh=EUkJoIFONVWnhUYk8h5c9kJKQx0=; b=cv/ 0C3wxT4r71+jU0Su8dctoI8AMLDe87E+o9hY+GrTszRp8P+LgDoaqVjuQJRu+IG4 QaQhlrT7+dNJj3c/IWUiTmgpCbhU8ecszQ9utvC/ftu86GEUNEzxaHROn2po7aDJ nUAVvwApY4OFVvXjh6U4dRDNGml+zR5tbEeRqF6k= Received: (qmail 104873 invoked by alias); 29 Mar 2016 20:13:56 -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 104846 invoked by uid 89); 29 Mar 2016 20:13:55 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-0.7 required=5.0 tests=AWL, BAYES_00, KAM_LAZY_DOMAIN_SECURITY, NO_DNS_FOR_FROM, RP_MATCHES_RCVD autolearn=no version=3.3.2 spammy=$128, Properly, 0xe, 1907 X-HELO: mga14.intel.com Received: from mga14.intel.com (HELO mga14.intel.com) (192.55.52.115) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 29 Mar 2016 20:13:54 +0000 Received: from orsmga002.jf.intel.com ([10.7.209.21]) by fmsmga103.fm.intel.com with ESMTP; 29 Mar 2016 13:13:52 -0700 X-ExtLoop1: 1 Received: from gnu-6.sc.intel.com ([172.25.70.218]) by orsmga002.jf.intel.com with ESMTP; 29 Mar 2016 13:13:53 -0700 Received: by gnu-6.sc.intel.com (Postfix, from userid 1000) id 665F4200116; Tue, 29 Mar 2016 13:13:52 -0700 (PDT) Date: Tue, 29 Mar 2016 13:13:52 -0700 From: "H.J. Lu" To: gcc-patches@gcc.gnu.org Cc: Uros Bizjak Subject: [PATCH] PR testsuite/70364: Properly align stack in gcc.target/i386/cleanup-[12].c Message-ID: <20160329201352.GA11249@intel.com> Reply-To: "H.J. Lu" MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.24 (2015-08-30) Tested on x86-64. OK for trunk? H.J. --- PR testsuite/70364 * gcc.target/i386/cleanup-1.c: Include . (check): New function. (bar): Call check. (foo): Align stack to 16 bytes when calling bar. * gcc.target/i386/cleanup-2.c: Likewise. --- gcc/testsuite/gcc.target/i386/cleanup-1.c | 17 ++++++++++++++--- gcc/testsuite/gcc.target/i386/cleanup-2.c | 17 ++++++++++++++--- 2 files changed, 28 insertions(+), 6 deletions(-) diff --git a/gcc/testsuite/gcc.target/i386/cleanup-1.c b/gcc/testsuite/gcc.target/i386/cleanup-1.c index fc82f35..dcfcc4e 100644 --- a/gcc/testsuite/gcc.target/i386/cleanup-1.c +++ b/gcc/testsuite/gcc.target/i386/cleanup-1.c @@ -4,6 +4,7 @@ #include #include +#include #include #include #include @@ -47,6 +48,14 @@ handler (void *p __attribute__((unused))) _exit (0); } +static void +__attribute__((noinline)) +check (intptr_t p) +{ + if ((p & 15) != 0) + abort (); +} + static int __attribute__((noinline)) fn5 (void) { @@ -59,6 +68,8 @@ void bar (void) { char dummy __attribute__((cleanup (counter))); + unsigned long tmp[4] __attribute__((aligned(16))); + check ((intptr_t) tmp); fn5 (); } @@ -133,9 +144,9 @@ foo (int x) ".type _L_mutex_lock_%=, @function\n" "_L_mutex_lock_%=:\n" "1:\t" "leaq %1, %%rdi\n" -"2:\t" "subq $128, %%rsp\n" +"2:\t" "subq $136, %%rsp\n" "3:\t" "call bar\n" -"4:\t" "addq $128, %%rsp\n" +"4:\t" "addq $136, %%rsp\n" "5:\t" "jmp 24f\n" "6:\t" ".size _L_mutex_lock_%=, .-_L_mutex_lock_%=\n\t" ".previous\n\t" @@ -179,7 +190,7 @@ foo (int x) ".sleb128 4b-3b\n" "16:\t" ".byte 0x40 + (4b-3b-1) # DW_CFA_advance_loc\n\t" ".byte 0x0e # DW_CFA_def_cfa_offset\n\t" - ".uleb128 128\n\t" + ".uleb128 136\n\t" ".byte 0x16 # DW_CFA_val_expression\n\t" ".uleb128 0x10\n\t" ".uleb128 20f-17f\n" diff --git a/gcc/testsuite/gcc.target/i386/cleanup-2.c b/gcc/testsuite/gcc.target/i386/cleanup-2.c index 0ec7c31..7e603233 100644 --- a/gcc/testsuite/gcc.target/i386/cleanup-2.c +++ b/gcc/testsuite/gcc.target/i386/cleanup-2.c @@ -4,6 +4,7 @@ #include #include +#include #include #include #include @@ -47,6 +48,14 @@ handler (void *p __attribute__((unused))) _exit (0); } +static void +__attribute__((noinline)) +check (intptr_t p) +{ + if ((p & 15) != 0) + abort (); +} + static int __attribute__((noinline)) fn5 (void) { @@ -59,6 +68,8 @@ void bar (void) { char dummy __attribute__((cleanup (counter))); + unsigned long tmp[4] __attribute__((aligned(16))); + check ((intptr_t) tmp); fn5 (); } @@ -74,9 +85,9 @@ foo (int x) ".type _L_mutex_lock_%=, @function\n" "_L_mutex_lock_%=:\n" "1:\t" "leaq %1, %%rdi\n" -"2:\t" "subq $128, %%rsp\n" +"2:\t" "subq $136, %%rsp\n" "3:\t" "call bar\n" -"4:\t" "addq $128, %%rsp\n" +"4:\t" "addq $136, %%rsp\n" "5:\t" "jmp 21f\n" "6:\t" ".size _L_mutex_lock_%=, .-_L_mutex_lock_%=\n\t" ".previous\n\t" @@ -160,7 +171,7 @@ foo (int x) ".uleb128 6b-5b-1\n" "19:\t" ".byte 0x40 + (3b-1b) # DW_CFA_advance_loc\n\t" ".byte 0xe # DW_CFA_def_cfa_offset\n\t" - ".uleb128 128\n\t" + ".uleb128 136\n\t" ".byte 0x40 + (5b-3b) # DW_CFA_advance_loc\n\t" ".byte 0xe # DW_CFA_def_cfa_offset\n\t" ".uleb128 0\n\t"