From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-ej1-x62a.google.com (mail-ej1-x62a.google.com [IPv6:2a00:1450:4864:20::62a]) by sourceware.org (Postfix) with ESMTPS id A69D63858D33 for ; Thu, 4 Jan 2024 16:19:17 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org A69D63858D33 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org A69D63858D33 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2a00:1450:4864:20::62a ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1704385159; cv=none; b=VyzYHCuO2l8Se8Bo9a+ShT1cvMdmhE9feDDeNwcFrWgY9ceCAwUnlzvrWgMIw7ILAJvsec2QCj8njqgHSGQGdsogDfmoAKaj3L4SSihapHoah4o9MZYf3p6s+c3TSMVqqzBoIj4FZtQskjqC9NMx/cP8uicp+oFR9rsxp5GUlXI= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1704385159; c=relaxed/simple; bh=hRKpCfbSYUzqBZ38339+LrlJf5o1L89S8JhSqy8fhIU=; h=DKIM-Signature:MIME-Version:From:Date:Message-ID:Subject:To; b=ZcC0k8ZNbT8BhkNt6yQA8F6fuC7IOtdu8ZrQi70m+k9MAzRhR0ohrEHFR8jPSwBBS9j9RoHy7eQtgyz1Rujp6JDmAQTA6bY7/RMe95hZHPEzV+N2TGSliv939ESATPaf8X98fxAVCjIulGUUE3SbVoYKOofIpO7hqomMUwwlgXY= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-ej1-x62a.google.com with SMTP id a640c23a62f3a-a29058bb2ceso11253466b.0 for ; Thu, 04 Jan 2024 08:19:17 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1704385156; x=1704989956; darn=gcc.gnu.org; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=TU2PYMx+KwRyvt7i06frHsmHBKgZW0c+5j5WZYN+1k4=; b=HxTlE9ivCfhYCQpTF+/J8TXv5tK5hKlSz3CXQNfbivJS4XTS2Nebe3MrEv1+aYYKeu ryMD4yb3O2jH5LEocZZwiPvRgggJV5oebOG8VgIoBR/7/gRzOMEveMgic0f5ASC02eUR fiC11muZPuictaGjDc24RrDgOmZYPf26PkK6BxhKRIu6UtPJMzUY2R5noI1BpO/o5S9h +5AQhmve4dp6plB2o0WUEaV74JHNyH9SzUO64ji7EvNexsrRZ7rhUng/ZX+EXGj58i/V TmyFSMA4pOwdbyP26+ek+AtLudNPKyESXdU1hRtf/uDseHS5BCRgEOajpcxjUHnm/eJO 2H4A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1704385156; x=1704989956; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=TU2PYMx+KwRyvt7i06frHsmHBKgZW0c+5j5WZYN+1k4=; b=SML882T9ESbFRXTr1/hlmAA+fxtoSWk0Ra2604I3HKkehS5NR8EbuTBTfQY24a/bx3 rC/CxM3gwaxwCMmciw6f0KfeMWhBz9cTpht9qWTyjj90rOQJguLAm/L2Y05fUshhkBcl Z4kpr0FRgroZpgHQaDXlNd22XiSqtWQMrUpX6iGK/r7Id39Po/6WeOuIlzDd2LOLLTCb zG3LMAJ5oK/BjeLm4fau7ix4kiecu85ftqGjZZ6+DThOgy1+RsUiqirIbomzkgwvm5Rb mnZ+e4Sm6kZBXsdJA5kPHeB+BPINcbJ1XcGekymhl6Ypy6zIqtGz9lZjb/e4FaPeYmyk veoA== X-Gm-Message-State: AOJu0Yz4xZc6fwUxnK55dwc7w7mUQd4z5YVa1uDVlcg2lPkNROUUZf36 tco0vLWRv3nFDe3apC6ZCFZ2ZnKMOFQS/4X1ZqisFfWwFjc= X-Google-Smtp-Source: AGHT+IF60mvzDTiShbUd+9vySL0LU1gHqQMdbhVJqKL1IFnJRimpuk5+U1gulDSsEZFTNo+yRCnTyfilKm3O1JB79Rw= X-Received: by 2002:a17:906:c291:b0:a28:b12:58f9 with SMTP id r17-20020a170906c29100b00a280b1258f9mr337199ejz.136.1704385156002; Thu, 04 Jan 2024 08:19:16 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: From: xndcn Date: Fri, 5 Jan 2024 00:19:04 +0800 Message-ID: Subject: Re: Ping: [PATCH] enable ATOMIC_COMPARE_EXCHANGE opt for floating type or types contains padding To: Jakub Jelinek Cc: gcc-patches@gcc.gnu.org Content-Type: multipart/alternative; boundary="000000000000c8b8a4060e2117af" X-Spam-Status: No, score=-0.6 required=5.0 tests=BAYES_00,BODY_8BITS,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,HTML_MESSAGE,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,TXREP,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: --000000000000c8b8a4060e2117af Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Thanks! I am trying to re-write by calling __builtin_clear_padding. But I found gimple_fold_builtin_clear_padding seems only work before SSA pass. Should I remove the assertion? On the other hand, since ATOMIC_COMPARE_EXCHANGE will only work for simple reg type. excluding vector or complex types, is it enough to generate the mask by simple bit operations? Thanks!, xndcn --- static bool gimple_fold_builtin_clear_padding (gimple_stmt_iterator *gsi) { ... /* This should be folded during the lower pass. */ gcc_assert (!gimple_in_ssa_p (cfun) && cfun->cfg =3D=3D NULL); Jakub Jelinek =E4=BA=8E2024=E5=B9=B41=E6=9C=883=E6=97=A5= =E5=91=A8=E4=B8=89 23:52=E5=86=99=E9=81=93=EF=BC=9A > On Wed, Jan 03, 2024 at 11:42:58PM +0800, xndcn wrote: > > Hi, I am new to this, and I really need your advice, thanks. > > > > I noticed PR71716 and I want to enable ATOMIC_COMPARE_EXCHANGE > > internal-fn optimization > > > > for floating type or types contains padding (e.g., long double). > > Please correct me if I happen to > > make any mistakes, Thanks! > > > > Firstly, about the concerns of sNaNs float/doduble value, it seems > > work well and shall have been > > covered by testsuite/gcc.dg/atomic/c11-atomic-exec-5.c > > > > Secondly, since ATOMIC_COMPARE_EXCHANGE is only enabled when expected > > var is only addressable > > because of the call, the padding bits can not be modified by any other > > stmts. So we can save all > > bits after ATOMIC_COMPARE_EXCHANGE call and extract the padding bits. > > After first iteration, the > > extracted padding bits can be mixed with the expected var. > > > > Bootstrapped/regtested on x86_64-linux. > > > > I did some benchmarks, and there is some significant time optimization > > for float/double types, > > > > while there is no regression for long double type. > > If anything, this should be using clear_padding_type_may_have_padding_p > and call to __builtin_clear_padding. > Code in that file uses /* ... */ style comments, so please use them inste= ad > of // for consistency, and furthermore comments should be terminated with > a dot and two spaces before */ > > Also, I don't think this is late stage3 material, so needs to wait for GCC > 15. > > Jakub > > --000000000000c8b8a4060e2117af--