From patchwork Thu Nov 10 00:09:01 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Ian Lance Taylor X-Patchwork-Id: 17872 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp634323wru; Wed, 9 Nov 2022 16:12:03 -0800 (PST) X-Google-Smtp-Source: AMsMyM7K/8Q+iRpRp2EyUz/lHGWBXQJC/FkUzS2isaxlkwE1hZ9TSmoV+V9IsJobJo0ScY3c7j5b X-Received: by 2002:a17:906:24cd:b0:78d:4cb3:f65d with SMTP id f13-20020a17090624cd00b0078d4cb3f65dmr2026052ejb.79.1668039122849; Wed, 09 Nov 2022 16:12:02 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668039122; cv=none; d=google.com; s=arc-20160816; b=z+4iE/40Obri4/tF431eG2a3cEzxUJu5JJNrpEvV160qyHDgSfmWKIiS9rEQHgLl67 mMPpWtzFrEil6C4FS5adpp3FItXqaLK4z6NHOmKpE9xovSwkmZtoO29WRtV4HhSAmees nV3usQk/hpkD2QIzUcrJ7E0UQso63/LYg9uWoGKe4vQ+1p3UseGvkbGY7GMjYUEzd2ly KdJ0TtpNKagL/6pUIRsRn30mUY1+CqyzvpUYj3kcuTFnzGZHdXd1dSC/ANWLMwta3aUw 5j9ng24+yYUqaNMTLIFFzV5zO98xOSKngKwTs5coB3GglG0w3j7FMFcZtlZip/l4wh5d Hxyw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:reply-to:from:list-subscribe:list-help:list-post :list-archive:list-unsubscribe:list-id:precedence:to:subject :message-id:date:mime-version:dmarc-filter:delivered-to :dkim-signature:dkim-filter; bh=GD9EEc1KB+hEYz2L6ZnoH4V87xZPTpjk+PUpuyEm1qE=; b=YOI0PMOy8wHDBTrmLyrBcbE7FVWy/tSmdKEiWGjsenauRJEgsth0iUJmUfi8/+GnYE gIlblV/Y0wHS3dC4xBS7IGcDj75UnSeKTHtlnLYQrp6S3fJDoeyYWc/8+D3rZOWEW6Sk aRcpZ7rYCEr/S6cb5bVFSOXeemeEdsmrR4jG1SBYrohQhgWeDGQbxN8wENZ6qIYmjbzP ABBC9RWUDGTlVo4dS9JUT5TmcUULpJgCDoisTODGiTvGc0r0k6vf/kkV5bwU3shEeDB3 +1W6qkRuBLW+o2PDiPNWSKkXTRMWSHcxiwFrZ2ExG2xPUUT4UqXnSamsyFBF+9VYUXXk /VEQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=EQTm3oWc; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gnu.org Received: from sourceware.org (ip-8-43-85-97.sourceware.org. [8.43.85.97]) by mx.google.com with ESMTPS id le10-20020a170907170a00b007ad88f87f07si12988183ejc.599.2022.11.09.16.12.02 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 09 Nov 2022 16:12:02 -0800 (PST) Received-SPF: pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) client-ip=8.43.85.97; Authentication-Results: mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=EQTm3oWc; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gnu.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 18A173899018 for ; Thu, 10 Nov 2022 00:11:18 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 18A173899018 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1668039078; bh=GD9EEc1KB+hEYz2L6ZnoH4V87xZPTpjk+PUpuyEm1qE=; h=Date:Subject:To:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=EQTm3oWcl0o24g5zMGIR8qpWl7m6jCZW7MKoeNeU5eefv9Y33rev3krBbJoU+298i yCGFGkT70xK9jKUZ4s7uyceUpvZnsENf+UcVCIx2RMOR25BmBk/e8M6UkPSI6CIx8d OiNFCVZTLqJSqfTk0LtPJk6+T48Uyk2QXrlT8hWM= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-pj1-x1031.google.com (mail-pj1-x1031.google.com [IPv6:2607:f8b0:4864:20::1031]) by sourceware.org (Postfix) with ESMTPS id 097CA388A021 for ; Thu, 10 Nov 2022 00:09:14 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 097CA388A021 Received: by mail-pj1-x1031.google.com with SMTP id b11so342410pjp.2 for ; Wed, 09 Nov 2022 16:09:13 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=to:subject:message-id:date:from:mime-version:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=GD9EEc1KB+hEYz2L6ZnoH4V87xZPTpjk+PUpuyEm1qE=; b=eTqRicFqosZPVkeGNkbaSFC/zTb2o7yeiVOn7VleOfer3D2VqQJ9UlfpYVoVbW37Ol L1rYoYv5AbYCMWCz9Bod+pkF0Q14nmSzuU97STv2yBVIQtxy5nUon3iR3Y+NrGAMmod0 Nyh+hV+7IeZav60sNWpfHxVQoopJmteYqvUHREZx3fqIOfUSPt60BLNiWoAcLSdgs/Ug AR0yklRnOFIjedyLixWOfpdDVMmNUiV+8OCBhPaMDd5jp66z7SzbMjb64ZA1bClh24uQ P9WPGb5Bni1k1Fq25wGK30sZzXeLj1pcBzOdV8B0CCDC5WrM65KgjiEBLrEoq+RfOHHp 7aQA== X-Gm-Message-State: ACrzQf3w5qsdoldrn0pN1gm8GMi53mvn2HAixXifTbidMBP823pyT0nP vFuuh0fZkCtM8eIkE+xEUhcqFUNSpM8fiAVQYXXKF6LQ/BlZsA== X-Received: by 2002:a17:902:70c4:b0:17c:f9fe:3200 with SMTP id l4-20020a17090270c400b0017cf9fe3200mr63571115plt.1.1668038952418; Wed, 09 Nov 2022 16:09:12 -0800 (PST) MIME-Version: 1.0 Date: Wed, 9 Nov 2022 16:09:01 -0800 Message-ID: Subject: Go patch committed: Define __atomic_fetch_add functions To: gcc-patches , gofrontend-dev X-Spam-Status: No, score=-10.1 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Ian Lance Taylor via Gcc-patches From: Ian Lance Taylor Reply-To: Ian Lance Taylor Errors-To: gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org Sender: "Gcc-patches" X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1749065791085643779?= X-GMAIL-MSGID: =?utf-8?q?1749065791085643779?= This patch to the GCC-specific part of the Go frontend defines the __atomic_fetch_add functions. The frontend only generates calls to the __atomic_add_fetch functions, but in some cases the middle-end can transform the latter into the former. This patch is originally by Marc Poulhiès. This fixes PR 107581. Bootstrapped and ran Go testsuite on x86_64-pc-linux-gnu. Committed to mainline. Ian diff --git a/gcc/go/go-gcc.cc b/gcc/go/go-gcc.cc index 1ba7206caeb..6e5887aecab 100644 --- a/gcc/go/go-gcc.cc +++ b/gcc/go/go-gcc.cc @@ -886,16 +886,20 @@ Gcc_backend::Gcc_backend() uint32_type_node, integer_type_node, NULL_TREE); - this->define_builtin(BUILT_IN_ATOMIC_ADD_FETCH_4, "__atomic_add_fetch_4", NULL, - t, 0); + this->define_builtin(BUILT_IN_ATOMIC_ADD_FETCH_4, "__atomic_add_fetch_4", + NULL, t, 0); + this->define_builtin(BUILT_IN_ATOMIC_FETCH_ADD_4, "__atomic_fetch_add_4", + NULL, t, 0); t = build_function_type_list(uint64_type_node, ptr_type_node, uint64_type_node, integer_type_node, NULL_TREE); - this->define_builtin(BUILT_IN_ATOMIC_ADD_FETCH_8, "__atomic_add_fetch_8", NULL, - t, 0); + this->define_builtin(BUILT_IN_ATOMIC_ADD_FETCH_8, "__atomic_add_fetch_8", + NULL, t, 0); + this->define_builtin(BUILT_IN_ATOMIC_FETCH_ADD_8, "__atomic_fetch_add_8", + NULL, t, 0); t = build_function_type_list(unsigned_char_type_node, ptr_type_node,