From patchwork Sun Sep 14 17:51:12 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andi Kleen X-Patchwork-Id: 389086 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 05489140168 for ; Mon, 15 Sep 2014 03:52:24 +1000 (EST) 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:in-reply-to:references; q=dns; s= default; b=TDrs70Ba+AJ78A8Q4yesbCrJ0afD+pWawqQzljvxnOjI/vEuwCdMe ytda/QgOBiDQF7BKwyZ7xYXhGtRfLl3s/kqtJtQKT7un1PkgYjJ6N6oQDM5FgbTO lBDcHZQoJG2TzdSCekU5gYw10iCE7ZNCFvRDgRVUVdS3EAqRGEawgE= 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:in-reply-to:references; s= default; bh=uGvlChUy2Ry6ntuPcP0mnrkOu9g=; b=YOZ9ZNSs2zj4Z7fLTC5M SDlVOSv6iFUSu5oRPwmWjh7HkXrgFoTUS19QAH2GgG7HyvaqAtaYBiUxVb3FmVH7 XphUyTTYVEqRXnroTJL3vE2QX5NdR5fSRlaaBDX/M7j0feGi2fGUXD6b6XFhyzdC MenRdlkTs140hnslE5CgXI0= Received: (qmail 25987 invoked by alias); 14 Sep 2014 17:52:18 -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 25976 invoked by uid 89); 14 Sep 2014 17:52:17 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.6 required=5.0 tests=AWL, BAYES_00, RP_MATCHES_RCVD autolearn=no version=3.3.2 X-HELO: one.firstfloor.org Received: from one.firstfloor.org (HELO one.firstfloor.org) (193.170.194.197) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-SHA encrypted) ESMTPS; Sun, 14 Sep 2014 17:52:16 +0000 Received: from basil.firstfloor.org (184-100-254-193.ptld.qwest.net [184.100.254.193]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by one.firstfloor.org (Postfix) with ESMTPSA id 7C53F86A2D; Sun, 14 Sep 2014 19:52:12 +0200 (CEST) Received: by basil.firstfloor.org (Postfix, from userid 1000) id 43BE8A9430; Sun, 14 Sep 2014 10:51:15 -0700 (PDT) From: Andi Kleen To: gcc-patches@gcc.gnu.org Cc: hubicka@ucw.cz, Andi Kleen Subject: [PATCH 2/2] Add test cases for noreorder Date: Sun, 14 Sep 2014 10:51:12 -0700 Message-Id: <1410717072-21031-2-git-send-email-andi@firstfloor.org> In-Reply-To: <1410717072-21031-1-git-send-email-andi@firstfloor.org> References: <1410717072-21031-1-git-send-email-andi@firstfloor.org> From: Andi Kleen Add some simple test cases for noreorder behaving like -fno-toplevel-reorder and -fno-toplevel-reorder still working. Unfortunately there's no easy way to check for output order in DG, so we just check for existence. gcc/testsuite/: 2014-09-14 Andi Kleen * gcc.dg/noreorder.c: New test. * gcc.dg/noreorder2.c: New test. * gcc.dg/noreorder3.c: New test. --- gcc/testsuite/gcc.dg/noreorder.c | 24 ++++++++++++++++++++++++ gcc/testsuite/gcc.dg/noreorder2.c | 11 +++++++++++ gcc/testsuite/gcc.dg/noreorder3.c | 10 ++++++++++ 3 files changed, 45 insertions(+) create mode 100644 gcc/testsuite/gcc.dg/noreorder.c create mode 100644 gcc/testsuite/gcc.dg/noreorder2.c create mode 100644 gcc/testsuite/gcc.dg/noreorder3.c diff --git a/gcc/testsuite/gcc.dg/noreorder.c b/gcc/testsuite/gcc.dg/noreorder.c new file mode 100644 index 0000000..1559465 --- /dev/null +++ b/gcc/testsuite/gcc.dg/noreorder.c @@ -0,0 +1,24 @@ +/* { dg-do compile } */ +/* { dg-options "-O2" } */ + +extern void f2(int); + +__attribute__((no_reorder, noinline)) static int foobar(void) +{ + f2(1); +} + +static int barbar(void) +{ + f2(2); +} + +int bozo(void) +{ + f2(3); + foobar(); +} + +/* { dg-final { scan-assembler "foobar" } } */ +/* { dg-final { scan-assembler "bozo" } } */ +/* { dg-final { scan-assembler-not "barbar" } } */ diff --git a/gcc/testsuite/gcc.dg/noreorder2.c b/gcc/testsuite/gcc.dg/noreorder2.c new file mode 100644 index 0000000..558361b --- /dev/null +++ b/gcc/testsuite/gcc.dg/noreorder2.c @@ -0,0 +1,11 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -fno-toplevel-reorder" } */ + +__attribute__((no_reorder)) int foobar; + +static int barbar; +int bozo; + +/* { dg-final { scan-assembler "foobar" } } */ +/* { dg-final { scan-assembler "bozo" } } */ +/* { dg-final { scan-assembler "barbar" } } */ diff --git a/gcc/testsuite/gcc.dg/noreorder3.c b/gcc/testsuite/gcc.dg/noreorder3.c new file mode 100644 index 0000000..a0b637f --- /dev/null +++ b/gcc/testsuite/gcc.dg/noreorder3.c @@ -0,0 +1,10 @@ +/* { dg-do compile } */ +/* { dg-options "-O2" } */ + +__attribute__((no_reorder)) int foobar; +static int barbar; +int bozo; + +/* { dg-final { scan-assembler "foobar" } } */ +/* { dg-final { scan-assembler "bozo" } } */ +/* { dg-final { scan-assembler-not "barbar" } } */