From patchwork Tue May 1 15:53:07 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 156151 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]) by ozlabs.org (Postfix) with SMTP id 732FBB6FAA for ; Wed, 2 May 2012 02:20:57 +1000 (EST) Comment: DKIM? See http://www.dkim.org DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=gcc.gnu.org; s=default; x=1336494058; h=Comment: DomainKey-Signature:Received:Received:Received:Received:Received: Message-ID:Date:From:User-Agent:MIME-Version:To:Subject: Content-Type:Mailing-List:Precedence:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:Sender:Delivered-To; bh=t3xryMZ lySzaIfQr9ZO31kaGBFY=; b=hr/6Ejdji7d8EgytoZd/GOga8QvHhjK2LeXOD6z HwxAKcK5TODkEHSZXhU4b1q8cBnYwTluJunYuYK4hyz5WbTwDXOOePMIDq/+zLE+ j3qhuMfCU6OGKAwLHGo9s8O+zRfChBt4c7tor2khjjFvg82kwXrrJ/6oR5NXLkk7 j+ic= Comment: DomainKeys? See http://antispam.yahoo.com/domainkeys DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=default; d=gcc.gnu.org; h=Received:Received:X-SWARE-Spam-Status:X-Spam-Check-By:Received:Received:Received:Message-ID:Date:From:User-Agent:MIME-Version:To:Subject:Content-Type:X-IsSubscribed:Mailing-List:Precedence:List-Id:List-Unsubscribe:List-Archive:List-Post:List-Help:Sender:Delivered-To; b=BSNvHKswCCeLSJrdU+2276Uv7vcRpNX+rfRxQmX2GBsr3ODpb/YSHAUO5j3y7P eCtqhay3JiSbotN8QFm7xxY/sZUYxkqMdn2HF0MaX3LcZeUHP4UgGtN+BgtMVF8g nt0WqQAouDlChQxSQwzsGKRPTOsgPJTQ6GATJMRTrmu0Q=; Received: (qmail 2692 invoked by alias); 1 May 2012 16:20:53 -0000 Received: (qmail 2679 invoked by uid 22791); 1 May 2012 16:20:51 -0000 X-SWARE-Spam-Status: No, hits=-6.2 required=5.0 tests=AWL, BAYES_00, KHOP_RCVD_UNTRUST, RCVD_IN_DNSWL_HI, RCVD_IN_HOSTKARMA_W, SPF_HELO_PASS, T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 01 May 2012 16:20:38 +0000 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id q41GKZNe001812 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Tue, 1 May 2012 12:20:37 -0400 Received: from pebble.twiddle.net (vpn-10-162.rdu.redhat.com [10.11.10.162]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id q41Fr8gE001658 for ; Tue, 1 May 2012 11:53:09 -0400 Message-ID: <4FA006E3.90401@redhat.com> Date: Tue, 01 May 2012 08:53:07 -0700 From: Richard Henderson User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:12.0) Gecko/20120425 Thunderbird/12.0 MIME-Version: 1.0 To: GCC Patches Subject: [committed] Add -fno-sync-libcalls X-IsSubscribed: yes 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 A support option for implementing libatomic, committed as a separate patch. r~ * common.opt (fsync-libcalls): New. * doc/invoke.texi: Document it. * optabs.c (init_sync_libfuncs): Honor it. diff --git a/gcc/common.opt b/gcc/common.opt index af02992..cc57976 100644 --- a/gcc/common.opt +++ b/gcc/common.opt @@ -1878,6 +1878,10 @@ fstrict-overflow Common Report Var(flag_strict_overflow) Treat signed overflow as undefined +fsync-libcalls +Common Report Var(flag_sync_libcalls) Init(1) +Implement __atomic operations via libcalls to legacy __sync functions + fsyntax-only Common Report Var(flag_syntax_only) Check for syntax errors, then stop diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi index a7efaa7..5550c71 100644 --- a/gcc/doc/invoke.texi +++ b/gcc/doc/invoke.texi @@ -990,7 +990,7 @@ See S/390 and zSeries Options. -fno-stack-limit -fsplit-stack @gol -fleading-underscore -ftls-model=@var{model} @gol -ftrapv -fwrapv -fbounds-check @gol --fvisibility -fstrict-volatile-bitfields} +-fvisibility -fstrict-volatile-bitfields -fsync-libcalls} @end table @menu @@ -19824,6 +19824,16 @@ that it is unaware of. The default value of this option is determined by the application binary interface for the target processor. +@item -fsync-libcalls +@opindex fsync-libcalls +This option controls whether any out-of-line instance of the @code{__sync} +family of functions may be used to implement the C++11 @code{__atomic} +family of functions. + +The default value of this option is enabled, thus the only useful form +of the option is @option{-fno-sync-libcalls}. This option is used in +the implementation of the @file{libatomic} runtime library. + @end table @c man end diff --git a/gcc/optabs.c b/gcc/optabs.c index 080061a..7ef513a 100644 --- a/gcc/optabs.c +++ b/gcc/optabs.c @@ -6643,6 +6643,9 @@ init_sync_libfuncs_1 (optab tab, const char *base, int max) void init_sync_libfuncs (int max) { + if (!flag_sync_libcalls) + return; + init_sync_libfuncs_1 (sync_compare_and_swap_optab, "__sync_val_compare_and_swap", max); init_sync_libfuncs_1 (sync_lock_test_and_set_optab,