From patchwork Sun Nov 3 06:40:11 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Pinski X-Patchwork-Id: 2005637 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=quicinc.com header.i=@quicinc.com header.a=rsa-sha256 header.s=qcppdkim1 header.b=J7PlL2zZ; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=8.43.85.97; helo=server2.sourceware.org; envelope-from=gcc-patches-bounces~incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=patchwork.ozlabs.org) Received: from server2.sourceware.org (server2.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4Xh4jt54M6z1xxN for ; Sun, 3 Nov 2024 17:40:45 +1100 (AEDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 59ABE3858C39 for ; Sun, 3 Nov 2024 06:40:43 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mx0a-0031df01.pphosted.com (mx0a-0031df01.pphosted.com [205.220.168.131]) by sourceware.org (Postfix) with ESMTPS id D7B673858D26 for ; Sun, 3 Nov 2024 06:40:23 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org D7B673858D26 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=quicinc.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=quicinc.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org D7B673858D26 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=205.220.168.131 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1730616025; cv=none; b=et10ZLHJcE9InOR2Sg45KQ/Gqz//knXW9P5OGS+vJ3mDbTh6XVo5OXOoO5tJvmCLQkiOIsJEbRE+8sdPvVFXpru1Fvo69KoL3g2ZpReT8FGNRzU1rOwslDQ8FmfjM0okHeQUoNR1VW8sCun9qO7b7BOyDrLiKPeWS0qL1lDvviQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1730616025; c=relaxed/simple; bh=9j+eAnPYbNAbji5CbSMxMul0/+RPRWGItF/dZn7Aby8=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=Hzct1CgnV8F8gxd5otOAfsxo5Y6IvCFKwSxjUoCljYBUxE7mCQJHTh/MmwI3hYTPDGLyQqr2JXilEJP34YVlBm9Ws6F8vL8rGvVM16/ULUMyOUF+uPzChtma3OURDMW4Y3WAwwkHEGRK73P7/47eaovJP5BJxu/Ro1vG1+6Eq6E= ARC-Authentication-Results: i=1; server2.sourceware.org Received: from pps.filterd (m0279867.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 4A36JrJj029108 for ; Sun, 3 Nov 2024 06:40:22 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; h= cc:content-transfer-encoding:content-type:date:from:message-id :mime-version:subject:to; s=qcppdkim1; bh=pteDe3BdUAd9/scX4+aMju GpEvCWtRgP7aBrJfpDJcU=; b=J7PlL2zZlsw7TKCUfIURsOEVp9TOnPtU7/bM+B QEdwQ8KjZEooF53DnY16kucO8iRC5FKnETwvMHvNuDAOj0wPronFsGnUfIwJFqRy K47HkD6xQuM6l9PPmtyG0VS9xuQR1rMTc7YLYmCyYLVOhiT6aka7X07mfX/3kzoB t2yu7uJ3acKbzSYg/QkmP3SSWhXiKpryMJoMSkS3WMZsk7nv9GAAhMLaf3trGEGg R7Ai6/GCudTCJgYYEUJRygQgt2MCSmvM/wDz0r0EXQaZiH890YMiCm9XF2ipyY0F MeGwEXd+UcPp+FEMf6A9rhFq9nD2iYHN/PiFMUszuqUANjzw== Received: from nasanppmta02.qualcomm.com (i-global254.qualcomm.com [199.106.103.254]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 42nd4tsqbt-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Sun, 03 Nov 2024 06:40:22 +0000 (GMT) Received: from nasanex01c.na.qualcomm.com (nasanex01c.na.qualcomm.com [10.45.79.139]) by NASANPPMTA02.qualcomm.com (8.18.1.2/8.18.1.2) with ESMTPS id 4A36eLYk027629 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Sun, 3 Nov 2024 06:40:21 GMT Received: from hu-apinski-lv.qualcomm.com (10.49.16.6) by nasanex01c.na.qualcomm.com (10.45.79.139) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.9; Sat, 2 Nov 2024 23:40:21 -0700 From: Andrew Pinski To: CC: Andrew Pinski Subject: [PATCH] docs: Document that __builtin_assoc_barrier also can be used for FMAs [PR115023] Date: Sat, 2 Nov 2024 23:40:11 -0700 Message-ID: <20241103064011.3662578-1-quic_apinski@quicinc.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 X-Originating-IP: [10.49.16.6] X-ClientProxiedBy: nalasex01c.na.qualcomm.com (10.47.97.35) To nasanex01c.na.qualcomm.com (10.45.79.139) X-QCInternal: smtphost X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 signatures=585085 X-Proofpoint-GUID: 6xb-Z2H46k0hQZbrE7DFS8pAbVvLHZeY X-Proofpoint-ORIG-GUID: 6xb-Z2H46k0hQZbrE7DFS8pAbVvLHZeY X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1039,Hydra:6.0.680,FMLib:17.12.60.29 definitions=2024-09-06_09,2024-09-06_01,2024-09-02_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 adultscore=0 clxscore=1015 impostorscore=0 bulkscore=0 lowpriorityscore=0 mlxlogscore=999 malwarescore=0 priorityscore=1501 suspectscore=0 mlxscore=0 spamscore=0 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2409260000 definitions=main-2411030063 X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gcc-patches-bounces~incoming=patchwork.ozlabs.org@gcc.gnu.org I noticed that __builtin_assoc_barrier makes a differnce for FMAs formation but it was not documented. This adds that documentation even with a small example. Build the HTML documents to make sure everything looks correct. gcc/ChangeLog: PR middle-end/115023 * doc/extend.texi (__builtin_assoc_barrier): Document ffp-contract=fast and FMA usage. Signed-off-by: Andrew Pinski --- gcc/doc/extend.texi | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/gcc/doc/extend.texi b/gcc/doc/extend.texi index ad1821e3e23..5902e76f043 100644 --- a/gcc/doc/extend.texi +++ b/gcc/doc/extend.texi @@ -15555,8 +15555,7 @@ This built-in inhibits re-association of the floating-point expression @var{expr} with expressions consuming the return value of the built-in. The expression @var{expr} itself can be reordered, and the whole expression @var{expr} can be reordered with operands after the barrier. The barrier is -only relevant when @code{-fassociative-math} is active, since otherwise -floating-point is not treated as associative. +relevant when @code{-fassociative-math} is active. @smallexample float x0 = a + b - b; @@ -15566,6 +15565,19 @@ float x1 = __builtin_assoc_barrier(a + b) - b; @noindent means that, with @code{-fassociative-math}, @code{x0} can be optimized to @code{x0 = a} but @code{x1} cannot. + +It is also relevant when @code{-ffp-contract=fast} is active; +it will prevent contraction between expressions. + +@smallexample +float x0 = a * b + c; +float x1 = __builtin_assoc_barrier (a * b) + c; +@end smallexample + +@noindent +means that, with @code{-ffp-contract=fast}, @code{x0} may be optimized to +use a fused multiply-add instruction but @code{x1} cannot. + @enddefbuiltin @defbuiltin{{void *} __builtin_assume_aligned (const void *@var{exp}, size_t @var{align}, ...)}